Refactor: Sculpt: Add helper function to access all BVH nodes

Previously we often passed an empty `FunctionRef` to the generic
`search_gather` function. The plan is to refactor `search_gather`
to return an `IndexMask` along with storing leaf nodes in a separate
array. Splitting access to all leaf nodes to a separate function simplifies
this process and makes code more expressive too.

Part of #118145.

Pull Request: https://projects.blender.org/blender/blender/pulls/126667
This commit is contained in:
Hans Goudey
2024-08-22 23:37:10 +02:00
committed by Hans Goudey
parent 0ff0e41c62
commit d5e591b3dc
18 changed files with 65 additions and 52 deletions

View File

@@ -539,6 +539,10 @@ void BKE_pbvh_ensure_node_face_corners(blender::bke::pbvh::Tree &pbvh,
int BKE_pbvh_debug_draw_gen_get(blender::bke::pbvh::Node &node);
namespace blender::bke::pbvh {
/** Return pointers to all the leaf nodes in the BVH tree. */
Vector<Node *> all_leaf_nodes(Tree &pbvh);
Vector<Node *> search_gather(Tree &pbvh,
FunctionRef<bool(Node &)> scb,
PBVHNodeFlags leaf_flag = PBVH_Leaf);

View File

@@ -2117,9 +2117,7 @@ void BKE_sculpt_update_object_before_eval(Object *ob_eval)
BKE_sculptsession_free_vwpaint_data(ob_eval->sculpt);
}
else if (ss->pbvh) {
Vector<blender::bke::pbvh::Node *> nodes = blender::bke::pbvh::search_gather(*ss->pbvh, {});
for (blender::bke::pbvh::Node *node : nodes) {
for (blender::bke::pbvh::Node *node : blender::bke::pbvh::all_leaf_nodes(*ss->pbvh)) {
BKE_pbvh_node_mark_update(*node);
}
}

View File

@@ -2973,6 +2973,19 @@ void BKE_pbvh_sync_visibility_from_verts(Object &object)
}
namespace blender::bke::pbvh {
Vector<Node *> all_leaf_nodes(Tree &pbvh)
{
Vector<Node *> leaf_nodes;
leaf_nodes.reserve(pbvh.nodes_.size());
for (Node &node : pbvh.nodes_) {
if (node.flag_ & PBVH_Leaf) {
leaf_nodes.append(&node);
}
}
return leaf_nodes;
}
Vector<Node *> search_gather(Tree &pbvh,
const FunctionRef<bool(Node &)> scb,
PBVHNodeFlags leaf_flag)

View File

@@ -521,7 +521,7 @@ static int hide_show_all_exec(bContext *C, wmOperator *op)
break;
}
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*pbvh);
switch (pbvh->type()) {
case bke::pbvh::Type::Mesh:
@@ -639,7 +639,7 @@ static int hide_show_masked_exec(bContext *C, wmOperator *op)
break;
}
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*pbvh);
switch (pbvh->type()) {
case bke::pbvh::Type::Mesh:
@@ -792,7 +792,7 @@ static int visibility_invert_exec(bContext *C, wmOperator *op)
bke::pbvh::Tree *pbvh = BKE_sculpt_object_pbvh_ensure(&depsgraph, &object);
BLI_assert(BKE_object_sculpt_pbvh_get(&object) == pbvh);
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*pbvh);
undo::push_begin(object, op);
switch (pbvh->type()) {
case bke::pbvh::Type::Mesh:
@@ -1128,7 +1128,7 @@ static int visibility_filter_exec(bContext *C, wmOperator *op)
const VisAction mode = VisAction(RNA_enum_get(op->ptr, "action"));
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
int num_verts = SCULPT_vertex_count_get(object);

View File

@@ -572,7 +572,7 @@ static void fill_mask(
Main &bmain, const Scene &scene, Depsgraph &depsgraph, Object &object, const float value)
{
bke::pbvh::Tree &pbvh = *object.sculpt->pbvh;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
switch (pbvh.type()) {
case bke::pbvh::Type::Mesh:
fill_mask_mesh(depsgraph, object, value, nodes);

View File

@@ -2303,7 +2303,7 @@ static int vertex_color_set_exec(bContext *C, wmOperator *op)
BKE_sculpt_update_object_for_edit(CTX_data_ensure_evaluated_depsgraph(C), &obact, true);
undo::push_begin(obact, op);
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*obact.sculpt->pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*obact.sculpt->pbvh);
const Mesh &mesh = *static_cast<const Mesh *>(obact.data);
/* The sculpt undo system needs bke::pbvh::Tree node corner indices for corner domain

View File

@@ -322,7 +322,7 @@ static void transform_active_color(bContext *C,
* attributes. */
BKE_pbvh_ensure_node_face_corners(pbvh, mesh.corner_tris());
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
undo::push_nodes(depsgraph, obact, nodes, undo::Type::Color);
transform_active_color_data(*BKE_mesh_from_object(&obact), transform_fn);

View File

@@ -1214,7 +1214,7 @@ namespace undo {
static void restore_mask_from_undo_step(Object &object)
{
SculptSession &ss = *object.sculpt;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
switch (ss.pbvh->type()) {
case bke::pbvh::Type::Mesh: {
@@ -1279,7 +1279,7 @@ static void restore_mask_from_undo_step(Object &object)
static void restore_color_from_undo_step(Object &object)
{
SculptSession &ss = *object.sculpt;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
BLI_assert(ss.pbvh->type() == bke::pbvh::Type::Mesh);
Mesh &mesh = *static_cast<Mesh *>(object.data);
@@ -1309,7 +1309,7 @@ static void restore_color_from_undo_step(Object &object)
static void restore_face_set_from_undo_step(Object &object)
{
SculptSession &ss = *object.sculpt;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
switch (ss.pbvh->type()) {
case bke::pbvh::Type::Mesh:
@@ -1336,7 +1336,7 @@ static void restore_face_set_from_undo_step(Object &object)
void restore_position_from_undo_step(const Depsgraph &depsgraph, Object &object)
{
SculptSession &ss = *object.sculpt;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
switch (ss.pbvh->type()) {
case bke::pbvh::Type::Mesh: {
@@ -3404,7 +3404,7 @@ static void do_brush_action(const Depsgraph &depsgraph,
if (SCULPT_tool_needs_all_pbvh_nodes(brush)) {
/* These brushes need to update all nodes as they are not constrained by the brush radius */
nodes = bke::pbvh::search_gather(*ss.pbvh, {});
nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
}
else if (brush.sculpt_tool == SCULPT_TOOL_CLOTH) {
nodes = cloth::brush_affected_nodes_gather(ss, brush);
@@ -6282,7 +6282,7 @@ static SculptTopologyIslandCache calc_topology_islands_bmesh(const Object &objec
BM_mesh_elem_index_ensure(&bm, BM_VERT);
bke::pbvh::Tree &pbvh = *object.sculpt->pbvh;
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
AtomicDisjointSet disjoint_set(bm.totvert);
threading::parallel_for(nodes.index_range(), 1024, [&](const IndexRange range) {
for (bke::pbvh::Node *node : nodes.as_span().slice(range)) {

View File

@@ -188,7 +188,7 @@ Vector<bke::pbvh::Node *> brush_affected_nodes_gather(SculptSession &ss, const B
});
}
case BRUSH_CLOTH_SIMULATION_AREA_GLOBAL:
return bke::pbvh::search_gather(*ss.pbvh, {});
return bke::pbvh::all_leaf_nodes(*ss.pbvh);
case BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC: {
const float radius_squared = math::square(ss.cache->radius * (1.0 + brush.cloth_sim_limit));
return bke::pbvh::search_gather(*ss.pbvh, [&](bke::pbvh::Node &node) {
@@ -1213,8 +1213,8 @@ static void calc_constraint_factors(const Depsgraph &depsgraph,
{
const SculptSession &ss = *object.sculpt;
const bke::pbvh::Tree &pbvh = *ss.pbvh;
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(
const_cast<bke::pbvh::Tree &>(pbvh), {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(
const_cast<bke::pbvh::Tree &>(pbvh));
const auto_mask::Cache *automasking = auto_mask::active_cache_get(ss);
@@ -1607,7 +1607,7 @@ static void cloth_brush_apply_brush_foces(const Depsgraph &depsgraph,
* them. */
static void cloth_sim_initialize_default_node_state(SculptSession &ss, SimulationData &cloth_sim)
{
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
cloth_sim.node_state = Array<NodeSimState>(nodes.size());
for (const int i : nodes.index_range()) {
@@ -1628,7 +1628,7 @@ static void copy_positions_to_array(const Depsgraph &depsgraph,
break;
case bke::pbvh::Type::Grids: {
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
Vector<bke::pbvh::Node *> all_nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> all_nodes = bke::pbvh::all_leaf_nodes(pbvh);
threading::parallel_for(all_nodes.index_range(), 8, [&](const IndexRange range) {
Vector<float3> node_positions;
for (const int i : range) {
@@ -1658,7 +1658,7 @@ static void copy_normals_to_array(const Depsgraph &depsgraph,
case bke::pbvh::Type::Grids: {
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
Vector<bke::pbvh::Node *> all_nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> all_nodes = bke::pbvh::all_leaf_nodes(pbvh);
threading::parallel_for(all_nodes.index_range(), 8, [&](const IndexRange range) {
Vector<float3> node_normals;
for (const int i : range) {

View File

@@ -108,7 +108,7 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
if (nodes.is_empty()) {
return OPERATOR_CANCELLED;

View File

@@ -1427,8 +1427,7 @@ static void restore_face_set_data(Object &object, Cache &expand_cache)
face_sets.span.copy_from(expand_cache.original_face_sets);
face_sets.finish();
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*object.sculpt->pbvh, {});
for (bke::pbvh::Node *node : nodes) {
for (bke::pbvh::Node *node : bke::pbvh::all_leaf_nodes(*object.sculpt->pbvh)) {
BKE_pbvh_node_mark_update_face_sets(*node);
}
}
@@ -1437,7 +1436,7 @@ static void restore_color_data(Object &ob, Cache &expand_cache)
{
SculptSession &ss = *ob.sculpt;
Mesh &mesh = *static_cast<Mesh *>(ob.data);
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
const OffsetIndices<int> faces = mesh.faces();
const Span<int> corner_verts = mesh.corner_verts();
@@ -1498,7 +1497,7 @@ static void write_mask_data(Object &object, const Span<float> mask)
}
}
for (bke::pbvh::Node *node : bke::pbvh::search_gather(*ss.pbvh, {})) {
for (bke::pbvh::Node *node : bke::pbvh::all_leaf_nodes(*ss.pbvh)) {
BKE_pbvh_node_mark_update_mask(*node);
}
}
@@ -2018,7 +2017,7 @@ static void finish(bContext *C)
undo::push_end(ob);
/* Tag all nodes to redraw to avoid artifacts after the fast partial updates. */
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
for (bke::pbvh::Node *node : nodes) {
BKE_pbvh_node_mark_update_mask(*node);
}
@@ -2485,7 +2484,7 @@ static void cache_initial_config_set(bContext *C, wmOperator *op, Cache &expand_
static void undo_push(const Depsgraph &depsgraph, Object &ob, Cache &expand_cache)
{
SculptSession &ss = *ob.sculpt;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
switch (expand_cache.target) {
case TargetType::Mask:
@@ -2619,7 +2618,7 @@ static int sculpt_expand_invoke(bContext *C, wmOperator *op, const wmEvent *even
set_initial_components_for_mouse(C, ob, *ss.expand_cache, mouse);
/* Cache bke::pbvh::Tree nodes. */
ss.expand_cache->nodes = bke::pbvh::search_gather(*ss.pbvh, {});
ss.expand_cache->nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
/* Store initial state. */
original_state_store(ob, *ss.expand_cache);

View File

@@ -394,7 +394,7 @@ static int create_op_exec(bContext *C, wmOperator *op)
const int next_face_set = find_next_available_id(object);
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
switch (mode) {
case CreateMode::Masked: {
const OffsetIndices faces = mesh.faces();
@@ -644,7 +644,7 @@ static int init_op_exec(bContext *C, wmOperator *op)
}
bke::pbvh::Tree &pbvh = *ob.sculpt->pbvh;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
if (nodes.is_empty()) {
return OPERATOR_CANCELLED;
@@ -906,7 +906,7 @@ static int change_visibility_exec(bContext *C, wmOperator *op)
undo::push_begin(object, op);
bke::pbvh::Tree &pbvh = *object.sculpt->pbvh;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
const bke::AttributeAccessor attributes = mesh->attributes();
const VArraySpan<bool> hide_poly = *attributes.lookup<bool>(".hide_poly", bke::AttrDomain::Face);
@@ -1072,7 +1072,7 @@ static int randomize_colors_exec(bContext *C, wmOperator * /*op*/)
mesh->face_sets_color_seed += 1;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
for (bke::pbvh::Node *node : nodes) {
BKE_pbvh_node_mark_redraw(*node);
}
@@ -1123,7 +1123,7 @@ static void edit_grow_shrink(const Depsgraph &depsgraph,
undo::push_begin(object, op);
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
face_sets_update(
depsgraph, object, nodes, [&](const Span<int> indices, MutableSpan<int> face_sets) {
for (const int i : indices.index_range()) {
@@ -1379,7 +1379,7 @@ static void edit_modify_coordinates(
const Sculpt &sd = *CTX_data_tool_settings(C)->sculpt;
SculptSession &ss = *ob.sculpt;
bke::pbvh::Tree &pbvh = *ss.pbvh;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
const float strength = RNA_float_get(op->ptr, "strength");

View File

@@ -659,7 +659,7 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op)
SculptSession &ss = *ob.sculpt;
bke::pbvh::Tree &pbvh = *ob.sculpt->pbvh;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
undo::push_begin(ob, op);
int iterations = RNA_int_get(op->ptr, "iterations");

View File

@@ -118,7 +118,7 @@ static int sculpt_mask_init_exec(bContext *C, wmOperator *op)
BKE_sculpt_update_object_for_edit(&depsgraph, &ob, false);
bke::pbvh::Tree &pbvh = *ob.sculpt->pbvh;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
if (nodes.is_empty()) {
return OPERATOR_CANCELLED;
}

View File

@@ -782,7 +782,7 @@ static void sculpt_mask_by_color_contiguous_mesh(const Depsgraph &depsgraph,
return len <= threshold;
});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
update_mask_mesh(
depsgraph, object, nodes, [&](MutableSpan<float> node_mask, const Span<int> verts) {
@@ -807,7 +807,7 @@ static void sculpt_mask_by_color_full_mesh(const Depsgraph &depsgraph,
mesh.active_color_attribute, bke::AttrDomain::Point, {});
const float4 active_color = float4(colors[vert]);
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
update_mask_mesh(
depsgraph, object, nodes, [&](MutableSpan<float> node_mask, const Span<int> verts) {
@@ -1084,7 +1084,7 @@ static int sculpt_bake_cavity_exec(bContext *C, wmOperator *op)
CavityBakeMixMode mode = CavityBakeMixMode(RNA_enum_get(op->ptr, "mix_mode"));
float factor = RNA_float_get(op->ptr, "mix_factor");
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
/* Set up automasking settings. */
Sculpt sd2 = sd;

View File

@@ -488,7 +488,7 @@ static void grow_pose_factor(const Depsgraph &depsgraph,
bke::pbvh::Tree &pbvh = *ob.sculpt->pbvh;
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(pbvh);
const Span<int> fake_neighbors = ss.fake_neighbors.fake_neighbor_index;
bool grow_next_iteration = true;

View File

@@ -737,7 +737,7 @@ void blur_geometry_data_array(const Object &object,
Vector<float> new_factors;
};
const SculptSession &ss = *object.sculpt;
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
threading::EnumerableThreadSpecific<LocalData> all_tls;
switch (ss.pbvh->type()) {

View File

@@ -604,8 +604,7 @@ static void bmesh_restore_generic(StepData &step_data, Object &object, SculptSes
}
if (step_data.type == Type::Mask) {
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
for (bke::pbvh::Node *node : nodes) {
for (bke::pbvh::Node *node : bke::pbvh::all_leaf_nodes(*ss.pbvh)) {
BKE_pbvh_node_mark_redraw(*node);
}
}
@@ -856,7 +855,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::Position: {
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -903,7 +902,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::HideVert: {
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -942,7 +941,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::HideFace: {
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -984,7 +983,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::Mask: {
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -1018,7 +1017,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::FaceSet: {
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -1056,7 +1055,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::Color: {
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -2030,7 +2029,7 @@ static void push_all_grids(const Depsgraph &depsgraph, Object *object)
return;
}
Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
Vector<bke::pbvh::Node *> nodes = bke::pbvh::all_leaf_nodes(*ss.pbvh);
push_nodes(depsgraph, *object, nodes, Type::Position);
}