Fix T59478: Information Bar Missing Data when in Sculpt Mode

Display statistics from CCG structure.

This makes values to be different from what is shown in object
mode, since CCG is operating on individual grids, and object
mode will stitch those grids. But on another, those values from
CCG is what sculpt mode is actually "sees" or "uses".

The number of faces should be the same in both sculpt and object
modes.
This commit is contained in:
Sergey Sharybin 2018-12-18 14:19:55 +01:00
parent eb78579bb6
commit 6ccf961915
3 changed files with 33 additions and 4 deletions

View File

@ -246,4 +246,10 @@ void BKE_subdiv_ccg_average_stitch_faces(SubdivCCG *subdiv_ccg,
struct CCGFace **effected_faces,
int num_effected_faces);
/* Get geometry counters at the current subdivision level. */
void BKE_subdiv_ccg_topology_counters(
const SubdivCCG *subdiv_ccg,
int *r_num_vertices, int *r_num_edges,
int *r_num_faces, int *r_num_loops);
#endif /* __BKE_SUBDIV_CCG_H__ */

View File

@ -1186,3 +1186,18 @@ void BKE_subdiv_ccg_average_stitch_faces(SubdivCCG *subdiv_ccg,
*/
subdiv_ccg_average_all_boundaries_and_corners(subdiv_ccg, &key);
}
void BKE_subdiv_ccg_topology_counters(
const SubdivCCG *subdiv_ccg,
int *r_num_vertices, int *r_num_edges,
int *r_num_faces, int *r_num_loops)
{
const int num_grids = subdiv_ccg->num_grids;
const int grid_size = subdiv_ccg->grid_size;
const int grid_area = grid_size * grid_size;
const int num_edges_per_grid = 2 * (grid_size * (grid_size - 1));
*r_num_vertices = num_grids * grid_area;
*r_num_edges = num_grids * num_edges_per_grid;
*r_num_faces = num_grids * (grid_size - 1) * (grid_size - 1);
*r_num_loops = *r_num_faces * 4;
}

View File

@ -58,6 +58,7 @@
#include "BKE_object.h"
#include "BKE_gpencil.h"
#include "BKE_scene.h"
#include "BKE_subdiv_ccg.h"
#include "DEG_depsgraph_query.h"
@ -102,10 +103,17 @@ static bool stats_mesheval(Mesh *me_eval, int sel, int totob, SceneStats *stats)
}
int totvert, totedge, totface, totloop;
totvert = me_eval->totvert;
totedge = me_eval->totedge;
totface = me_eval->totpoly;
totloop = me_eval->totloop;
if (me_eval->runtime.subdiv_ccg != NULL) {
const SubdivCCG *subdiv_ccg = me_eval->runtime.subdiv_ccg;
BKE_subdiv_ccg_topology_counters(
subdiv_ccg, &totvert, &totedge, &totface, &totloop);
}
else {
totvert = me_eval->totvert;
totedge = me_eval->totedge;
totface = me_eval->totpoly;
totloop = me_eval->totloop;
}
stats->totvert += totvert * totob;
stats->totedge += totedge * totob;