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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user