diff options
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 1f64a2445aa..688573d78a6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -250,15 +250,16 @@ void SCULPT_vertex_persistent_normal_get(SculptSession *ss, PBVHVertRef vertex, float SCULPT_vertex_mask_get(SculptSession *ss, PBVHVertRef vertex) { - BMVert *v; - float *mask; switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: return ss->vmask ? ss->vmask[vertex.i] : 0.0f; - case PBVH_BMESH: + case PBVH_BMESH: { + BMVert *v; + int cd_mask = CustomData_get_offset(&ss->bm->vdata, CD_PAINT_MASK); + v = (BMVert *)vertex.i; - mask = BM_ELEM_CD_GET_VOID_P(v, CustomData_get_offset(&ss->bm->vdata, CD_PAINT_MASK)); - return mask ? *mask : 0.0f; + return cd_mask != -1 ? BM_ELEM_CD_GET_FLOAT(v, cd_mask) : 0.0f; + } case PBVH_GRIDS: { const CCGKey *key = BKE_pbvh_get_grid_key(ss->pbvh); const int grid_index = vertex.i / key->grid_area; |