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:
authorSergey Sharybin <sergey@blender.org>2020-12-01 12:45:02 +0300
committerSergey Sharybin <sergey@blender.org>2020-12-01 12:45:02 +0300
commit01b94c5d8a99c20ab86ee1ea9fd9d0f4aab64dab (patch)
tree9f0f7f9b715790118c83e406c2af6a2693fea5ff /source/blender
parentedf109517648f149724a5fdc1797b3ce694b28c7 (diff)
Cleanup: De-duplicate object mullptr checks
Makes it more clear whether object is allowed or not allowed to be NULL. Also, avoids possible access to the different object mode enumerator. Should be no functional changes.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_info/info_stats.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 71144fa11d0..890bb8a64bc 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -351,9 +351,13 @@ static void stats_object_pose(Object *ob, SceneStats *stats)
}
}
-static bool stats_is_object_dynamic_topology_sculpt(Object *ob, const eObjectMode object_mode)
+static bool stats_is_object_dynamic_topology_sculpt(Object *ob)
{
- return (ob && (object_mode & OB_MODE_SCULPT) && ob->sculpt && ob->sculpt->bm);
+ if (ob == NULL) {
+ return false;
+ }
+ const eObjectMode object_mode = ob->mode;
+ return ((object_mode & OB_MODE_SCULPT) && ob->sculpt && ob->sculpt->bm);
}
static void stats_object_sculpt(Object *ob, SceneStats *stats)
@@ -405,7 +409,7 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer)
/* Pose Mode */
stats_object_pose(ob, &stats);
}
- else if (ob && stats_is_object_dynamic_topology_sculpt(ob, ob->mode)) {
+ 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. */
}
@@ -555,7 +559,7 @@ static void get_stats_string(
stats_fmt->totgpstroke,
stats_fmt->totgppoint);
}
- else if (stats_is_object_dynamic_topology_sculpt(ob, object_mode)) {
+ else if (stats_is_object_dynamic_topology_sculpt(ob)) {
*ofs += BLI_snprintf(info + *ofs,
len - *ofs,
TIP_("Verts:%s | Tris:%s"),
@@ -756,7 +760,7 @@ void ED_info_draw_stats(
stats_row(col1, labels[POINTS], col2, stats_fmt.totgppoint, NULL, y, height);
}
else if (ob && (object_mode & OB_MODE_SCULPT)) {
- if (stats_is_object_dynamic_topology_sculpt(ob, object_mode)) {
+ if (stats_is_object_dynamic_topology_sculpt(ob)) {
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsculpt, NULL, y, height);
stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, NULL, y, height);
}