Cleanup: Remove sculpt session mask pointer

This was only used in one place. Adding the name lookup to
`SCULPT_vertex_mask_get` is not good long term, but the use
of that function can be removed too.
This commit is contained in:
Hans Goudey
2023-11-20 12:18:59 -05:00
parent e2fbcb4632
commit 9781600d68
4 changed files with 7 additions and 7 deletions

View File

@@ -585,8 +585,6 @@ struct SculptSession {
eAttrDomain vcol_domain;
eCustomDataType vcol_type;
const float *vmask;
/* Mesh connectivity maps. */
/* Vertices to adjacent polys. */
blender::GroupedSpan<int> pmap;

View File

@@ -1708,8 +1708,6 @@ static void sculpt_update_object(
ss->multires.active = false;
ss->multires.modifier = nullptr;
ss->multires.level = 0;
ss->vmask = static_cast<const float *>(
CustomData_get_layer_named(&me->vert_data, CD_PROP_FLOAT, ".sculpt_mask"));
CustomDataLayer *layer;
eAttrDomain domain;

View File

@@ -295,8 +295,12 @@ void SCULPT_vertex_persistent_normal_get(SculptSession *ss, PBVHVertRef vertex,
float SCULPT_vertex_mask_get(SculptSession *ss, PBVHVertRef vertex)
{
switch (BKE_pbvh_type(ss->pbvh)) {
case PBVH_FACES:
return ss->vmask ? ss->vmask[vertex.i] : 0.0f;
case PBVH_FACES: {
const Mesh *mesh = BKE_pbvh_get_mesh(ss->pbvh);
const float *mask = static_cast<const float *>(
CustomData_get_layer_named(&mesh->vert_data, CD_PROP_FLOAT, ".sculpt_mask"));
return mask ? mask[vertex.i] : 0.0f;
}
case PBVH_BMESH: {
BMVert *v;
int cd_mask = CustomData_get_offset_named(&ss->bm->vdata, CD_PROP_FLOAT, ".sculpt_mask");

View File

@@ -557,6 +557,7 @@ static bool sculpt_undo_restore_color(bContext *C, SculptUndoNode *unode, bool *
static bool sculpt_undo_restore_mask(bContext *C, SculptUndoNode *unode, bool *modified_vertices)
{
using namespace blender;
const Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
BKE_view_layer_synced_ensure(scene, view_layer);
@@ -573,7 +574,6 @@ static bool sculpt_undo_restore_mask(bContext *C, SculptUndoNode *unode, bool *m
vmask = static_cast<float *>(CustomData_add_layer_named(
&mesh->vert_data, CD_PROP_FLOAT, CD_SET_DEFAULT, mesh->totvert, ".sculpt_mask"));
}
ss->vmask = vmask;
const Span<int> index = unode->index;