From e9c40b7339be915dfe4d6447d1995e54b762d27f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 6 Feb 2018 17:32:00 +1100 Subject: Object Mode: pass as arg to stats_string --- source/blender/editors/space_info/info_stats.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/space_info') diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 3cf833756ef..52e19f03dbd 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -365,14 +365,15 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) } } -static bool stats_is_object_dynamic_topology_sculpt(Object *ob) +static bool stats_is_object_dynamic_topology_sculpt(Object *ob, short object_mode) { - return (ob && (ob->mode & OB_MODE_SCULPT) && + return (ob && + (object_mode & OB_MODE_SCULPT) && ob->sculpt && ob->sculpt->bm); } /* Statistics displayed in info header. Called regularly on scene changes. */ -static void stats_update(Scene *scene, ViewLayer *view_layer) +static void stats_update(Scene *scene, ViewLayer *view_layer, const short object_mode) { SceneStats stats = {0}; Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL; @@ -382,11 +383,11 @@ static void stats_update(Scene *scene, ViewLayer *view_layer) /* Edit Mode */ stats_object_edit(scene->obedit, &stats); } - else if (ob && (ob->mode & OB_MODE_POSE)) { + else if (ob && (object_mode & OB_MODE_POSE)) { /* Pose Mode */ stats_object_pose(ob, &stats); } - else if (stats_is_object_dynamic_topology_sculpt(ob)) { + else if (stats_is_object_dynamic_topology_sculpt(ob, object_mode)) { /* Dynamic-topology sculpt mode */ stats_object_sculpt_dynamic_topology(ob, &stats); } @@ -405,7 +406,7 @@ static void stats_update(Scene *scene, ViewLayer *view_layer) *(view_layer->stats) = stats; } -static void stats_string(Scene *scene, ViewLayer *view_layer) +static void stats_string(Scene *scene, ViewLayer *view_layer, const short object_mode) { #define MAX_INFO_MEM_LEN 64 SceneStats *stats = view_layer->stats; @@ -493,11 +494,11 @@ static void stats_string(Scene *scene, ViewLayer *view_layer) ofs += BLI_strncpy_rlen(s + ofs, memstr, MAX_INFO_LEN - ofs); ofs += BLI_strncpy_rlen(s + ofs, gpumemstr, MAX_INFO_LEN - ofs); } - else if (ob && (ob->mode & OB_MODE_POSE)) { + else if (ob && (object_mode & OB_MODE_POSE)) { ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, IFACE_("Bones:%s/%s %s%s"), stats_fmt.totbonesel, stats_fmt.totbone, memstr, gpumemstr); } - else if (stats_is_object_dynamic_topology_sculpt(ob)) { + else if (stats_is_object_dynamic_topology_sculpt(ob, object_mode)) { ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, IFACE_("Verts:%s | Tris:%s%s"), stats_fmt.totvert, stats_fmt.tottri, gpumemstr); } @@ -527,10 +528,11 @@ void ED_info_stats_clear(ViewLayer *view_layer) const char *ED_info_stats_string(Scene *scene, ViewLayer *view_layer) { + Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL; if (!view_layer->stats) { - stats_update(scene, view_layer); + stats_update(scene, view_layer, ob->mode); } - stats_string(scene, view_layer); + stats_string(scene, view_layer, ob->mode); return view_layer->stats->infostr; } -- cgit v1.2.3