Cleanup: Sculpt: Add geometry index accessor functions to node structs #127201

Merged
Hans Goudey merged 1 commits from HooglyBoogly/blender:pbvh-accessor-functions into main 2024-09-05 20:07:21 +02:00
54 changed files with 295 additions and 308 deletions

View File

@ -140,11 +140,24 @@ struct MeshNode : public Node {
LocalVertMap vert_indices_;
/** The number of vertices in #vert_indices not shared with (owned by) another node. */
int unique_verts_num_ = 0;
/** Return the faces contained by the node. */
Span<int> faces() const;
/** Return the "unique" vertices owned by the node, excluding vertices owned by other nodes. */
Span<int> verts() const;
Sean-Kim marked this conversation as resolved
Review

I personally think unique_verts and all_verts is better than implying one or the other (e.g. unique_verts and verts or verts and all_verts), but I don't feel too strongly about this at the moment.

I personally think `unique_verts` and `all_verts` is better than implying one or the other (e.g. `unique_verts` and `verts` or `verts` and `all_verts`), but I don't feel too strongly about this at the moment.
Review

Since the vast majority of cases just use verts, and you should really know what you're doing if you use all_verts(), I thought giving that the "weirder" name that stood out was better. The BMesh node naming is similar with "verts" and "other verts". I think it's probably clearer to think of the "non-unique" vertices as separate conceptually, like "boundary vertices".

Since the vast majority of cases just use `verts`, and you should really know what you're doing if you use `all_verts()`, I thought giving that the "weirder" name that stood out was better. The BMesh node naming is similar with "verts" and "other verts". I think it's probably clearer to think of the "non-unique" vertices as separate conceptually, like "boundary vertices".
Review

Yeah, I think that's a good argument, that all_verts is a rarer usecase and should stick out more

Yeah, I think that's a good argument, that `all_verts` is a rarer usecase and should stick out more
/**
* Return all vertices used by faces in this node. The same as #verts(), with the shared
* vertices added at the end of the array.
*/
Span<int> all_verts() const;
};
struct GridsNode : public Node {
/** Multires grid indices for this node. Refers to a subset of Tree::prim_indices_. */
Span<int> prim_indices_;
/** Return grid indices contained by the node. */
Span<int> grids() const;
};
struct BMeshNode : public Node {
@ -384,12 +397,6 @@ namespace blender::bke::pbvh {
void remove_node_draw_tags(bke::pbvh::Tree &pbvh, const IndexMask &node_mask);
Span<int> node_grid_indices(const GridsNode &node);
Span<int> node_faces(const MeshNode &node);
Span<int> node_verts(const MeshNode &node);
Span<int> node_unique_verts(const MeshNode &node);
/**
* Gather the indices of all base mesh faces in the node.
* For convenience, pass a reference to the data in the result.
@ -535,4 +542,22 @@ void update_node_bounds_mesh(Span<float3> positions, MeshNode &node);
void update_node_bounds_grids(const CCGKey &key, Span<CCGElem *> grids, GridsNode &node);
void update_node_bounds_bmesh(BMeshNode &node);
inline Span<int> MeshNode::faces() const
{
return this->face_indices_;
}
inline Span<int> MeshNode::verts() const
{
return this->vert_indices_.as_span().slice(0, this->unique_verts_num_);
}
inline Span<int> MeshNode::all_verts() const
{
return this->vert_indices_;
}
inline Span<int> GridsNode::grids() const
{
return this->prim_indices_;
}
} // namespace blender::bke::pbvh

View File

@ -436,7 +436,7 @@ std::unique_ptr<Tree> build_mesh(const Mesh &mesh)
if (!hide_vert.is_empty()) {
threading::parallel_for(nodes.index_range(), 8, [&](const IndexRange range) {
for (const int i : range) {
const Span<int> verts = node_verts(nodes[i]);
const Span<int> verts = nodes[i].all_verts();
if (std::all_of(verts.begin(), verts.end(), [&](const int i) { return hide_vert[i]; })) {
nodes[i].flag_ |= PBVH_FullyHidden;
}
@ -620,7 +620,7 @@ std::unique_ptr<Tree> build_grids(const Mesh &base_mesh, const SubdivCCG &subdiv
if (!grid_hidden.is_empty()) {
threading::parallel_for(nodes.index_range(), 8, [&](const IndexRange range) {
for (const int i : range) {
const Span<int> grids = node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
if (std::all_of(grids.begin(), grids.end(), [&](const int i) {
return !bits::any_bit_unset(grid_hidden[i]);
}))
@ -1022,7 +1022,7 @@ static void calc_node_face_normals(const Span<float3> positions,
MutableSpan<float3> face_normals)
{
nodes_to_update.foreach_index(GrainSize(1), [&](const int i) {
normals_calc_faces(positions, faces, corner_verts, node_faces(nodes[i]), face_normals);
normals_calc_faces(positions, faces, corner_verts, nodes[i].faces(), face_normals);
});
}
@ -1057,8 +1057,7 @@ static void calc_node_vert_normals(const GroupedSpan<int> vert_to_face_map,
MutableSpan<float3> vert_normals)
{
nodes_to_update.foreach_index(GrainSize(1), [&](const int i) {
normals_calc_verts_simple(
vert_to_face_map, face_normals, node_unique_verts(nodes[i]), vert_normals);
normals_calc_verts_simple(vert_to_face_map, face_normals, nodes[i].verts(), vert_normals);
});
}
@ -1190,7 +1189,7 @@ void update_normals_from_eval(Object &object_eval, Tree &pbvh)
void update_node_bounds_mesh(const Span<float3> positions, MeshNode &node)
{
Bounds<float3> bounds = negative_bounds();
for (const int vert : node_verts(node)) {
for (const int vert : node.all_verts()) {
math::min_max(positions[vert], bounds.min, bounds.max);
}
node.bounds_ = bounds;
@ -1199,7 +1198,7 @@ void update_node_bounds_mesh(const Span<float3> positions, MeshNode &node)
void update_node_bounds_grids(const CCGKey &key, const Span<CCGElem *> grids, GridsNode &node)
{
Bounds<float3> bounds = negative_bounds();
for (const int grid : node_grid_indices(node)) {
for (const int grid : node.grids()) {
for (const int i : IndexRange(key.grid_area)) {
math::min_max(CCG_elem_offset_co(key, grids[grid], i), bounds.min, bounds.max);
}
@ -1334,7 +1333,7 @@ void store_bounds_orig(Tree &pbvh)
void node_update_mask_mesh(const Span<float> mask, MeshNode &node)
{
const Span<int> verts = node_verts(node);
const Span<int> verts = node.all_verts();
const bool fully_masked = std::all_of(
verts.begin(), verts.end(), [&](const int vert) { return mask[vert] == 1.0f; });
const bool fully_unmasked = std::all_of(
@ -1368,7 +1367,7 @@ void node_update_mask_grids(const CCGKey &key, const Span<CCGElem *> grids, Grid
BLI_assert(key.has_mask);
bool fully_masked = true;
bool fully_unmasked = true;
for (const int grid : node_grid_indices(node)) {
for (const int grid : node.grids()) {
CCGElem *elem = grids[grid];
for (const int i : IndexRange(key.grid_area)) {
const float mask = CCG_elem_offset_mask(key, elem, i);
@ -1465,7 +1464,7 @@ void update_mask(const Object &object, Tree &pbvh)
void node_update_visibility_mesh(const Span<bool> hide_vert, MeshNode &node)
{
BLI_assert(!hide_vert.is_empty());
const Span<int> verts = node_verts(node);
const Span<int> verts = node.all_verts();
const bool fully_hidden = std::all_of(
verts.begin(), verts.end(), [&](const int vert) { return hide_vert[vert]; });
SET_FLAG_FROM_TEST(node.flag_, fully_hidden, PBVH_FullyHidden);
@ -1633,7 +1632,7 @@ IndexMask nodes_to_face_selection_grids(const SubdivCCG &subdiv_ccg,
* overhead regardless of selection size, but that is small. */
Array<bool> faces_to_update(subdiv_ccg.faces.size(), false);
nodes_mask.foreach_index(GrainSize(1), [&](const int i) {
for (const int grid : node_grid_indices(nodes[i])) {
for (const int grid : nodes[i].grids()) {
faces_to_update[grid_to_face_map[grid]] = true;
}
});
@ -1807,16 +1806,6 @@ void remove_node_draw_tags(bke::pbvh::Tree &pbvh, const IndexMask &node_mask)
}
}
Span<int> node_verts(const MeshNode &node)
{
return node.vert_indices_;
}
Span<int> node_unique_verts(const MeshNode &node)
{
return node.vert_indices_.as_span().take_front(node.unique_verts_num_);
}
Span<int> node_face_indices_calc_grids(const SubdivCCG &subdiv_ccg,
const GridsNode &node,
Vector<int> &faces)
@ -1824,7 +1813,7 @@ Span<int> node_face_indices_calc_grids(const SubdivCCG &subdiv_ccg,
faces.clear();
const Span<int> grid_to_face_map = subdiv_ccg.grid_to_face_map;
int prev_face = -1;
for (const int grid : node_grid_indices(node)) {
for (const int grid : node.grids()) {
const int face = grid_to_face_map[grid];
if (face != prev_face) {
faces.append(face);
@ -1834,16 +1823,6 @@ Span<int> node_face_indices_calc_grids(const SubdivCCG &subdiv_ccg,
return faces.as_span();
}
Span<int> node_faces(const MeshNode &node)
{
return node.face_indices_;
}
Span<int> node_grid_indices(const GridsNode &node)
{
return node.prim_indices_;
}
} // namespace blender::bke::pbvh
namespace blender::bke::pbvh {
@ -2071,7 +2050,7 @@ static bool pbvh_faces_node_raycast(const MeshNode &node,
int *r_active_face_index,
float *r_face_normal)
{
const Span<int> face_indices = node_faces(node);
const Span<int> face_indices = node.faces();
bool hit = false;
if (node_positions.is_empty()) {
@ -2192,7 +2171,7 @@ static bool pbvh_grids_node_raycast(const SubdivCCG &subdiv_ccg,
float *r_face_normal)
{
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_size = key.grid_size;
bool hit = false;
const BitGroupVector<> &grid_hidden = subdiv_ccg.grid_hidden;
@ -2473,7 +2452,7 @@ static bool pbvh_faces_node_nearest_to_ray(const MeshNode &node,
float *depth,
float *dist_sq)
{
const Span<int> face_indices = node_faces(node);
const Span<int> face_indices = node.faces();
bool hit = false;
if (node_positions.is_empty()) {
@ -2528,7 +2507,7 @@ static bool pbvh_grids_node_nearest_to_ray(const SubdivCCG &subdiv_ccg,
float *dist_sq)
{
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_size = key.grid_size;
const BitGroupVector<> &grid_hidden = subdiv_ccg.grid_hidden;
const Span<CCGElem *> elems = subdiv_ccg.grids;

View File

@ -163,7 +163,7 @@ static void do_encode_pixels(const uv_islands::MeshData &mesh_data,
tile_data.tile_number = image_tile.get_tile_number();
float2 tile_offset = float2(image_tile.get_tile_offset());
for (const int face : node_faces(node)) {
for (const int face : node.faces()) {
for (const int tri : bke::mesh::face_triangles_range(mesh_data.faces, face)) {
for (const UVPrimitiveLookup::Entry &entry : uv_prim_lookup.lookup[tri]) {
uv_islands::UVBorder uv_border = entry.uv_primitive->extract_border();

View File

@ -909,8 +909,7 @@ static void fill_vbos_grids(const Object &object,
switch (*request_type) {
case CustomRequest::Position: {
node_mask.foreach_index(GrainSize(1), [&](const int i) {
fill_vbo_position_grids(
key, grids, use_flat_layout[i], bke::pbvh::node_grid_indices(nodes[i]), *vbos[i]);
fill_vbo_position_grids(key, grids, use_flat_layout[i], nodes[i].grids(), *vbos[i]);
});
break;
}
@ -925,7 +924,7 @@ static void fill_vbos_grids(const Object &object,
grid_to_face_map,
sharp_faces,
use_flat_layout[i],
bke::pbvh::node_grid_indices(nodes[i]),
nodes[i].grids(),
*vbos[i]);
});
@ -933,8 +932,7 @@ static void fill_vbos_grids(const Object &object,
}
case CustomRequest::Mask: {
node_mask.foreach_index(GrainSize(1), [&](const int i) {
fill_vbo_mask_grids(
key, grids, use_flat_layout[i], bke::pbvh::node_grid_indices(nodes[i]), *vbos[i]);
fill_vbo_mask_grids(key, grids, use_flat_layout[i], nodes[i].grids(), *vbos[i]);
});
break;
}
@ -954,7 +952,7 @@ static void fill_vbos_grids(const Object &object,
face_set_default,
face_set_seed,
use_flat_layout[i],
bke::pbvh::node_grid_indices(nodes[i]),
nodes[i].grids(),
*vbos[i]);
});
}
@ -1007,7 +1005,7 @@ static void fill_vbos_mesh(const Object &object,
corner_tris,
hide_poly,
vert_positions,
bke::pbvh::node_faces(nodes[i]),
nodes[i].faces(),
*vbos[i]);
});
break;
@ -1025,7 +1023,7 @@ static void fill_vbos_mesh(const Object &object,
hide_poly,
vert_normals,
face_normals,
bke::pbvh::node_faces(nodes[i]),
nodes[i].faces(),
*vbos[i]);
});
break;
@ -1035,13 +1033,8 @@ static void fill_vbos_mesh(const Object &object,
bke::AttrDomain::Point);
if (!mask.is_empty()) {
node_mask.foreach_index(GrainSize(1), [&](const int i) {
fill_vbo_mask_mesh(faces,
corner_verts,
corner_tris,
hide_poly,
mask,
bke::pbvh::node_faces(nodes[i]),
*vbos[i]);
fill_vbo_mask_mesh(
faces, corner_verts, corner_tris, hide_poly, mask, nodes[i].faces(), *vbos[i]);
});
}
else {
@ -1062,7 +1055,7 @@ static void fill_vbos_mesh(const Object &object,
face_sets,
face_set_default,
face_set_seed,
bke::pbvh::node_faces(nodes[i]),
nodes[i].faces(),
*vbos[i]);
});
}
@ -1087,7 +1080,7 @@ static void fill_vbos_mesh(const Object &object,
hide_poly,
attribute,
domain,
bke::pbvh::node_faces(nodes[i]),
nodes[i].faces(),
*vbos[i]);
});
}
@ -1549,7 +1542,7 @@ static Array<int> calc_material_indices(const Object &object)
Array<int> node_materials(nodes.size());
threading::parallel_for(nodes.index_range(), 64, [&](const IndexRange range) {
for (const int i : range) {
const Span<int> face_indices = bke::pbvh::node_faces(nodes[i]);
const Span<int> face_indices = nodes[i].faces();
if (face_indices.is_empty()) {
continue;
}
@ -1572,7 +1565,7 @@ static Array<int> calc_material_indices(const Object &object)
const Span<int> grid_faces = subdiv_ccg.grid_to_face_map;
threading::parallel_for(nodes.index_range(), 64, [&](const IndexRange range) {
for (const int i : range) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
if (grids.is_empty()) {
continue;
}
@ -1609,7 +1602,7 @@ static BitVector<> calc_use_flat_layout(const Object &object, const OrigMeshData
Array<bool> use_flat_layout(nodes.size());
threading::parallel_for(nodes.index_range(), 4, [&](const IndexRange range) {
for (const int i : range) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
if (grids.is_empty()) {
continue;
}
@ -1718,11 +1711,8 @@ Span<gpu::IndexBuf *> DrawCacheImpl::ensure_lines_indices(const Object &object,
const bke::AttributeAccessor attributes = orig_mesh_data.attributes;
const VArraySpan hide_poly = *attributes.lookup<bool>(".hide_poly", bke::AttrDomain::Face);
nodes_to_calculate.foreach_index(GrainSize(1), [&](const int i) {
ibos[i] = create_index_faces(faces,
corner_verts,
hide_poly,
bke::pbvh::node_faces(nodes[i]),
nodes[i].vert_indices_);
ibos[i] = create_index_faces(
faces, corner_verts, hide_poly, nodes[i].faces(), nodes[i].vert_indices_);
});
break;
}
@ -1731,11 +1721,8 @@ Span<gpu::IndexBuf *> DrawCacheImpl::ensure_lines_indices(const Object &object,
nodes_to_calculate.foreach_index(GrainSize(1), [&](const int i) {
const SubdivCCG &subdiv_ccg = *object.sculpt->subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
ibos[i] = create_lines_index_grids(key,
subdiv_ccg.grid_hidden,
coarse,
bke::pbvh::node_grid_indices(nodes[i]),
use_flat_layout_[i]);
ibos[i] = create_lines_index_grids(
key, subdiv_ccg.grid_hidden, coarse, nodes[i].grids(), use_flat_layout_[i]);
});
break;
}
@ -1780,7 +1767,7 @@ BLI_NOINLINE static void ensure_vbos_allocated_mesh(const Object &object,
if (!vbos[i]) {
vbos[i] = GPU_vertbuf_create_with_format(format);
}
const Span<int> face_indices = bke::pbvh::node_faces(nodes[i]);
const Span<int> face_indices = nodes[i].faces();
const int verts_num = count_visible_tris_mesh(faces, face_indices, hide_poly) * 3;
GPU_vertbuf_data_alloc(*vbos[i], verts_num);
});
@ -1802,7 +1789,7 @@ BLI_NOINLINE static void ensure_vbos_allocated_grids(const Object &object,
}
const int verts_per_grid = use_flat_layout[i] ? square_i(key.grid_size - 1) * 4 :
square_i(key.grid_size);
const int verts_num = bke::pbvh::node_grid_indices(nodes[i]).size() * verts_per_grid;
const int verts_num = nodes[i].grids().size() * verts_per_grid;
GPU_vertbuf_data_alloc(*vbos[i], verts_num);
});
}
@ -1917,11 +1904,8 @@ Span<gpu::IndexBuf *> DrawCacheImpl::ensure_tri_indices(const Object &object,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
nodes_to_calculate.foreach_index(GrainSize(1), [&](const int i) {
ibos[i] = create_tri_index_grids(key,
subdiv_ccg.grid_hidden,
coarse,
bke::pbvh::node_grid_indices(nodes[i]),
use_flat_layout_[i]);
ibos[i] = create_tri_index_grids(
key, subdiv_ccg.grid_hidden, coarse, nodes[i].grids(), use_flat_layout_[i]);
});
return ibos;
}

View File

@ -70,7 +70,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -113,7 +113,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -56,7 +56,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -110,7 +110,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -56,7 +56,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
tls.factors.resize(verts.size());
@ -103,7 +103,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -82,7 +82,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -137,7 +137,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -51,7 +51,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -92,7 +92,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -182,7 +182,7 @@ static void do_draw_face_sets_brush_mesh(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
MeshLocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> face_indices = bke::pbvh::node_faces(nodes[i]);
const Span<int> face_indices = nodes[i].faces();
calc_faces(depsgraph,
object,
@ -235,7 +235,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -50,7 +50,7 @@ static void calc_faces(const Depsgraph &depsgraph,
Mesh &mesh = *static_cast<Mesh *>(object.data);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -93,7 +93,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);

View File

@ -92,7 +92,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -136,7 +136,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -100,7 +100,7 @@ static void calc_faces(const Depsgraph &depsgraph,
Mesh &mesh = *static_cast<Mesh *>(object.data);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -139,7 +139,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);

View File

@ -51,7 +51,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -96,7 +96,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());
@ -180,7 +180,7 @@ static void calc_translations_faces(const Span<float3> vert_positions,
LocalData &tls,
const MutableSpan<float3> all_translations)
{
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.vert_neighbors.resize(verts.size());
const MutableSpan<Vector<int>> neighbors = tls.vert_neighbors;
@ -201,7 +201,7 @@ static void calc_translations_grids(const SubdivCCG &subdiv_ccg,
LocalData &tls,
const MutableSpan<float3> all_translations)
{
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.new_positions.resize(positions.size());

View File

@ -53,7 +53,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -101,7 +101,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -52,7 +52,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -98,7 +98,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -64,7 +64,7 @@ static void calc_faces(const Depsgraph &depsgraph,
Mesh &mesh = *static_cast<Mesh *>(object.data);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -111,7 +111,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);

View File

@ -58,7 +58,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -99,7 +99,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -133,7 +133,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
tls.factors.resize(verts.size());
@ -227,7 +227,7 @@ static void calc_grids(const Depsgraph &depsgraph,
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -74,7 +74,7 @@ static void calc_faces(const Depsgraph &depsgraph,
SculptSession &ss = *object.sculpt;
const StrokeCache &cache = *ss.cache;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -121,7 +121,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -139,7 +139,7 @@ static void sample_node_surface_mesh(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(vert_positions, verts, tls.positions);
tls.factors.resize(verts.size());
@ -182,7 +182,7 @@ static void sample_node_surface_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());
@ -352,7 +352,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
tls.factors.resize(verts.size());
@ -410,7 +410,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -57,7 +57,7 @@ static void calc_node(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -46,7 +46,7 @@ static void calc_node(const Depsgraph &depsgraph,
const Span<CCGElem *> elems = subdiv_ccg.grids;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());
@ -160,7 +160,7 @@ BLI_NOINLINE static void store_node_prev_displacement(const Span<float3> limit_p
const bke::pbvh::GridsNode &node,
const MutableSpan<float3> prev_displacement)
{
for (const int grid : bke::pbvh::node_grid_indices(node)) {
for (const int grid : node.grids()) {
const int start = grid * key.grid_area;
CCGElem *elem = elems[grid];
for (const int i : IndexRange(key.grid_area)) {

View File

@ -76,7 +76,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
tls.factors.resize(verts.size());
@ -125,7 +125,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -114,7 +114,7 @@ BLI_NOINLINE static void calc_factors_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
@ -194,7 +194,7 @@ static void do_relax_face_sets_brush_mesh(const Depsgraph &depsgraph,
ss.face_sets,
hide_poly,
relax_face_sets,
bke::pbvh::node_unique_verts(nodes[i]),
nodes[i].verts(),
factors.as_span().slice(node_vert_offsets[pos]),
tls.vert_neighbors,
translations.as_mutable_span().slice(node_vert_offsets[pos]));
@ -204,7 +204,7 @@ static void do_relax_face_sets_brush_mesh(const Depsgraph &depsgraph,
apply_positions_faces(depsgraph,
sd,
positions_eval,
bke::pbvh::node_unique_verts(nodes[i]),
nodes[i].verts(),
object,
translations.as_mutable_span().slice(node_vert_offsets[pos]),
positions_orig);
@ -228,7 +228,7 @@ BLI_NOINLINE static void calc_factors_grids(const Depsgraph &depsgraph,
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
gather_grids_positions(key, subdiv_ccg.grids, grids, positions);
@ -314,7 +314,7 @@ static void do_relax_face_sets_brush_grids(const Depsgraph &depsgraph,
ss.face_sets,
ss.vert_to_face_map,
ss.vertex_info.boundary,
bke::pbvh::node_grid_indices(nodes[i]),
nodes[i].grids(),
relax_face_sets,
factors.as_span().slice(node_vert_offsets[pos]),
current_positions.as_span().slice(node_vert_offsets[pos]),
@ -324,7 +324,7 @@ static void do_relax_face_sets_brush_grids(const Depsgraph &depsgraph,
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
apply_positions_grids(sd,
bke::pbvh::node_grid_indices(nodes[i]),
nodes[i].grids(),
object,
current_positions.as_mutable_span().slice(node_vert_offsets[pos]),
translations.as_mutable_span().slice(node_vert_offsets[pos]));
@ -439,7 +439,7 @@ BLI_NOINLINE static void calc_topology_relax_factors_faces(const Depsgraph &deps
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
@ -512,7 +512,7 @@ static void do_topology_relax_brush_mesh(const Depsgraph &depsgraph,
ss.face_sets,
hide_poly,
false,
bke::pbvh::node_unique_verts(nodes[i]),
nodes[i].verts(),
factors.as_span().slice(node_vert_offsets[pos]),
tls.vert_neighbors,
translations.as_mutable_span().slice(node_vert_offsets[pos]));
@ -522,7 +522,7 @@ static void do_topology_relax_brush_mesh(const Depsgraph &depsgraph,
apply_positions_faces(depsgraph,
sd,
positions_eval,
bke::pbvh::node_unique_verts(nodes[i]),
nodes[i].verts(),
object,
translations.as_mutable_span().slice(node_vert_offsets[pos]),
positions_orig);
@ -543,7 +543,7 @@ BLI_NOINLINE static void calc_topology_relax_factors_grids(const Depsgraph &deps
const SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
gather_grids_positions(key, subdiv_ccg.grids, grids, positions);
@ -619,7 +619,7 @@ static void do_topology_relax_brush_grids(const Depsgraph &depsgraph,
ss.face_sets,
ss.vert_to_face_map,
ss.vertex_info.boundary,
bke::pbvh::node_grid_indices(nodes[i]),
nodes[i].grids(),
false,
factors.as_span().slice(node_vert_offsets[pos]),
current_positions.as_span().slice(node_vert_offsets[pos]),
@ -629,7 +629,7 @@ static void do_topology_relax_brush_grids(const Depsgraph &depsgraph,
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
apply_positions_grids(sd,
bke::pbvh::node_grid_indices(nodes[i]),
nodes[i].grids(),
object,
current_positions.as_mutable_span().slice(node_vert_offsets[pos]),
translations.as_mutable_span().slice(node_vert_offsets[pos]));

View File

@ -68,7 +68,7 @@ static void calc_faces(const Depsgraph &depsgraph,
Mesh &mesh = *static_cast<Mesh *>(object.data);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -114,7 +114,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);

View File

@ -53,7 +53,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -101,7 +101,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -70,7 +70,7 @@ BLI_NOINLINE static void apply_positions_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -134,7 +134,7 @@ BLI_NOINLINE static void do_smooth_brush_mesh(const Depsgraph &depsgraph,
for (const float strength : iteration_strengths(brush_strength)) {
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
LocalData &tls = all_tls.local();
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.vert_neighbors.resize(verts.size());
calc_vert_neighbors_interior(faces,
corner_verts,
@ -182,7 +182,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -81,7 +81,7 @@ static void apply_masks_faces(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -153,7 +153,7 @@ static void do_smooth_brush_mesh(const Depsgraph &depsgraph,
corner_verts,
ss.vert_to_face_map,
hide_poly,
bke::pbvh::node_unique_verts(nodes[i]),
nodes[i].verts(),
mask.span.as_span(),
tls,
new_masks.as_mutable_span().slice(node_vert_offsets[pos]));
@ -187,7 +187,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -172,7 +172,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const bool do_elastic = brush.snake_hook_deform_type == BRUSH_SNAKE_HOOK_DEFORM_ELASTIC;
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
tls.factors.resize(verts.size());
@ -233,7 +233,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const bool do_elastic = brush.snake_hook_deform_type == BRUSH_SNAKE_HOOK_DEFORM_ELASTIC;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -75,7 +75,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_mesh(const Depsgraph &depsgraph
threading::EnumerableThreadSpecific<LocalData> all_tls;
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
LocalData &tls = all_tls.local();
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const MutableSpan<float> factors = all_factors.as_mutable_span().slice(node_offsets[pos]);
fill_factor_from_hide_and_mask(mesh, verts, factors);
@ -104,7 +104,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_mesh(const Depsgraph &depsgraph
for ([[maybe_unused]] const int iteration : IndexRange(brush.surface_smooth_iterations)) {
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
LocalData &tls = all_tls.local();
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
const Span<float> factors = all_factors.as_span().slice(node_offsets[pos]);
@ -133,7 +133,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_mesh(const Depsgraph &depsgraph
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
LocalData &tls = all_tls.local();
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float> factors = all_factors.as_span().slice(node_offsets[pos]);
const MutableSpan<float3> laplacian_disp = gather_data_mesh(
@ -184,7 +184,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_grids(
threading::EnumerableThreadSpecific<LocalData> all_tls;
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
LocalData &tls = all_tls.local();
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const MutableSpan<float> factors = all_factors.as_mutable_span().slice(node_offsets[pos]);
@ -213,7 +213,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_grids(
for ([[maybe_unused]] const int iteration : IndexRange(brush.surface_smooth_iterations)) {
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
LocalData &tls = all_tls.local();
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
const Span<float> factors = all_factors.as_span().slice(node_offsets[pos]);
@ -238,7 +238,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_grids(
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
LocalData &tls = all_tls.local();
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const Span<float> factors = all_factors.as_span().slice(node_offsets[pos]);

View File

@ -50,7 +50,7 @@ static void calc_faces(const Depsgraph &depsgraph,
Mesh &mesh = *static_cast<Mesh *>(object.data);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -94,7 +94,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);

View File

@ -170,7 +170,7 @@ static void calc_faces(const Depsgraph &depsgraph,
Mesh &mesh = *static_cast<Mesh *>(object.data);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
tls.factors.resize(verts.size());
@ -220,7 +220,7 @@ static void calc_grids(const Depsgraph &depsgraph,
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());

View File

@ -134,7 +134,7 @@ void mesh_show_all(const Depsgraph &depsgraph, Object &object, const IndexMask &
IndexMaskMemory memory;
const IndexMask changed_nodes = IndexMask::from_predicate(
node_mask, GrainSize(1), memory, [&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
return std::any_of(
verts.begin(), verts.end(), [&](const int i) { return hide_vert[i]; });
});
@ -158,7 +158,7 @@ void grids_show_all(Depsgraph &depsgraph, Object &object, const IndexMask &node_
IndexMaskMemory memory;
const IndexMask changed_nodes = IndexMask::from_predicate(
node_mask, GrainSize(1), memory, [&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
return std::any_of(grids.begin(), grids.end(), [&](const int i) {
return bits::any_bit_set(grid_hidden[i]);
});
@ -228,7 +228,7 @@ static void flush_face_changes_node(Mesh &mesh,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
TLS &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> node_faces = bke::pbvh::node_faces(nodes[i]);
const Span<int> node_faces = nodes[i].faces();
tls.new_hide.resize(node_faces.size());
gather_data_mesh(hide_poly.span.as_span(), node_faces, tls.new_hide.as_mutable_span());
@ -288,7 +288,7 @@ static void vert_hide_update(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
Vector<bool> &new_hide = all_new_hide.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
new_hide.resize(verts.size());
gather_data_mesh(hide_vert.span.as_span(), verts, new_hide.as_mutable_span());
@ -327,7 +327,7 @@ static void grid_hide_update(Depsgraph &depsgraph,
bool any_changed = false;
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
BitGroupVector<> new_hide(grids.size(), grid_hidden.group_size());
for (const int i : grids.index_range()) {
new_hide[i].copy_from(grid_hidden[grids[i]].as_span());
@ -718,7 +718,7 @@ static void invert_visibility_mesh(const Depsgraph &depsgraph,
undo::push_nodes(depsgraph, object, node_mask, undo::Type::HideFace);
node_mask.foreach_index(GrainSize(1), [&](const int i) {
for (const int face : bke::pbvh::node_faces(nodes[i])) {
for (const int face : nodes[i].faces()) {
hide_poly.span[face] = !hide_poly.span[face];
}
BKE_pbvh_node_mark_update_visibility(nodes[i]);
@ -741,7 +741,7 @@ static void invert_visibility_grids(Depsgraph &depsgraph,
BitGroupVector<> &grid_hidden = BKE_subdiv_ccg_grid_hidden_ensure(subdiv_ccg);
node_mask.foreach_index(GrainSize(1), [&](const int i) {
for (const int i : bke::pbvh::node_grid_indices(nodes[i])) {
for (const int i : nodes[i].grids()) {
bits::invert(grid_hidden[i]);
}
BKE_pbvh_node_mark_update_visibility(nodes[i]);
@ -900,7 +900,7 @@ static void update_undo_state(const Depsgraph &depsgraph,
const Span<bke::pbvh::MeshNode> nodes = ss.pbvh->nodes<bke::pbvh::MeshNode>();
node_mask.foreach_index(GrainSize(1), [&](const int i) {
for (const int vert : bke::pbvh::node_unique_verts(nodes[i])) {
for (const int vert : nodes[i].verts()) {
if (old_hide_vert[vert] != new_hide_vert[vert]) {
undo::push_node(depsgraph, object, &nodes[i], undo::Type::HideVert);
break;
@ -917,7 +917,7 @@ static void update_node_visibility_from_face_changes(MutableSpan<bke::pbvh::Mesh
{
node_mask.foreach_index(GrainSize(1), [&](const int i) {
bool any_changed = false;
const Span<int> indices = bke::pbvh::node_faces(nodes[i]);
const Span<int> indices = nodes[i].faces();
for (const int face_index : indices) {
if (orig_hide_poly[face_index] != new_hide_poly[face_index]) {
any_changed = true;
@ -1018,7 +1018,7 @@ static void grow_shrink_visibility_grid(Depsgraph &depsgraph,
BitGroupVector<> &write_buffer = buffers.write_buffer(i);
node_mask.foreach_index(GrainSize(1), [&](const int i) {
for (const int grid : bke::pbvh::node_grid_indices(nodes[i])) {
for (const int grid : nodes[i].grids()) {
for (const int y : IndexRange(key.grid_size)) {
for (const int x : IndexRange(key.grid_size)) {
const int grid_elem_idx = CCG_grid_xy_to_index(key.grid_size, x, y);

View File

@ -372,7 +372,7 @@ static Span<int> get_hidden_verts(const bke::pbvh::MeshNode &node,
if (hide_vert.is_empty()) {
return {};
}
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
if (BKE_pbvh_node_fully_hidden_get(node)) {
return verts;
}
@ -430,7 +430,7 @@ static bool try_remove_mask_mesh(const Depsgraph &depsgraph,
/* Store undo data for nodes with changed mask. */
node_mask.foreach_index(GrainSize(1), [&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
if (std::all_of(verts.begin(), verts.end(), [&](const int i) { return mask[i] == 0.0f; })) {
return;
}
@ -515,7 +515,7 @@ static void fill_mask_grids(Main &bmain,
const Span<CCGElem *> grids = subdiv_ccg.grids;
bool any_changed = false;
node_mask.foreach_index(GrainSize(1), [&](const int i) {
const Span<int> grid_indices = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grid_indices = nodes[i].grids();
if (std::all_of(grid_indices.begin(), grid_indices.end(), [&](const int grid) {
CCGElem *elem = grids[grid];
for (const int i : IndexRange(key.grid_area)) {
@ -640,7 +640,7 @@ static void invert_mask_grids(Main &bmain,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<CCGElem *> grids = subdiv_ccg.grids;
node_mask.foreach_index(GrainSize(1), [&](const int i) {
const Span<int> grid_indices = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grid_indices = nodes[i].grids();
if (grid_hidden.is_empty()) {
for (const int grid : grid_indices) {
CCGElem *elem = grids[grid];
@ -835,7 +835,7 @@ static void gesture_apply_for_symmetry_pass(bContext & /*C*/, gesture::GestureDa
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
node_mask.slice(range).foreach_index([&](const int i) {
bool any_changed = false;
for (const int grid : bke::pbvh::node_grid_indices(nodes[i])) {
for (const int grid : nodes[i].grids()) {
CCGElem *elem = grids[grid];
BKE_subdiv_ccg_foreach_visible_grid_vert(key, grid_hidden, grid, [&](const int i) {
if (gesture::is_affected(gesture_data,

View File

@ -1093,7 +1093,7 @@ static void do_vpaint_brush_blur_loops(const bContext *C,
blender::threading::parallel_for(node_mask.index_range(), 1LL, [&](IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);
@ -1251,7 +1251,7 @@ static void do_vpaint_brush_blur_verts(const bContext *C,
blender::threading::parallel_for(node_mask.index_range(), 1LL, [&](IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);
@ -1412,7 +1412,7 @@ static void do_vpaint_brush_smear(const bContext *C,
blender::threading::parallel_for(node_mask.index_range(), 1LL, [&](IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);
@ -1598,7 +1598,7 @@ static void calculate_average_color(VPaintData &vpd,
accum2.len = 0;
memset(accum2.value, 0, sizeof(accum2.value));
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);
@ -1729,7 +1729,7 @@ static void vpaint_do_draw(const bContext *C,
blender::threading::parallel_for(node_mask.index_range(), 1LL, [&](IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);

View File

@ -1135,7 +1135,7 @@ static void do_wpaint_brush_blur(const Depsgraph &depsgraph,
parallel_nodes_loop_with_mirror_check(mesh, node_mask, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);
@ -1253,7 +1253,7 @@ static void do_wpaint_brush_smear(const Depsgraph &depsgraph,
parallel_nodes_loop_with_mirror_check(mesh, node_mask, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);
@ -1370,7 +1370,7 @@ static void do_wpaint_brush_draw(const Depsgraph &depsgraph,
parallel_nodes_loop_with_mirror_check(mesh, node_mask, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);
@ -1457,7 +1457,7 @@ static float calculate_average_weight(const Depsgraph &depsgraph,
[&](const IndexRange range, WPaintAverageAccum accum) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide(mesh, verts, factors);

View File

@ -863,7 +863,7 @@ std::optional<int> nearest_vert_calc_mesh(const bke::pbvh::Tree &pbvh,
NearestData(),
[&](const IndexRange range, NearestData nearest) {
nodes_in_sphere.slice(range).foreach_index([&](const int i) {
for (const int vert : bke::pbvh::node_unique_verts(nodes[i])) {
for (const int vert : nodes[i].verts()) {
if (!hide_vert.is_empty() && hide_vert[vert]) {
continue;
}
@ -913,7 +913,7 @@ std::optional<SubdivCCGCoord> nearest_vert_calc_grids(const bke::pbvh::Tree &pbv
NearestData(),
[&](const IndexRange range, NearestData nearest) {
nodes_in_sphere.slice(range).foreach_index([&](const int i) {
for (const int grid : bke::pbvh::node_grid_indices(nodes[i])) {
for (const int grid : nodes[i].grids()) {
CCGElem *elem = elems[grid];
BKE_subdiv_ccg_foreach_visible_grid_vert(key, grid_hidden, grid, [&](const int i) {
const float distance_sq = math::distance_squared(CCG_elem_offset_co(key, elem, i),
@ -1177,7 +1177,7 @@ static void restore_mask_from_undo_step(Object &object)
if (const std::optional<Span<float>> orig_data = orig_mask_data_lookup_mesh(object,
nodes[i]))
{
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
array_utils::scatter(*orig_data, verts, mask.span);
BKE_pbvh_node_mark_update_mask(nodes[i]);
}
@ -1211,7 +1211,7 @@ static void restore_mask_from_undo_step(Object &object)
nodes[i]))
{
int index = 0;
for (const int grid : bke::pbvh::node_grid_indices(nodes[i])) {
for (const int grid : nodes[i].grids()) {
CCGElem *elem = grids[grid];
for (const int i : IndexRange(key.grid_area)) {
if (grid_hidden.is_empty() || !grid_hidden[grid][i]) {
@ -1245,7 +1245,7 @@ static void restore_color_from_undo_step(Object &object)
if (const std::optional<Span<float4>> orig_data = orig_color_data_lookup_mesh(object,
nodes[i]))
{
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
for (const int i : verts.index_range()) {
color::color_vert_set(faces,
corner_verts,
@ -1274,7 +1274,7 @@ static void restore_face_set_from_undo_step(Object &object)
if (const std::optional<Span<int>> orig_data = orig_face_set_data_lookup_mesh(object,
nodes[i]))
{
scatter_data_mesh(*orig_data, bke::pbvh::node_faces(nodes[i]), attribute.span);
scatter_data_mesh(*orig_data, nodes[i].faces(), attribute.span);
BKE_pbvh_node_mark_update_face_sets(nodes[i]);
}
});
@ -1332,7 +1332,7 @@ void restore_position_from_undo_step(const Depsgraph &depsgraph, Object &object)
if (const std::optional<OrigPositionData> orig_data = orig_position_data_lookup_mesh(
object, nodes[i]))
{
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float3> undo_positions = orig_data->positions;
if (need_translations) {
tls.translations.resize(verts.size());
@ -1398,7 +1398,7 @@ void restore_position_from_undo_step(const Depsgraph &depsgraph, Object &object)
object, nodes[i]))
{
int index = 0;
for (const int grid : bke::pbvh::node_grid_indices(nodes[i])) {
for (const int grid : nodes[i].grids()) {
CCGElem *elem = grids[grid];
for (const int i : IndexRange(key.grid_area)) {
if (grid_hidden.is_empty() || !grid_hidden[grid][i]) {
@ -1698,7 +1698,7 @@ static void calc_area_normal_and_center_node_mesh(const Object &object,
const float normal_radius_sq = normal_radius * normal_radius;
const float normal_radius_inv = math::rcp(normal_radius);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
if (ss.cache && !ss.cache->accum) {
if (const std::optional<OrigPositionData> orig_data = orig_position_data_get_mesh(object,
@ -1787,7 +1787,7 @@ static void calc_area_normal_and_center_node_grids(const Object &object,
const CCGKey key = BKE_subdiv_ccg_key_top_level(*ss.subdiv_ccg);
const Span<CCGElem *> elems = subdiv_ccg.grids;
const BitGroupVector<> &grid_hidden = subdiv_ccg.grid_hidden;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
if (ss.cache && !ss.cache->accum) {
if (const std::optional<OrigPositionData> orig_data = orig_position_data_get_grids(object,
@ -5922,7 +5922,7 @@ static void fake_neighbor_search_mesh(const SculptSession &ss,
const bke::pbvh::MeshNode &node,
NearestVertData &nvtd)
{
for (const int vert : bke::pbvh::node_unique_verts(node)) {
for (const int vert : node.verts()) {
if (!hide_vert.is_empty() && hide_vert[vert]) {
continue;
}
@ -5950,7 +5950,7 @@ static void fake_neighbor_search_grids(const SculptSession &ss,
const bke::pbvh::GridsNode &node,
NearestVertData &nvtd)
{
for (const int grid : bke::pbvh::node_grid_indices(node)) {
for (const int grid : node.grids()) {
const int verts_start = grid * key.grid_area;
CCGElem *elem = elems[grid];
BKE_subdiv_ccg_foreach_visible_grid_vert(key, grid_hidden, grid, [&](const int offset) {
@ -7463,9 +7463,8 @@ OffsetIndices<int> create_node_vert_offsets(const Span<bke::pbvh::MeshNode> node
Array<int> &node_data)
{
node_data.reinitialize(node_mask.size() + 1);
node_mask.foreach_index([&](const int i, const int pos) {
node_data[pos] = bke::pbvh::node_unique_verts(nodes[i]).size();
});
node_mask.foreach_index(
[&](const int i, const int pos) { node_data[pos] = nodes[i].verts().size(); });
return offset_indices::accumulate_counts_to_offsets(node_data);
}
@ -7476,7 +7475,7 @@ OffsetIndices<int> create_node_vert_offsets(const CCGKey &key,
{
node_data.reinitialize(node_mask.size() + 1);
node_mask.foreach_index([&](const int i, const int pos) {
node_data[pos] = bke::pbvh::node_grid_indices(nodes[i]).size() * key.grid_area;
node_data[pos] = nodes[i].grids().size() * key.grid_area;
});
return offset_indices::accumulate_counts_to_offsets(node_data);
}

View File

@ -1131,7 +1131,7 @@ static void calc_bend_mesh(const Depsgraph &depsgraph,
SculptSession &ss = *object.sculpt;
const StrokeCache &cache = *ss.cache;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
@ -1191,7 +1191,7 @@ static void calc_bend_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
@ -1426,7 +1426,7 @@ static void calc_slide_mesh(const Depsgraph &depsgraph,
SculptSession &ss = *object.sculpt;
const StrokeCache &cache = *ss.cache;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
@ -1485,7 +1485,7 @@ static void calc_slide_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
@ -1713,7 +1713,7 @@ static void calc_inflate_mesh(const Depsgraph &depsgraph,
SculptSession &ss = *object.sculpt;
const StrokeCache &cache = *ss.cache;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
@ -1767,7 +1767,7 @@ static void calc_inflate_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
@ -1984,7 +1984,7 @@ static void calc_grab_mesh(const Depsgraph &depsgraph,
SculptSession &ss = *object.sculpt;
const StrokeCache &cache = *ss.cache;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
@ -2039,7 +2039,7 @@ static void calc_grab_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
@ -2262,7 +2262,7 @@ static void calc_twist_mesh(const Depsgraph &depsgraph,
SculptSession &ss = *object.sculpt;
const StrokeCache &cache = *ss.cache;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
@ -2319,7 +2319,7 @@ static void calc_twist_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
@ -2636,7 +2636,7 @@ static void calc_smooth_mesh(const Depsgraph &depsgraph,
SculptSession &ss = *object.sculpt;
const StrokeCache &cache = *ss.cache;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
@ -2702,7 +2702,7 @@ static void calc_smooth_grids(const Sculpt &sd,
const StrokeCache &cache = *ss.cache;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);

View File

@ -553,7 +553,7 @@ void ensure_nodes_constraints(const Sculpt &sd,
const BitGroupVector<> &grid_hidden = subdiv_ccg.grid_hidden;
uninitialized_nodes.foreach_index([&](const int i) {
const Span<int> verts = calc_visible_vert_indices_grids(
key, grid_hidden, bke::pbvh::node_grid_indices(nodes[i]), vert_indices);
key, grid_hidden, nodes[i].grids(), vert_indices);
vert_neighbors.resize(verts.size());
calc_vert_neighbor_indices_grids(subdiv_ccg, verts, vert_neighbors);
add_constraints_for_verts(object,
@ -738,7 +738,7 @@ static void calc_forces_mesh(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<const Mesh *>(ob.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
const MutableSpan init_positions = gather_data_mesh(
cloth_sim.init_pos.as_span(), verts, tls.init_positions);
@ -846,7 +846,7 @@ static void calc_forces_grids(const Depsgraph &depsgraph,
const SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const MutableSpan init_positions = gather_data_grids(
subdiv_ccg, cloth_sim.init_pos.as_span(), grids, tls.init_positions);
@ -1242,7 +1242,7 @@ static void calc_constraint_factors(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide_and_mask(mesh, verts, factors);
@ -1264,7 +1264,7 @@ static void calc_constraint_factors(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);
const MutableSpan<float> factors = tls.factors;
@ -1409,7 +1409,7 @@ void do_simulation_step(const Depsgraph &depsgraph,
threading::parallel_for(active_nodes.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
active_nodes.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -1446,7 +1446,7 @@ void do_simulation_step(const Depsgraph &depsgraph,
threading::parallel_for(active_nodes.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
active_nodes.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);
@ -1694,7 +1694,7 @@ static void copy_positions_to_array(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 8, [&](const IndexRange range) {
Vector<float3> node_positions;
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
gather_grids_positions(subdiv_ccg, grids, node_positions);
scatter_data_grids(subdiv_ccg, node_positions.as_span(), grids, positions);
});
@ -1726,7 +1726,7 @@ static void copy_normals_to_array(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 8, [&](const IndexRange range) {
Vector<float3> node_normals;
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const int grid_verts_num = grids.size() * key.grid_area;
node_normals.resize(grid_verts_num);
@ -2089,7 +2089,7 @@ static void apply_filter_forces_mesh(const Depsgraph &depsgraph,
SimulationData &cloth_sim = *ss.filter_cache->cloth_sim;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -2158,7 +2158,7 @@ static void apply_filter_forces_grids(const Depsgraph &depsgraph,
const SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);

View File

@ -1462,7 +1462,7 @@ static void restore_color_data(Object &ob, Cache &expand_cache)
const GroupedSpan<int> vert_to_face_map = ss.vert_to_face_map;
bke::GSpanAttributeWriter color_attribute = color::active_color_attribute_for_write(mesh);
node_mask.foreach_index([&](const int i) {
for (const int vert : bke::pbvh::node_unique_verts(nodes[i])) {
for (const int vert : nodes[i].verts()) {
color::color_vert_set(faces,
corner_verts,
vert_to_face_map,
@ -1612,7 +1612,7 @@ static void update_mask_grids(const SculptSession &ss,
const Span<CCGElem *> elems = subdiv_ccg.grids;
bool any_changed = false;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
for (const int i : grids.index_range()) {
const int grid = grids[i];
const int start = grid * key.grid_area;
@ -1755,7 +1755,7 @@ static void colors_update_task(const Depsgraph &depsgraph,
const BitVector<> enabled_verts = enabled_state_to_bitmap(depsgraph, object, expand_cache);
bool any_changed = false;
const Span<int> verts = bke::pbvh::node_unique_verts(*node);
const Span<int> verts = node->verts();
for (const int i : verts.index_range()) {
const int vert = verts[i];
if (!hide_vert.is_empty() && hide_vert[vert]) {

View File

@ -303,7 +303,7 @@ static void face_sets_update(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
TLS &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> faces = bke::pbvh::node_faces(nodes[i]);
const Span<int> faces = nodes[i].faces();
tls.new_face_sets.resize(faces.size());
MutableSpan<int> new_face_sets = tls.new_face_sets;
@ -366,7 +366,7 @@ static void clear_face_sets(const Depsgraph &depsgraph, Object &object, const In
if (pbvh.type() == bke::pbvh::Type::Mesh) {
MutableSpan<bke::pbvh::MeshNode> nodes = ss.pbvh->nodes<bke::pbvh::MeshNode>();
node_mask.foreach_index(GrainSize(1), [&](const int i) {
const Span<int> faces = bke::pbvh::node_faces(nodes[i]);
const Span<int> faces = nodes[i].faces();
if (std::any_of(faces.begin(), faces.end(), [&](const int face) {
return face_sets[face] != default_face_set;
}))
@ -889,7 +889,7 @@ static void face_hide_update(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
TLS &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> faces = bke::pbvh::node_faces(nodes[i]);
const Span<int> faces = nodes[i].faces();
tls.new_hide.resize(faces.size());
MutableSpan<bool> new_hide = tls.new_hide;
@ -1364,7 +1364,7 @@ static void edit_fairing(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
for (const int i : verts.index_range()) {
@ -1654,7 +1654,7 @@ static void gesture_apply_mesh(gesture::GestureData &gesture_data, const IndexMa
node_mask.foreach_index(GrainSize(1), [&](const int i) {
undo::push_node(depsgraph, *gesture_data.vc.obact, &nodes[i], undo::Type::FaceSet);
bool any_updated = false;
for (const int face : bke::pbvh::node_faces(nodes[i])) {
for (const int face : nodes[i].faces()) {
if (!hide_poly.is_empty() && hide_poly[face]) {
continue;
}

View File

@ -112,7 +112,7 @@ static void color_filter_task(const Depsgraph &depsgraph,
const Span<float4> orig_colors = orig_color_data_get_mesh(ob, node);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -325,7 +325,7 @@ static void sculpt_color_presmooth_init(const Mesh &mesh, SculptSession &ss)
const MutableSpan<float4> pre_smoothed_color = ss.filter_cache->pre_smoothed_color;
node_mask.foreach_index(GrainSize(1), [&](const int i) {
for (const int vert : bke::pbvh::node_unique_verts(nodes[i])) {
for (const int vert : nodes[i].verts()) {
pre_smoothed_color[vert] = color_vert_get(
faces, corner_verts, vert_to_face_map, colors, color_attribute.domain, vert);
}
@ -340,7 +340,7 @@ static void sculpt_color_presmooth_init(const Mesh &mesh, SculptSession &ss)
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.vert_neighbors.resize(verts.size());
calc_vert_neighbors(faces, corner_verts, vert_to_face_map, {}, verts, tls.vert_neighbors);

View File

@ -138,7 +138,7 @@ static void smooth_mask_mesh(const OffsetIndices<int> faces,
FilterLocalData &tls,
MutableSpan<float> new_mask)
{
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.vert_neighbors.resize(verts.size());
const MutableSpan<Vector<int>> neighbors = tls.vert_neighbors;
@ -156,7 +156,7 @@ static void sharpen_mask_mesh(const OffsetIndices<int> faces,
FilterLocalData &tls,
MutableSpan<float> new_mask)
{
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.node_mask.resize(verts.size());
const MutableSpan<float> node_mask = tls.node_mask;
@ -180,7 +180,7 @@ static void grow_mask_mesh(const OffsetIndices<int> faces,
FilterLocalData &tls,
MutableSpan<float> new_mask)
{
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.vert_neighbors.resize(verts.size());
const MutableSpan<Vector<int>> neighbors = tls.vert_neighbors;
@ -203,7 +203,7 @@ static void shrink_mask_mesh(const OffsetIndices<int> faces,
FilterLocalData &tls,
MutableSpan<float> new_mask)
{
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.vert_neighbors.resize(verts.size());
const MutableSpan<Vector<int>> neighbors = tls.vert_neighbors;
@ -296,7 +296,7 @@ static void apply_new_mask_grids(const Depsgraph &depsgraph,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
node_mask.foreach_index(GrainSize(1), [&](const int i, const int pos) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float> new_node_mask = new_mask.slice(node_verts[pos]);
if (mask_equals_array_grids(subdiv_ccg.grids, key, grids, new_node_mask)) {
return;
@ -314,8 +314,8 @@ static void smooth_mask_grids(const SubdivCCG &subdiv_ccg,
const bke::pbvh::GridsNode &node,
MutableSpan<float> new_mask)
{
const Span<int> grids = bke::pbvh::node_grid_indices(node);
average_neighbor_mask_grids(subdiv_ccg, bke::pbvh::node_grid_indices(node), new_mask);
const Span<int> grids = node.grids();
average_neighbor_mask_grids(subdiv_ccg, node.grids(), new_mask);
copy_old_hidden_mask_grids(subdiv_ccg, grids, new_mask);
}
@ -326,7 +326,7 @@ static void sharpen_mask_grids(const SubdivCCG &subdiv_ccg,
{
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.node_mask.resize(grid_verts_num);
@ -347,7 +347,7 @@ static void grow_mask_grids(const SubdivCCG &subdiv_ccg,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<CCGElem *> elems = subdiv_ccg.grids;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
for (const int i : grids.index_range()) {
const int grid = grids[i];
@ -382,7 +382,7 @@ static void shrink_mask_grids(const SubdivCCG &subdiv_ccg,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<CCGElem *> elems = subdiv_ccg.grids;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
for (const int i : grids.index_range()) {
const int grid = grids[i];
@ -419,7 +419,7 @@ static void increase_contrast_mask_grids(const Depsgraph &depsgraph,
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.node_mask.resize(grid_verts_num);
@ -450,7 +450,7 @@ static void decrease_contrast_mask_grids(const Depsgraph &depsgraph,
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.node_mask.resize(grid_verts_num);

View File

@ -359,7 +359,7 @@ static void calc_smooth_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
@ -411,7 +411,7 @@ static void calc_smooth_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
@ -507,7 +507,7 @@ static void calc_inflate_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
@ -540,7 +540,7 @@ static void calc_inflate_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
@ -626,7 +626,7 @@ static void calc_scale_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
@ -659,7 +659,7 @@ static void calc_scale_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
@ -761,7 +761,7 @@ static void calc_sphere_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
@ -793,7 +793,7 @@ static void calc_sphere_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
@ -888,7 +888,7 @@ static void calc_random_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
@ -922,7 +922,7 @@ static void calc_random_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
@ -1017,7 +1017,7 @@ static void calc_relax_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -1069,7 +1069,7 @@ static void calc_relax_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());
@ -1181,7 +1181,7 @@ static void calc_relax_face_sets_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -1236,7 +1236,7 @@ static void calc_relax_face_sets_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());
@ -1353,7 +1353,7 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
@ -1398,7 +1398,7 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -1442,7 +1442,7 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
@ -1482,7 +1482,7 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
tls.factors.resize(orig_data.positions.size());
@ -1648,7 +1648,7 @@ static void calc_sharpen_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int node_index) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[node_index]);
const Span<int> verts = nodes[node_index].verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
tls.factors.resize(verts.size());
@ -1724,7 +1724,7 @@ static void calc_sharpen_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int node_index) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[node_index]);
const Span<int> grids = nodes[node_index].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(positions.size());
@ -1905,7 +1905,7 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
@ -1937,7 +1937,7 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
@ -2017,7 +2017,7 @@ static void calc_erase_displacement_filter(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
@ -2132,7 +2132,7 @@ static void mesh_filter_sharpen_init(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.vert_neighbors.resize(verts.size());
const MutableSpan<Vector<int>> neighbors = tls.vert_neighbors;
@ -2158,7 +2158,7 @@ static void mesh_filter_sharpen_init(const Depsgraph &depsgraph,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.smooth_directions.resize(grid_verts_num);

View File

@ -25,7 +25,7 @@ Span<int> node_visible_verts(const bke::pbvh::MeshNode &node,
if (BKE_pbvh_node_fully_hidden_get(node)) {
return {};
}
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
if (hide_vert.is_empty()) {
return verts;
}

View File

@ -96,7 +96,7 @@ static void init_mask_grids(Main &bmain,
undo::push_nodes(depsgraph, object, node_mask, undo::Type::Mask);
node_mask.foreach_index(GrainSize(1), [&](const int i) {
for (const int grid : bke::pbvh::node_grid_indices(nodes[i])) {
for (const int grid : nodes[i].grids()) {
write_fn(grid_hidden, grid, grids[grid]);
}
BKE_pbvh_node_mark_update_mask(nodes[i]);

View File

@ -974,7 +974,7 @@ static void bake_mask_mesh(const Depsgraph &depsgraph,
const MutableSpan<float> mask)
{
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -1008,7 +1008,7 @@ static void bake_mask_grids(const Depsgraph &depsgraph,
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
tls.factors.resize(grid_verts_num);

View File

@ -274,7 +274,7 @@ static void do_color_smooth_task(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -359,7 +359,7 @@ static void do_paint_brush_task(const Depsgraph &depsgraph,
const float bstrength = fabsf(ss.cache->bstrength);
const float alpha = BKE_brush_alpha_get(ss.scene, &brush);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -499,7 +499,7 @@ static void do_sample_wet_paint_task(const Object &object,
const SculptSession &ss = *object.sculpt;
const float radius = ss.cache->radius * brush.wet_paint_radius_factor;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -689,7 +689,7 @@ static void do_smear_brush_task(const Depsgraph &depsgraph,
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const float strength = ss.cache->bstrength;
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@ -894,7 +894,7 @@ void do_smear_brush(const Depsgraph &depsgraph,
else {
/* Smear mode. */
node_mask.foreach_index(GrainSize(1), [&](const int i) {
for (const int vert : bke::pbvh::node_unique_verts(nodes[i])) {
for (const int vert : nodes[i].verts()) {
ss.cache->paint_brush.prev_colors[vert] = color_vert_get(faces,
corner_verts,
vert_to_face_map,

View File

@ -167,7 +167,7 @@ static void calc_mesh(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const Span<float3> positions = gather_data_mesh(positions_eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
@ -218,7 +218,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const StrokeCache &cache = *ss.cache;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
@ -396,7 +396,7 @@ static void grow_factors_grids(const ePaintSymmetryFlags symm,
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<CCGElem *> elems = subdiv_ccg.grids;
const BitGroupVector<> &grid_hidden = subdiv_ccg.grid_hidden;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
for (const int i : grids.index_range()) {
const int grid = grids[i];

View File

@ -55,7 +55,7 @@ static void apply_projection_mesh(const Depsgraph &depsgraph,
{
Mesh &mesh = *static_cast<Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
const MutableSpan normals = gather_data_mesh(vert_normals, verts, tls.normals);
@ -83,7 +83,7 @@ static void apply_projection_grids(const Sculpt &sd,
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.normals.resize(positions.size());

View File

@ -785,7 +785,7 @@ void blur_geometry_data_array(const Object &object,
threading::parallel_for(node_mask.index_range(), 1, [&](const IndexRange range) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int node_index) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[node_index]);
const Span<int> grids = nodes[node_index].grids();
const int grid_verts_num = key.grid_area * grids.size();
tls.new_factors.resize(grid_verts_num);

View File

@ -199,7 +199,7 @@ static void transform_node_mesh(const Depsgraph &depsgraph,
{
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const OrigPositionData orig_data = orig_position_data_get_mesh(object, node);
tls.factors.resize(verts.size());
@ -227,7 +227,7 @@ static void transform_node_grids(const Sculpt &sd,
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const int grid_verts_num = grids.size() * key.grid_area;
const OrigPositionData orig_data = orig_position_data_get_grids(object, node);
@ -371,7 +371,7 @@ static void elastic_transform_node_mesh(const Depsgraph &depsgraph,
{
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
const MutableSpan positions = gather_data_mesh(positions_eval, verts, tls.positions);
/* TODO: Using the factors array is unnecessary when there are no hidden vertices and no mask. */
@ -401,7 +401,7 @@ static void elastic_transform_node_grids(const Sculpt &sd,
SculptSession &ss = *object.sculpt;
SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
const Span<int> grids = bke::pbvh::node_grid_indices(node);
const Span<int> grids = node.grids();
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
/* TODO: Using the factors array is unnecessary when there are no hidden vertices and no mask. */
@ -690,7 +690,7 @@ static float3 average_unmasked_position(const Depsgraph &depsgraph,
LocalData &tls = all_tls.local();
threading::isolate_task([&]() {
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
tls.positions.resize(verts.size());
const MutableSpan<float3> positions = tls.positions;
@ -719,7 +719,7 @@ static float3 average_unmasked_position(const Depsgraph &depsgraph,
[&](const IndexRange range, AveragePositionAccumulation sum) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const MutableSpan positions = gather_grids_positions(
subdiv_ccg, grids, tls.positions);
@ -812,7 +812,7 @@ static float3 average_mask_border_position(const Depsgraph &depsgraph,
[&](const IndexRange range, AveragePositionAccumulation sum) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> verts = bke::pbvh::node_unique_verts(nodes[i]);
const Span<int> verts = nodes[i].verts();
MutableSpan positions = gather_data_mesh(vert_positions, verts, tls.positions);
MutableSpan masks = gather_data_mesh(mask_attr, verts, tls.masks);
@ -840,7 +840,7 @@ static float3 average_mask_border_position(const Depsgraph &depsgraph,
[&](const IndexRange range, AveragePositionAccumulation sum) {
LocalData &tls = all_tls.local();
node_mask.slice(range).foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
const MutableSpan positions = gather_grids_positions(
subdiv_ccg, grids, tls.positions);

View File

@ -1007,7 +1007,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
restore_position_grids(grids, key, *unode, modified_grids);
}
node_mask.foreach_index([&](const int i) {
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const Span<int> grids = nodes[i].grids();
if (indices_contain_true(modified_grids, grids)) {
BKE_pbvh_node_mark_positions_update(nodes[i]);
}
@ -1022,7 +1022,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
Array<bool> modified_verts(ss.totvert, false);
restore_position_mesh(object, step_data.nodes, modified_verts);
node_mask.foreach_index([&](const int i) {
if (indices_contain_true(modified_verts, bke::pbvh::node_verts(nodes[i]))) {
if (indices_contain_true(modified_verts, nodes[i].all_verts())) {
BKE_pbvh_node_mark_positions_update(nodes[i]);
}
});
@ -1054,7 +1054,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
restore_vert_visibility_grids(subdiv_ccg, *unode, modified_grids);
}
node_mask.foreach_index([&](const int i) {
if (indices_contain_true(modified_grids, bke::pbvh::node_grid_indices(nodes[i]))) {
if (indices_contain_true(modified_grids, nodes[i].grids())) {
BKE_pbvh_node_mark_update_visibility(nodes[i]);
}
});
@ -1066,7 +1066,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
restore_vert_visibility_mesh(object, *unode, modified_verts);
}
node_mask.foreach_index([&](const int i) {
if (indices_contain_true(modified_verts, bke::pbvh::node_verts(nodes[i]))) {
if (indices_contain_true(modified_verts, nodes[i].all_verts())) {
BKE_pbvh_node_mark_update_visibility(nodes[i]);
}
});
@ -1109,7 +1109,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
else {
MutableSpan<bke::pbvh::MeshNode> nodes = ss.pbvh->nodes<bke::pbvh::MeshNode>();
node_mask.foreach_index([&](const int i) {
const Span<int> faces = bke::pbvh::node_faces(nodes[i]);
const Span<int> faces = nodes[i].faces();
if (indices_contain_true(modified_faces, faces)) {
BKE_pbvh_node_mark_update_visibility(nodes[i]);
}
@ -1136,7 +1136,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
restore_mask_grids(object, *unode, modified_grids);
}
node_mask.foreach_index([&](const int i) {
if (indices_contain_true(modified_grids, bke::pbvh::node_grid_indices(nodes[i]))) {
if (indices_contain_true(modified_grids, nodes[i].grids())) {
BKE_pbvh_node_mark_update_mask(nodes[i]);
}
});
@ -1148,7 +1148,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
restore_mask_mesh(object, *unode, modified_verts);
}
node_mask.foreach_index([&](const int i) {
if (indices_contain_true(modified_verts, bke::pbvh::node_verts(nodes[i]))) {
if (indices_contain_true(modified_verts, nodes[i].all_verts())) {
BKE_pbvh_node_mark_update_mask(nodes[i]);
}
});
@ -1186,7 +1186,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
else {
MutableSpan<bke::pbvh::MeshNode> nodes = ss.pbvh->nodes<bke::pbvh::MeshNode>();
node_mask.foreach_index([&](const int i) {
const Span<int> faces = bke::pbvh::node_faces(nodes[i]);
const Span<int> faces = nodes[i].faces();
if (indices_contain_true(modified_faces, faces)) {
BKE_pbvh_node_mark_update_face_sets(nodes[i]);
}
@ -1207,7 +1207,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
Array<bool> modified_verts(ss.totvert, false);
restore_color(object, step_data, modified_verts);
node_mask.foreach_index([&](const int i) {
if (indices_contain_true(modified_verts, bke::pbvh::node_verts(nodes[i]))) {
if (indices_contain_true(modified_verts, nodes[i].all_verts())) {
BKE_pbvh_node_mark_update_color(nodes[i]);
}
});
@ -1280,7 +1280,7 @@ static void store_vert_visibility_grids(const SubdivCCG &subdiv_ccg,
return;
}
const Span<int> grid_indices = bke::pbvh::node_grid_indices(node);
const Span<int> grid_indices = node.grids();
unode.grid_hidden = BitGroupVector<0>(grid_indices.size(), grid_hidden.group_size());
for (const int i : grid_indices.index_range()) {
unode.grid_hidden[i].copy_from(grid_hidden[grid_indices[i]]);
@ -1343,7 +1343,7 @@ static void store_vert_visibility_mesh(const Mesh &mesh, const bke::pbvh::Node &
return;
}
const Span<int> verts = bke::pbvh::node_verts(static_cast<const bke::pbvh::MeshNode &>(node));
const Span<int> verts = static_cast<const bke::pbvh::MeshNode &>(node).all_verts();
for (const int i : verts.index_range()) {
unode.vert_hidden[i].set(hide_vert[verts[i]]);
}
@ -1403,13 +1403,13 @@ static void store_color(const Mesh &mesh, const bke::pbvh::MeshNode &node, Node
/* NOTE: even with loop colors we still store (derived)
* vertex colors for original data lookup. */
const Span<int> verts = bke::pbvh::node_unique_verts(node);
const Span<int> verts = node.verts();
unode.col.reinitialize(verts.size());
color::gather_colors_vert(
faces, corner_verts, vert_to_face_map, colors, color_attribute.domain, verts, unode.col);
if (color_attribute.domain == bke::AttrDomain::Corner) {
for (const int face : bke::pbvh::node_faces(node)) {
for (const int face : node.faces()) {
for (const int corner : faces[face]) {
unode.corner_indices.append(corner);
}
@ -1460,14 +1460,14 @@ static void fill_node_data_mesh(const Depsgraph &depsgraph,
const SculptSession &ss = *object.sculpt;
const Mesh &mesh = *static_cast<Mesh *>(object.data);
unode.vert_indices = bke::pbvh::node_verts(node);
unode.unique_verts_num = bke::pbvh::node_unique_verts(node).size();
unode.vert_indices = node.all_verts();
unode.unique_verts_num = node.verts().size();
const int verts_num = unode.vert_indices.size();
const bool need_faces = ELEM(type, Type::FaceSet, Type::HideFace);
if (need_faces) {
unode.face_indices = bke::pbvh::node_faces(node);
unode.face_indices = node.faces();
}
switch (type) {
@ -1530,7 +1530,7 @@ static void fill_node_data_grids(const Object &object,
const Mesh &base_mesh = *static_cast<const Mesh *>(object.data);
const SubdivCCG &subdiv_ccg = *ss.subdiv_ccg;
unode.grids = bke::pbvh::node_grid_indices(node);
unode.grids = node.grids();
const int grid_area = subdiv_ccg.grid_size * subdiv_ccg.grid_size;
const int verts_num = unode.grids.size() * grid_area;