Cleanup: Make paint BVH update tags proper private members

Move some functions to be methods of pbvh::Tree instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/133989
This commit is contained in:
Hans Goudey
2025-02-03 19:36:33 +01:00
committed by Hans Goudey
parent 7d54bfb49c
commit 4e18ebee1b
38 changed files with 128 additions and 130 deletions

View File

@@ -226,9 +226,6 @@ class Tree {
/** Memory backing for #Node::prim_indices. Without an inline buffer to make #Tree movable. */
Array<int, 0> prim_indices_;
public:
std::variant<Vector<MeshNode>, Vector<GridsNode>, Vector<BMeshNode>> nodes_;
/**
* If true, the bounds for the corresponding node index is out of date.
* \note Values are only meaningful for leaf nodes.
@@ -250,6 +247,9 @@ class Tree {
*/
BitVector<> visibility_dirty_;
public:
std::variant<Vector<MeshNode>, Vector<GridsNode>, Vector<BMeshNode>> nodes_;
pixels::PBVHData *pixels_ = nullptr;
std::unique_ptr<DrawCache> draw_data;
@@ -273,7 +273,7 @@ class Tree {
Type type() const
{
return this->type_;
return type_;
}
/**
@@ -302,6 +302,26 @@ class Tree {
*/
void tag_attribute_changed(const IndexMask &node_mask, StringRef attribute_name);
/**
* Run the last step of the BVH bounds recalculation process, propagating updated leaf node
* bounds to their parent/ancestor inner nodes. This is meant to be used after leaf node bounds
* have been computed separately.
*/
void flush_bounds_to_parents();
/**
* Recalculate node bounding boxes based on the current coordinates. Calculation is only done for
* affected nodes that have been tagged by #PBVH::tag_positions_changed().
*/
void update_bounds(const Depsgraph &depsgraph, const Object &object);
void update_bounds_mesh(Span<float3> vert_positions);
void update_bounds_grids(Span<float3> positions, int grid_area);
void update_bounds_bmesh(const BMesh &bm);
void update_normals(Object &object_orig, Object &object_eval);
void update_visibility(const Object &object);
private:
explicit Tree(Type type);
};
@@ -505,15 +525,6 @@ void BKE_pbvh_bmesh_after_stroke(BMesh &bm, blender::bke::pbvh::Tree &pbvh);
namespace blender::bke::pbvh {
/**
* Recalculate node bounding boxes based on the current coordinates. Calculation is only done for
* affected nodes that have been tagged by #PBVH::tag_positions_changed().
*/
void update_bounds(const Depsgraph &depsgraph, const Object &object, Tree &pbvh);
void update_bounds_mesh(Span<float3> vert_positions, Tree &pbvh);
void update_bounds_grids(const CCGKey &key, Span<float3> positions, Tree &pbvh);
void update_bounds_bmesh(const BMesh &bm, Tree &pbvh);
/**
* Copy all current node bounds to the original bounds. "Original" bounds are typically from before
* a brush stroke started (while the "regular" bounds update on every change of positions). These
@@ -527,7 +538,6 @@ void update_mask_mesh(const Mesh &mesh, const IndexMask &node_mask, Tree &pbvh);
void update_mask_grids(const SubdivCCG &subdiv_ccg, const IndexMask &node_mask, Tree &pbvh);
void update_mask_bmesh(const BMesh &bm, const IndexMask &node_mask, Tree &pbvh);
void update_visibility(const Object &object, Tree &pbvh);
void update_normals(const Depsgraph &depsgraph, Object &object_orig, Tree &pbvh);
/** Update geometry normals (potentially on the original object geometry). */
void update_normals_from_eval(Object &object_eval, Tree &pbvh);
@@ -602,13 +612,6 @@ void update_node_bounds_mesh(Span<float3> positions, MeshNode &node);
void update_node_bounds_grids(int grid_area, Span<float3> positions, GridsNode &node);
void update_node_bounds_bmesh(BMeshNode &node);
/**
* Run the last step of the BVH bounds recalculation process, propagating updated leaf node bounds
* to their parent/ancestor inner nodes. This is meant to be used after leaf node bounds have been
* computed separately.
*/
void flush_bounds_to_parents(Tree &pbvh);
inline Span<int> MeshNode::faces() const
{
return this->face_indices_;

View File

@@ -273,7 +273,7 @@ Tree Tree::from_mesh(const Mesh &mesh)
pbvh.tag_positions_changed(nodes.index_range());
update_bounds_mesh(vert_positions, pbvh);
pbvh.update_bounds_mesh(vert_positions);
store_bounds_orig(pbvh);
if (!hide_vert.is_empty()) {
@@ -457,7 +457,7 @@ Tree Tree::from_grids(const Mesh &base_mesh, const SubdivCCG &subdiv_ccg)
pbvh.tag_positions_changed(nodes.index_range());
update_bounds_grids(key, positions, pbvh);
pbvh.update_bounds_grids(positions, key.grid_area);
store_bounds_orig(pbvh);
const BitGroupVector<> &grid_hidden = subdiv_ccg.grid_hidden;
@@ -536,12 +536,10 @@ Tree::~Tree()
void Tree::tag_positions_changed(const IndexMask &node_mask)
{
this->bounds_dirty_.resize(std::max(this->bounds_dirty_.size(), node_mask.min_array_size()),
false);
this->normals_dirty_.resize(std::max(this->normals_dirty_.size(), node_mask.min_array_size()),
false);
node_mask.set_bits(this->bounds_dirty_);
node_mask.set_bits(this->normals_dirty_);
bounds_dirty_.resize(std::max(bounds_dirty_.size(), node_mask.min_array_size()), false);
normals_dirty_.resize(std::max(normals_dirty_.size(), node_mask.min_array_size()), false);
node_mask.set_bits(bounds_dirty_);
node_mask.set_bits(normals_dirty_);
if (this->draw_data) {
this->draw_data->tag_positions_changed(node_mask);
}
@@ -549,9 +547,8 @@ void Tree::tag_positions_changed(const IndexMask &node_mask)
void Tree::tag_visibility_changed(const IndexMask &node_mask)
{
this->visibility_dirty_.resize(std::max(this->bounds_dirty_.size(), node_mask.min_array_size()),
false);
node_mask.set_bits(this->visibility_dirty_);
visibility_dirty_.resize(std::max(visibility_dirty_.size(), node_mask.min_array_size()), false);
node_mask.set_bits(visibility_dirty_);
if (this->draw_data) {
this->draw_data->tag_visibility_changed(node_mask);
}
@@ -1015,20 +1012,20 @@ static void update_normals_mesh(Object &object_orig,
}
}
static void update_normals(Object &object_orig, Object &object_eval, Tree &pbvh)
void Tree::update_normals(Object &object_orig, Object &object_eval)
{
IndexMaskMemory memory;
const IndexMask nodes_to_update = IndexMask::from_bits(pbvh.normals_dirty_, memory);
const IndexMask nodes_to_update = IndexMask::from_bits(normals_dirty_, memory);
switch (pbvh.type()) {
switch (this->type()) {
case Type::Mesh: {
update_normals_mesh(object_orig, object_eval, pbvh.nodes<MeshNode>(), nodes_to_update);
update_normals_mesh(object_orig, object_eval, this->nodes<MeshNode>(), nodes_to_update);
break;
}
case Type::Grids: {
SculptSession &ss = *object_orig.sculpt;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
MutableSpan<GridsNode> nodes = pbvh.nodes<GridsNode>();
MutableSpan<GridsNode> nodes = this->nodes<GridsNode>();
IndexMaskMemory memory;
const IndexMask faces_to_update = nodes_to_face_selection_grids(
subdiv_ccg, nodes, nodes_to_update, memory);
@@ -1036,18 +1033,18 @@ static void update_normals(Object &object_orig, Object &object_eval, Tree &pbvh)
break;
}
case Type::BMesh: {
bmesh_normals_update(pbvh, nodes_to_update);
bmesh_normals_update(*this, nodes_to_update);
break;
}
}
pbvh.normals_dirty_.clear_and_shrink();
normals_dirty_.clear_and_shrink();
}
void update_normals(const Depsgraph &depsgraph, Object &object_orig, Tree &pbvh)
{
BLI_assert(DEG_is_original_object(&object_orig));
Object &object_eval = *DEG_get_evaluated_object(&depsgraph, &object_orig);
update_normals(object_orig, object_eval, pbvh);
pbvh.update_normals(object_orig, object_eval);
}
void update_normals_from_eval(Object &object_eval, Tree &pbvh)
@@ -1057,7 +1054,7 @@ void update_normals_from_eval(Object &object_eval, Tree &pbvh)
* their result), and also because (currently) sculpt deformations skip tagging the mesh normals
* caches dirty. */
Object &object_orig = *DEG_get_original_object(&object_eval);
update_normals(object_orig, object_eval, pbvh);
pbvh.update_normals(object_orig, object_eval);
}
void update_node_bounds_mesh(const Span<float3> positions, MeshNode &node)
@@ -1117,75 +1114,74 @@ static BoundsMergeInfo merge_child_bounds(MutableSpan<NodeT> nodes,
return {node.bounds_, update};
}
void flush_bounds_to_parents(Tree &pbvh)
void Tree::flush_bounds_to_parents()
{
std::visit(
[&](auto &nodes) {
nodes.first().bounds_ =
merge_child_bounds(nodes.as_mutable_span(), pbvh.bounds_dirty_, 0).bounds;
merge_child_bounds(nodes.as_mutable_span(), bounds_dirty_, 0).bounds;
},
pbvh.nodes_);
pbvh.bounds_dirty_.clear_and_shrink();
this->nodes_);
bounds_dirty_.clear_and_shrink();
}
void update_bounds_mesh(const Span<float3> vert_positions, Tree &pbvh)
void Tree::update_bounds_mesh(const Span<float3> vert_positions)
{
IndexMaskMemory memory;
const IndexMask nodes_to_update = IndexMask::from_bits(pbvh.bounds_dirty_, memory);
const IndexMask nodes_to_update = IndexMask::from_bits(bounds_dirty_, memory);
if (nodes_to_update.is_empty()) {
return;
}
MutableSpan<MeshNode> nodes = pbvh.nodes<MeshNode>();
MutableSpan<MeshNode> nodes = this->nodes<MeshNode>();
nodes_to_update.foreach_index(
GrainSize(1), [&](const int i) { update_node_bounds_mesh(vert_positions, nodes[i]); });
flush_bounds_to_parents(pbvh);
this->flush_bounds_to_parents();
}
void update_bounds_grids(const CCGKey &key, const Span<float3> positions, Tree &pbvh)
void Tree::update_bounds_grids(const Span<float3> positions, const int grid_area)
{
IndexMaskMemory memory;
const IndexMask nodes_to_update = IndexMask::from_bits(pbvh.bounds_dirty_, memory);
const IndexMask nodes_to_update = IndexMask::from_bits(bounds_dirty_, memory);
if (nodes_to_update.is_empty()) {
return;
}
MutableSpan<GridsNode> nodes = pbvh.nodes<GridsNode>();
MutableSpan<GridsNode> nodes = this->nodes<GridsNode>();
nodes_to_update.foreach_index(GrainSize(1), [&](const int i) {
update_node_bounds_grids(key.grid_area, positions, nodes[i]);
update_node_bounds_grids(grid_area, positions, nodes[i]);
});
flush_bounds_to_parents(pbvh);
this->flush_bounds_to_parents();
}
void update_bounds_bmesh(const BMesh & /*bm*/, Tree &pbvh)
void Tree::update_bounds_bmesh(const BMesh & /*bm*/)
{
IndexMaskMemory memory;
const IndexMask nodes_to_update = IndexMask::from_bits(pbvh.bounds_dirty_, memory);
const IndexMask nodes_to_update = IndexMask::from_bits(bounds_dirty_, memory);
if (nodes_to_update.is_empty()) {
return;
}
MutableSpan<BMeshNode> nodes = pbvh.nodes<BMeshNode>();
MutableSpan<BMeshNode> nodes = this->nodes<BMeshNode>();
nodes_to_update.foreach_index(GrainSize(1),
[&](const int i) { update_node_bounds_bmesh(nodes[i]); });
flush_bounds_to_parents(pbvh);
this->flush_bounds_to_parents();
}
void update_bounds(const Depsgraph &depsgraph, const Object &object, Tree &pbvh)
void Tree::update_bounds(const Depsgraph &depsgraph, const Object &object)
{
switch (pbvh.type()) {
switch (this->type()) {
case Type::Mesh: {
const Span<float3> positions = bke::pbvh::vert_positions_eval(depsgraph, object);
update_bounds_mesh(positions, pbvh);
this->update_bounds_mesh(positions);
break;
}
case Type::Grids: {
const SculptSession &ss = *object.sculpt;
const SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
update_bounds_grids(key, subdiv_ccg.positions, pbvh);
this->update_bounds_grids(subdiv_ccg.positions, subdiv_ccg.grid_area);
break;
}
case Type::BMesh: {
const SculptSession &ss = *object.sculpt;
update_bounds_bmesh(*ss.bm, pbvh);
this->update_bounds_bmesh(*ss.bm);
break;
}
}
@@ -1362,27 +1358,27 @@ static void update_visibility_bmesh(const MutableSpan<BMeshNode> nodes, const In
[&](const int i) { node_update_visibility_bmesh(nodes[i]); });
}
void update_visibility(const Object &object, Tree &pbvh)
void Tree::update_visibility(const Object &object)
{
IndexMaskMemory memory;
const IndexMask node_mask = IndexMask::from_bits(pbvh.visibility_dirty_, memory);
const IndexMask node_mask = IndexMask::from_bits(visibility_dirty_, memory);
if (node_mask.is_empty()) {
return;
}
pbvh.visibility_dirty_.clear_and_shrink();
switch (pbvh.type()) {
visibility_dirty_.clear_and_shrink();
switch (this->type()) {
case Type::Mesh: {
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
update_visibility_faces(mesh, pbvh.nodes<MeshNode>(), node_mask);
update_visibility_faces(mesh, this->nodes<MeshNode>(), node_mask);
break;
}
case Type::Grids: {
const SculptSession &ss = *object.sculpt;
update_visibility_grids(*ss.subdiv_ccg, pbvh.nodes<GridsNode>(), node_mask);
update_visibility_grids(*ss.subdiv_ccg, this->nodes<GridsNode>(), node_mask);
break;
}
case Type::BMesh: {
update_visibility_bmesh(pbvh.nodes<BMeshNode>(), node_mask);
update_visibility_bmesh(this->nodes<BMeshNode>(), node_mask);
break;
}
}
@@ -2356,7 +2352,7 @@ void BKE_pbvh_vert_coords_apply(blender::bke::pbvh::Tree &pbvh,
{
using namespace blender::bke::pbvh;
pbvh.tag_positions_changed(blender::IndexRange(pbvh.nodes_num()));
update_bounds_mesh(vert_positions, pbvh);
pbvh.update_bounds_mesh(vert_positions);
store_bounds_orig(pbvh);
}

View File

@@ -2262,7 +2262,7 @@ Tree Tree::from_bmesh(BMesh &bm)
nodes, cd_vert_node_offset, cd_face_node_offset, nodeinfo, face_bounds, &rootnode, 0);
pbvh.tag_positions_changed(nodes.index_range());
update_bounds_bmesh(bm, pbvh);
pbvh.update_bounds_bmesh(bm);
store_bounds_orig(pbvh);
threading::parallel_for(nodes.index_range(), 8, [&](const IndexRange range) {

View File

@@ -115,7 +115,7 @@ void do_bmesh_topology_rake_brush(const Depsgraph &depsgraph,
});
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -227,7 +227,7 @@ void do_clay_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -349,7 +349,7 @@ void do_clay_strips_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -257,7 +257,7 @@ void do_clay_thumb_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
float clay_thumb_get_stabilized_pressure(const StrokeCache &cache)

View File

@@ -258,7 +258,7 @@ static void do_crease_or_blob_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace crease_cc

View File

@@ -172,7 +172,7 @@ static void offset_positions(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
void do_draw_brush(const Depsgraph &depsgraph,

View File

@@ -175,7 +175,7 @@ static void offset_positions(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
void do_draw_sharp_brush(const Depsgraph &depsgraph,

View File

@@ -259,7 +259,7 @@ void do_draw_vector_displacement_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -282,7 +282,7 @@ void do_elastic_deform_brush(const Depsgraph &depsgraph,
} break;
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -316,7 +316,7 @@ void do_enhance_details_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -223,7 +223,7 @@ void do_grab_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
void geometry_preview_lines_update(Depsgraph &depsgraph,

View File

@@ -184,7 +184,7 @@ void do_inflate_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -505,7 +505,7 @@ void do_layer_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -726,7 +726,7 @@ void do_multiplane_scrape_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
void multiplane_scrape_preview_draw(const uint gpuattr,

View File

@@ -95,7 +95,7 @@ void do_displacement_eraser_brush(const Depsgraph &depsgraph,
bke::pbvh::update_node_bounds_grids(subdiv_ccg.grid_area, positions, nodes[i]);
});
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -180,7 +180,7 @@ void do_displacement_smear_brush(const Depsgraph &depsgraph,
bke::pbvh::update_node_bounds_grids(subdiv_ccg.grid_area, positions, nodes[i]);
});
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -249,7 +249,7 @@ void do_pinch_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -241,7 +241,7 @@ static void do_plane_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace flatten_cc

View File

@@ -209,7 +209,7 @@ static void do_relax_face_sets_brush_mesh(const Depsgraph &depsgraph,
bke::pbvh::update_node_bounds_mesh(position_data.eval, nodes[i]);
});
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
BLI_NOINLINE static void calc_factors_grids(const Depsgraph &depsgraph,
@@ -337,7 +337,7 @@ static void do_relax_face_sets_brush_grids(const Depsgraph &depsgraph,
bke::pbvh::update_node_bounds_grids(subdiv_ccg.grid_area, positions, nodes[i]);
});
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
static void calc_factors_bmesh(const Depsgraph &depsgraph,
@@ -435,7 +435,7 @@ static void do_relax_face_sets_brush_bmesh(const Depsgraph &depsgraph,
bke::pbvh::update_node_bounds_bmesh(nodes[i]);
});
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
/** \} */
@@ -542,7 +542,7 @@ static void do_topology_relax_brush_mesh(const Depsgraph &depsgraph,
bke::pbvh::update_node_bounds_mesh(position_data.eval, nodes[i]);
});
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
BLI_NOINLINE static void calc_topology_relax_factors_grids(const Depsgraph &depsgraph,
@@ -653,7 +653,7 @@ static void do_topology_relax_brush_grids(const Depsgraph &depsgraph,
bke::pbvh::update_node_bounds_grids(subdiv_ccg.grid_area, positions, nodes[i]);
});
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
static void calc_topology_relax_factors_bmesh(const Depsgraph &depsgraph,
@@ -749,7 +749,7 @@ static void do_topology_relax_brush_bmesh(const Depsgraph &depsgraph,
bke::pbvh::update_node_bounds_bmesh(nodes[i]);
});
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
/** \} */

View File

@@ -215,7 +215,7 @@ void do_rotate_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -280,7 +280,7 @@ void do_smooth_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::update_bounds(depsgraph, object, pbvh);
pbvh.update_bounds(depsgraph, object);
}
} // namespace blender::ed::sculpt_paint

View File

@@ -421,7 +421,7 @@ void do_snake_hook_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -405,7 +405,7 @@ void do_surface_smooth_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::update_bounds(depsgraph, object, pbvh);
pbvh.update_bounds(depsgraph, object);
}
} // namespace blender::ed::sculpt_paint

View File

@@ -180,7 +180,7 @@ void do_thumb_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -331,7 +331,7 @@ void do_topology_slide_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint

View File

@@ -143,7 +143,7 @@ void mesh_show_all(const Depsgraph &depsgraph, Object &object, const IndexMask &
attributes.remove(".hide_vert");
bke::mesh_hide_vert_flush(mesh);
bke::pbvh::update_visibility(object, pbvh);
pbvh.update_visibility(object);
}
void grids_show_all(Depsgraph &depsgraph, Object &object, const IndexMask &node_mask)
@@ -171,7 +171,7 @@ void grids_show_all(Depsgraph &depsgraph, Object &object, const IndexMask &node_
BKE_subdiv_ccg_grid_hidden_free(subdiv_ccg);
BKE_pbvh_sync_visibility_from_verts(object);
bke::pbvh::update_visibility(object, pbvh);
pbvh.update_visibility(object);
multires_mark_as_modified(&depsgraph, &object, MULTIRES_HIDDEN_MODIFIED);
}
@@ -443,7 +443,7 @@ static void partialvis_update_bmesh_nodes(const Depsgraph &depsgraph,
});
pbvh.tag_visibility_changed(node_mask);
bke::pbvh::update_visibility(ob, pbvh);
pbvh.update_visibility(ob);
}
/** \} */
@@ -735,7 +735,7 @@ static void invert_visibility_mesh(const Depsgraph &depsgraph,
hide_poly.finish();
bke::mesh_hide_face_flush(mesh);
pbvh.tag_visibility_changed(node_mask);
bke::pbvh::update_visibility(object, *bke::object::pbvh_get(object));
pbvh.update_visibility(object);
}
static void invert_visibility_grids(Depsgraph &depsgraph,
@@ -1074,7 +1074,7 @@ static void grow_shrink_visibility_grid(Depsgraph &depsgraph,
grid_hidden = std::move(last_buffer);
pbvh.tag_visibility_changed(node_mask);
bke::pbvh::update_visibility(object, pbvh);
pbvh.update_visibility(object);
multires_mark_as_modified(&depsgraph, &object, MULTIRES_HIDDEN_MODIFIED);
BKE_pbvh_sync_visibility_from_verts(object);

View File

@@ -540,7 +540,7 @@ void update_cache_variants(bContext *C, VPaint &vp, Object &ob, PointerRNA *ptr)
cache->radius_squared = cache->radius * cache->radius;
if (bke::pbvh::Tree *pbvh = bke::object::pbvh_get(ob)) {
bke::pbvh::update_bounds(depsgraph, ob, *pbvh);
pbvh->update_bounds(depsgraph, ob);
}
}

View File

@@ -1362,7 +1362,7 @@ static void do_bend_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
/** \} */
@@ -1644,7 +1644,7 @@ static void do_slide_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
/** \} */
@@ -1909,7 +1909,7 @@ static void do_inflate_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
/** \} */
@@ -2180,7 +2180,7 @@ static void do_grab_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
/** \} */
@@ -2459,7 +2459,7 @@ static void do_twist_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
/** \} */
@@ -2821,7 +2821,7 @@ static void do_smooth_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
/* -------------------------------------------------------------------- */

View File

@@ -1530,7 +1530,7 @@ void do_simulation_step(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
static void cloth_brush_apply_brush_forces(const Depsgraph &depsgraph,
@@ -2379,7 +2379,7 @@ static int sculpt_cloth_filter_modal(bContext *C, wmOperator *op, const wmEvent
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
/* Activate all nodes. */
sim_activate_nodes(object, *ss.filter_cache->cloth_sim, node_mask);

View File

@@ -1080,7 +1080,7 @@ static int change_visibility_exec(bContext *C, wmOperator *op)
undo::push_end(object);
bke::pbvh::update_visibility(object, pbvh);
pbvh.update_visibility(object);
islands::invalidate(*object.sculpt);
hide::tag_update_visibility(*C);
@@ -1483,8 +1483,6 @@ static void edit_modify_coordinates(
undo::push_begin(scene, ob, op);
undo::push_nodes(depsgraph, ob, node_mask, undo::Type::Position);
pbvh.tag_positions_changed(node_mask);
switch (mode) {
case EditMode::FairPositions:
edit_fairing(depsgraph, sd, ob, active_face_set, MESH_FAIRING_DEPTH_POSITION, strength);
@@ -1496,7 +1494,8 @@ static void edit_modify_coordinates(
BLI_assert_unreachable();
}
bke::pbvh::update_bounds(depsgraph, ob, pbvh);
pbvh.tag_positions_changed(node_mask);
pbvh.update_bounds(depsgraph, ob);
flush_update_step(C, UpdateType::Position);
flush_update_done(C, ob, UpdateType::Position);
undo::push_end(ob);

View File

@@ -2179,10 +2179,10 @@ static void sculpt_mesh_filter_apply(bContext *C, wmOperator *op, bool is_replay
bke::pbvh::Tree &pbvh = *bke::object::pbvh_get(ob);
pbvh.tag_positions_changed(node_mask);
pbvh.update_bounds(depsgraph, ob);
ss.filter_cache->iteration_count++;
bke::pbvh::update_bounds(depsgraph, ob, pbvh);
flush_update_step(C, UpdateType::Position);
}
@@ -2264,7 +2264,7 @@ static void sculpt_mesh_filter_cancel(bContext *C, wmOperator * /*op*/)
undo::restore_position_from_undo_step(depsgraph, ob);
bke::pbvh::update_normals(depsgraph, ob, *pbvh);
bke::pbvh::update_bounds(depsgraph, ob, *pbvh);
pbvh->update_bounds(depsgraph, ob);
}
static int sculpt_mesh_filter_modal(bContext *C, wmOperator *op, const wmEvent *event)

View File

@@ -2173,7 +2173,7 @@ void do_pose_brush(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
} // namespace blender::ed::sculpt_paint::pose

View File

@@ -200,7 +200,7 @@ static void gesture_apply_for_symmetry_pass(bContext &C, gesture::GestureData &g
break;
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
static void gesture_end(bContext &C, gesture::GestureData &gesture_data)

View File

@@ -334,7 +334,7 @@ static void sculpt_transform_all_vertices(const Depsgraph &depsgraph, const Scul
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
BLI_NOINLINE static void calc_transform_translations(const float4x4 &elastic_transform_mat,
@@ -532,7 +532,7 @@ static void transform_radius_elastic(const Depsgraph &depsgraph,
}
}
pbvh.tag_positions_changed(node_mask);
bke::pbvh::flush_bounds_to_parents(pbvh);
pbvh.flush_bounds_to_parents();
}
void update_modal_transform(bContext *C, Object &ob)

View File

@@ -898,7 +898,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
* We need to manually clear that cache. */
mesh.runtime->corner_normals_cache.tag_dirty();
}
bke::pbvh::update_bounds(*depsgraph, object, pbvh);
pbvh.update_bounds(*depsgraph, object);
bke::pbvh::store_bounds_orig(pbvh);
break;
}
@@ -939,7 +939,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
}
BKE_pbvh_sync_visibility_from_verts(object);
bke::pbvh::update_visibility(object, pbvh);
pbvh.update_visibility(object);
if (BKE_sculpt_multires_active(scene, &object)) {
multires_mark_as_modified(depsgraph, &object, MULTIRES_HIDDEN_MODIFIED);
}
@@ -982,7 +982,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
}
hide::sync_all_from_faces(object);
bke::pbvh::update_visibility(object, pbvh);
pbvh.update_visibility(object);
break;
}
case Type::Mask: {