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:
authorCampbell Barton <ideasman42@gmail.com>2021-06-16 09:56:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-16 10:17:15 +0300
commit4b36c5b1a729cbf99c51cc8ba5de28d890b40016 (patch)
tree66a3c3aead943133237738e2b129f9b4f48df061
parent3385c04598f210e0fb927845122d1fb5b3a8e81e (diff)
Cleanup: sculpt mode checks when calculating stats
Sculpting dynamic topology used to code-path for counting object then never used the result. Match object mode checks in string access & drawing.
-rw-r--r--source/blender/editors/space_info/info_stats.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 20d901a05bc..b2c39044591 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -344,7 +344,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
}
}
-static void stats_object_pose(Object *ob, SceneStats *stats)
+static void stats_object_pose(const Object *ob, SceneStats *stats)
{
if (ob->pose) {
bArmature *arm = ob->data;
@@ -361,16 +361,13 @@ static void stats_object_pose(Object *ob, SceneStats *stats)
}
}
-static bool stats_is_object_dynamic_topology_sculpt(Object *ob)
+static bool stats_is_object_dynamic_topology_sculpt(const Object *ob)
{
- if (ob == NULL) {
- return false;
- }
- const eObjectMode object_mode = ob->mode;
- return ((object_mode & OB_MODE_SCULPT) && ob->sculpt && ob->sculpt->bm);
+ BLI_assert(ob->mode & OB_MODE_SCULPT);
+ return (ob->sculpt && ob->sculpt->bm);
}
-static void stats_object_sculpt(Object *ob, SceneStats *stats)
+static void stats_object_sculpt(const Object *ob, SceneStats *stats)
{
SculptSession *ss = ob->sculpt;
@@ -399,20 +396,20 @@ static void stats_object_sculpt(Object *ob, SceneStats *stats)
static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer, View3D *v3d_local)
{
SceneStats stats = {0};
- Object *ob = OBACT(view_layer);
- Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
+ const Object *ob = OBACT(view_layer);
+ const Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
if (obedit) {
- /* Edit Mode */
+ /* Edit Mode. */
FOREACH_OBJECT_BEGIN (view_layer, ob_iter) {
if (ob_iter->base_flag & BASE_VISIBLE_VIEWLAYER) {
- if (ob_iter->mode == OB_MODE_EDIT) {
+ if (ob_iter->mode & OB_MODE_EDIT) {
stats_object_edit(ob_iter, &stats);
stats.totobjsel++;
}
else {
/* Skip hidden objects in local view that are not in edit-mode,
- * an exception for edit-mode, in other modes these would be considered hidden. */
+ * an exception for edit-mode, in most other modes these would be considered hidden. */
if ((v3d_local && !BKE_object_is_visible_in_viewport(v3d_local, ob_iter))) {
continue;
}
@@ -423,15 +420,22 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer, View3D *v3
FOREACH_OBJECT_END;
}
else if (ob && (ob->mode & OB_MODE_POSE)) {
- /* Pose Mode */
+ /* Pose Mode. */
stats_object_pose(ob, &stats);
}
- else if (stats_is_object_dynamic_topology_sculpt(ob)) {
- /* Dynamic topology. Do not count all vertices, dynamic topology stats are initialized later as
- * part of sculpt stats. */
+ else if (ob && (ob->mode & OB_MODE_SCULPT)) {
+ /* Sculpt Mode. */
+ if (stats_is_object_dynamic_topology_sculpt(ob)) {
+ /* Dynamic topology. Do not count all vertices,
+ * dynamic topology stats are initialized later as part of sculpt stats. */
+ }
+ else {
+ /* When dynamic topology is not enabled both sculpt stats and scene stats are collected. */
+ stats_object_sculpt(ob, &stats);
+ }
}
else {
- /* Objects */
+ /* Objects. */
GSet *objects_gset = BLI_gset_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__);
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (depsgraph, ob_iter) {
stats_object(ob_iter, v3d_local, &stats, objects_gset);
@@ -440,12 +444,6 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer, View3D *v3
BLI_gset_free(objects_gset, NULL);
}
- if (ob && (ob->mode & OB_MODE_SCULPT)) {
- /* Sculpt Mode. When dynamic topology is not enabled both sculpt stats and scene stats are
- * collected. */
- stats_object_sculpt(ob, &stats);
- }
-
if (v3d_local) {
BLI_assert(v3d_local->localvd != NULL);
if (v3d_local->runtime.local_stats == NULL) {