[Bf-blender-cvs] [6ccf9619153] blender2.8: Fix T59478: Information Bar Missing Data when in Sculpt Mode

Sergey Sharybin noreply at git.blender.org
Tue Dec 18 14:23:58 CET 2018


Commit: 6ccf9619153ea412c7a8c320a3d59d9ec50600c8
Author: Sergey Sharybin
Date:   Tue Dec 18 14:19:55 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB6ccf9619153ea412c7a8c320a3d59d9ec50600c8

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.

===================================================================

M	source/blender/blenkernel/BKE_subdiv_ccg.h
M	source/blender/blenkernel/intern/subdiv_ccg.c
M	source/blender/editors/space_info/info_stats.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.h b/source/blender/blenkernel/BKE_subdiv_ccg.h
index b2aaf6fc4cc..89e0322e37f 100644
--- a/source/blender/blenkernel/BKE_subdiv_ccg.h
+++ b/source/blender/blenkernel/BKE_subdiv_ccg.h
@@ -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__ */
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c
index e488b1129fc..5d8111197c0 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg.c
@@ -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;
+}
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index b027d6c3df0..de406ccdc59 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -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;



More information about the Bf-blender-cvs mailing list