Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/draw/intern/draw_cache_impl_subdivision.cc7
-rw-r--r--source/blender/editors/space_info/info_stats.cc8
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h8
3 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index 8944388a5ac..4a39ca6dacb 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc
+++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
@@ -1953,6 +1953,13 @@ static bool draw_subdiv_create_requested_buffers(const Scene *scene,
draw_cache->optimal_display = optimal_display;
draw_cache->num_subdiv_triangles = tris_count_from_number_of_loops(draw_cache->num_subdiv_loops);
+ /* Copy topology information for stats display. Use `mesh` directly, as `mesh_eval` could be the
+ * edit mesh. */
+ mesh->runtime.subsurf_totvert = draw_cache->num_subdiv_verts;
+ mesh->runtime.subsurf_totedge = draw_cache->num_subdiv_edges;
+ mesh->runtime.subsurf_totpoly = draw_cache->num_subdiv_quads;
+ mesh->runtime.subsurf_totloop = draw_cache->num_subdiv_loops;
+
draw_cache->use_custom_loop_normals = (smd->flags & eSubsurfModifierFlag_UseCustomNormals) &&
(mesh_eval->flag & ME_AUTOSMOOTH) &&
CustomData_has_layer(&mesh_eval->ldata,
diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.cc
index 6f0d5c2dbe9..b817ff887ce 100644
--- a/source/blender/editors/space_info/info_stats.cc
+++ b/source/blender/editors/space_info/info_stats.cc
@@ -96,6 +96,12 @@ static bool stats_mesheval(const Mesh *me_eval, bool is_selected, SceneStats *st
const SubdivCCG *subdiv_ccg = me_eval->runtime.subdiv_ccg;
BKE_subdiv_ccg_topology_counters(subdiv_ccg, &totvert, &totedge, &totface, &totloop);
}
+ else if (me_eval->runtime.subsurf_resolution != 0) {
+ totvert = me_eval->runtime.subsurf_totvert;
+ totedge = me_eval->runtime.subsurf_totedge;
+ totface = me_eval->runtime.subsurf_totpoly;
+ totloop = me_eval->runtime.subsurf_totloop;
+ }
else {
totvert = me_eval->totvert;
totedge = me_eval->totedge;
@@ -138,7 +144,7 @@ static void stats_object(Object *ob,
switch (ob->type) {
case OB_MESH: {
/* we assume evaluated mesh is already built, this strictly does stats now. */
- const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
+ const Mesh *me_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob);
if (!BLI_gset_add(objects_gset, (void *)me_eval)) {
break;
}
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 0d57afe4225..b98c9dd2886 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -128,10 +128,16 @@ typedef struct Mesh_Runtime {
SessionUUID subsurf_session_uuid;
char subsurf_resolution;
char subsurf_do_loop_normals;
- char _pad3[2];
char subsurf_apply_render;
char subsurf_use_optimal_display;
+ /* Cached from the draw code for stats display. */
+ int subsurf_totvert;
+ int subsurf_totedge;
+ int subsurf_totpoly;
+ int subsurf_totloop;
+ char _pad2[2];
+
/**
* Caches for lazily computed vertex and polygon normals. These are stored here rather than in
* #CustomData because they can be calculated on a const mesh, and adding custom data layers on a