diff options
author | Hans Goudey <h.goudey@me.com> | 2021-07-02 07:03:09 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-07-02 07:03:27 +0300 |
commit | 9f5c0ffb5ec293af2e4f003c2178d21e20805b47 (patch) | |
tree | eb5b5c98fae3402da6ad98472ad5f5ea1cfbacd0 /source/blender/editors/space_info | |
parent | 016a2707f573efe113f89ced1870912de19a16a1 (diff) |
Cleanup: Use const variables for object's evaluated mesh
Generally the evaluated mesh should not be changed, since that is the
job of the modifier stack. Current code is far from const correct in
that regard. This commit uses a const variable for the reult of
`BKE_object_get_evaluated_mesh` in some cases. The most common
remaining case is retrieving a BVH tree from the mesh.
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 9e0973f5fde..706d52f43b2 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -96,7 +96,7 @@ typedef struct SceneStatsFmt { char totgpstroke[MAX_INFO_NUM_LEN], totgppoint[MAX_INFO_NUM_LEN]; } SceneStatsFmt; -static bool stats_mesheval(Mesh *me_eval, bool is_selected, SceneStats *stats) +static bool stats_mesheval(const Mesh *me_eval, bool is_selected, SceneStats *stats) { if (me_eval == NULL) { return false; @@ -149,8 +149,8 @@ static void stats_object(Object *ob, switch (ob->type) { case OB_MESH: { /* we assume evaluated mesh is already built, this strictly does stats now. */ - Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); - if (!BLI_gset_add(objects_gset, me_eval)) { + const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); + if (!BLI_gset_add(objects_gset, (void *)me_eval)) { break; } stats_mesheval(me_eval, is_selected, stats); @@ -165,8 +165,8 @@ static void stats_object(Object *ob, case OB_SURF: case OB_CURVE: case OB_FONT: { - Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); - if ((me_eval != NULL) && !BLI_gset_add(objects_gset, me_eval)) { + const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); + if ((me_eval != NULL) && !BLI_gset_add(objects_gset, (void *)me_eval)) { break; } |