diff --git a/source/blender/blenkernel/BKE_paint.hh b/source/blender/blenkernel/BKE_paint.hh index 7dea39f65d9..58a8a0a7d22 100644 --- a/source/blender/blenkernel/BKE_paint.hh +++ b/source/blender/blenkernel/BKE_paint.hh @@ -354,12 +354,6 @@ struct SculptSession : blender::NonCopyable, blender::NonMovable { blender::Array vert_to_edge_indices; blender::GroupedSpan vert_to_edge_map; - /** - * A reference to the ".hide_poly" attribute, to store whether (base) faces are hidden. - * May be null. - */ - const bool *hide_poly = nullptr; - /* BMesh for dynamic topology sculpting */ BMesh *bm = nullptr; /* Undo/redo log for dynamic topology sculpting */ @@ -550,11 +544,6 @@ void BKE_sculpt_update_object_after_eval(Depsgraph *depsgraph, Object *ob_eval); * it's the last modifier on the stack and it is not on the first level. */ MultiresModifierData *BKE_sculpt_multires_active(const Scene *scene, Object *ob); -/** - * Update the pointer to the ".hide_poly" attribute. This is necessary because it is dynamically - * created, removed, and made mutable. - */ -void BKE_sculpt_hide_poly_pointer_update(Object &object); /** * Ensures a mask layer exists. If depsgraph and bmain are non-null, diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index 80fa3420e4e..fc3eca43be3 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -1994,9 +1994,6 @@ static void sculpt_update_object(Depsgraph *depsgraph, ss.multires.level = 0; } - ss.hide_poly = (bool *)CustomData_get_layer_named( - &mesh_orig->face_data, CD_PROP_BOOL, ".hide_poly"); - ss.subdiv_ccg = mesh_eval->runtime->subdiv_ccg.get(); pbvh::Tree &pbvh = object::pbvh_ensure(*depsgraph, *ob); @@ -2196,13 +2193,6 @@ void BKE_sculpt_update_object_for_edit(Depsgraph *depsgraph, Object *ob_orig, bo sculpt_update_object(depsgraph, ob_orig, ob_eval, is_paint_tool); } -void BKE_sculpt_hide_poly_pointer_update(Object &object) -{ - const Mesh &mesh = *static_cast(object.data); - object.sculpt->hide_poly = static_cast( - CustomData_get_layer_named(&mesh.face_data, CD_PROP_BOOL, ".hide_poly")); -} - void BKE_sculpt_mask_layers_ensure(Depsgraph *depsgraph, Main *bmain, Object *ob, diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index ef57f67a7df..08441b3d714 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -610,12 +610,14 @@ static void vertex_neighbors_get_faces(const Object &object, const OffsetIndices faces = mesh.faces(); const Span corner_verts = mesh.corner_verts(); const GroupedSpan vert_to_face_map = mesh.vert_to_face_map(); + const bke::AttributeAccessor attributes = mesh.attributes(); + const VArraySpan hide_poly = *attributes.lookup(".hide_poly", bke::AttrDomain::Face); iter->num_duplicates = 0; iter->neighbors.clear(); iter->neighbor_indices.clear(); for (const int face_i : vert_to_face_map[vertex.i]) { - if (ss.hide_poly && ss.hide_poly[face_i]) { + if (!hide_poly.is_empty() && hide_poly[face_i]) { /* Skip connectivity from hidden faces. */ continue; } @@ -731,11 +733,9 @@ bool vert_is_boundary(const Object &object, const PBVHVertRef vertex) case bke::pbvh::Type::Mesh: { const Mesh &mesh = *static_cast(object.data); const GroupedSpan vert_to_face_map = mesh.vert_to_face_map(); - if (!hide::vert_all_faces_visible_get(ss.hide_poly ? Span(ss.hide_poly, ss.faces_num) : - Span(), - vert_to_face_map, - vertex.i)) - { + const bke::AttributeAccessor attributes = mesh.attributes(); + const VArraySpan hide_poly = *attributes.lookup(".hide_poly", bke::AttrDomain::Face); + if (!hide::vert_all_faces_visible_get(hide_poly, vert_to_face_map, vertex.i)) { return true; } return check_boundary_vert_in_base_mesh(ss, vertex.i); diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc index e24cffe4beb..27640caec68 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc @@ -1042,7 +1042,6 @@ static int change_visibility_exec(bContext *C, wmOperator *op) undo::push_end(object); bke::pbvh::update_visibility(object, pbvh); - BKE_sculpt_hide_poly_pointer_update(object); islands::invalidate(*object.sculpt); hide::tag_update_visibility(*C); diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.cc b/source/blender/editors/sculpt_paint/sculpt_undo.cc index 06e80404af3..ac99cdfc202 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.cc +++ b/source/blender/editors/sculpt_paint/sculpt_undo.cc @@ -631,7 +631,6 @@ static void restore_hidden_face(Object &object, Node &unode, MutableSpan m } } hide_poly.finish(); - BKE_sculpt_hide_poly_pointer_update(object); } static void restore_color(Object &object, StepData &step_data, MutableSpan modified_vertices)