Cleanup: Sculpt: Use specific node types for original data access

This already exposes one place where we used the wrong function.
This commit is contained in:
Hans Goudey
2024-09-03 11:13:52 -04:00
parent aaf445830c
commit fc7de7c92f
3 changed files with 9 additions and 7 deletions

View File

@@ -215,7 +215,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_grids(
LocalData &tls = all_tls.local();
const Span<int> grids = bke::pbvh::node_grid_indices(nodes[i]);
const MutableSpan positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
const Span<float> factors = all_factors.as_span().slice(node_offsets[pos]);
tls.average_positions.resize(positions.size());

View File

@@ -718,14 +718,16 @@ struct OrigPositionData {
* Retrieve positions from the latest undo state. This is often used for modal actions that depend
* on the initial state of the geometry from before the start of the action.
*/
OrigPositionData orig_position_data_get_mesh(const Object &object, const bke::pbvh::Node &node);
OrigPositionData orig_position_data_get_grids(const Object &object, const bke::pbvh::Node &node);
OrigPositionData orig_position_data_get_mesh(const Object &object,
const bke::pbvh::MeshNode &node);
OrigPositionData orig_position_data_get_grids(const Object &object,
const bke::pbvh::GridsNode &node);
void orig_position_data_gather_bmesh(const BMLog &bm_log,
const Set<BMVert *, 0> &verts,
MutableSpan<float3> positions,
MutableSpan<float3> normals);
Span<float4> orig_color_data_get_mesh(const Object &object, const bke::pbvh::Node &node);
Span<float4> orig_color_data_get_mesh(const Object &object, const bke::pbvh::MeshNode &node);
}

View File

@@ -2125,7 +2125,7 @@ void push_multires_mesh_end(bContext *C, const char *str)
namespace blender::ed::sculpt_paint {
OrigPositionData orig_position_data_get_mesh(const Object & /*object*/,
const bke::pbvh::Node &node)
const bke::pbvh::MeshNode &node)
{
const undo::Node *unode = undo::get_node(&node, undo::Type::Position);
return {unode->position.as_span().take_front(unode->unique_verts_num),
@@ -2133,7 +2133,7 @@ OrigPositionData orig_position_data_get_mesh(const Object & /*object*/,
}
OrigPositionData orig_position_data_get_grids(const Object & /*object*/,
const bke::pbvh::Node &node)
const bke::pbvh::GridsNode &node)
{
const undo::Node *unode = undo::get_node(&node, undo::Type::Position);
return {unode->position.as_span(), unode->normal.as_span()};
@@ -2159,7 +2159,7 @@ void orig_position_data_gather_bmesh(const BMLog &bm_log,
}
}
Span<float4> orig_color_data_get_mesh(const Object & /*object*/, const bke::pbvh::Node &node)
Span<float4> orig_color_data_get_mesh(const Object & /*object*/, const bke::pbvh::MeshNode &node)
{
const undo::Node *unode = undo::get_node(&node, undo::Type::Color);
return unode->col.as_span();