Refactor: Sculpt: Remove SculptSession face visibility pointer
Part of #118145.
This commit is contained in:
@@ -354,12 +354,6 @@ struct SculptSession : blender::NonCopyable, blender::NonMovable {
|
||||
blender::Array<int> vert_to_edge_indices;
|
||||
blender::GroupedSpan<int> 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,
|
||||
|
||||
@@ -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<const Mesh *>(object.data);
|
||||
object.sculpt->hide_poly = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&mesh.face_data, CD_PROP_BOOL, ".hide_poly"));
|
||||
}
|
||||
|
||||
void BKE_sculpt_mask_layers_ensure(Depsgraph *depsgraph,
|
||||
Main *bmain,
|
||||
Object *ob,
|
||||
|
||||
@@ -610,12 +610,14 @@ static void vertex_neighbors_get_faces(const Object &object,
|
||||
const OffsetIndices<int> faces = mesh.faces();
|
||||
const Span<int> corner_verts = mesh.corner_verts();
|
||||
const GroupedSpan<int> vert_to_face_map = mesh.vert_to_face_map();
|
||||
const bke::AttributeAccessor attributes = mesh.attributes();
|
||||
const VArraySpan hide_poly = *attributes.lookup<bool>(".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<const Mesh *>(object.data);
|
||||
const GroupedSpan<int> 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<bool>(),
|
||||
vert_to_face_map,
|
||||
vertex.i))
|
||||
{
|
||||
const bke::AttributeAccessor attributes = mesh.attributes();
|
||||
const VArraySpan hide_poly = *attributes.lookup<bool>(".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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -631,7 +631,6 @@ static void restore_hidden_face(Object &object, Node &unode, MutableSpan<bool> m
|
||||
}
|
||||
}
|
||||
hide_poly.finish();
|
||||
BKE_sculpt_hide_poly_pointer_update(object);
|
||||
}
|
||||
|
||||
static void restore_color(Object &object, StepData &step_data, MutableSpan<bool> modified_vertices)
|
||||
|
||||
Reference in New Issue
Block a user