diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-25 13:37:51 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-25 13:40:10 +0300 |
commit | fae122f12f58a20eb26779bcdf171772b9636204 (patch) | |
tree | 0444b474599a54a17597e1da742d471a546d1889 /source/blender/editors | |
parent | 9fff5c296503ee51e4f5307b5dd146b3fe47846e (diff) |
Sculpt: Cleanup, grant expected usage with asserts
Don't just rely on a comment next top the code, do an assert as well.
Also, don't use `default` since that silences compiler warnings when
new enumerators are added and related code is to be verified.
More switch statements might need an adjustment, but this is something
what is easier to go over by Pablo.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index bf194a8c867..c9e815bbf10 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -106,9 +106,11 @@ float *sculpt_vertex_co_get(SculptSession *ss, int index) return ss->mvert[index].co; case PBVH_BMESH: return BM_vert_at_index(BKE_pbvh_get_bmesh(ss->pbvh), index)->co; - default: - return NULL; + case PBVH_GRIDS: + BLI_assert(!"This fuction is not supposed to be used for PBVH_GRIDS"); + break; } + return NULL; } static void sculpt_vertex_random_access_init(SculptSession *ss) @@ -120,14 +122,17 @@ static void sculpt_vertex_random_access_init(SculptSession *ss) static int sculpt_active_vertex_get(SculptSession *ss) { + BLI_assert(BKE_pbvh_type(ss->pbvh) != PBVH_GRIDS); switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: return ss->active_vertex_index; case PBVH_BMESH: return ss->active_vertex_index; - default: - return 0; + case PBVH_GRIDS: + BLI_assert(!"This fuction is not supposed to be used for PBVH_GRIDS"); + break; } + return 0; } static int sculpt_vertex_count_get(SculptSession *ss) |