Fix T101872: Curves sculpt deform node crash with changed curve count
There might be more or fewer curves in the input to the deform curves on surface node than the original, so the curve's surface UV coordinates need to be retrieved from the original curves.
This commit is contained in:
parent
161aa5e0d0
commit
85875455b9
Notes:
blender-bot
2023-02-14 08:42:53 +01:00
Referenced by issue #101872, Crash inserting a 'Deform Curves on Surface' node after a 'Duplicate Elements' (in sculptmode)
|
@ -379,19 +379,22 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
invalid_uv_count);
|
||||
/* Then also deform edit curve information for use in sculpt mode. */
|
||||
const CurvesGeometry &curves_orig = CurvesGeometry::wrap(edit_hints->curves_id_orig.geometry);
|
||||
deform_curves(curves_orig,
|
||||
*surface_mesh_orig,
|
||||
*surface_mesh_eval,
|
||||
surface_uv_coords,
|
||||
reverse_uv_sampler_orig,
|
||||
reverse_uv_sampler_eval,
|
||||
corner_normals_orig,
|
||||
corner_normals_eval,
|
||||
rest_positions,
|
||||
transforms.surface_to_curves,
|
||||
edit_hint_positions,
|
||||
edit_hint_rotations,
|
||||
invalid_uv_count);
|
||||
const Span<float2> surface_uv_coords_orig = curves_orig.surface_uv_coords();
|
||||
if (!surface_uv_coords_orig.is_empty()) {
|
||||
deform_curves(curves_orig,
|
||||
*surface_mesh_orig,
|
||||
*surface_mesh_eval,
|
||||
surface_uv_coords_orig,
|
||||
reverse_uv_sampler_orig,
|
||||
reverse_uv_sampler_eval,
|
||||
corner_normals_orig,
|
||||
corner_normals_eval,
|
||||
rest_positions,
|
||||
transforms.surface_to_curves,
|
||||
edit_hint_positions,
|
||||
edit_hint_rotations,
|
||||
invalid_uv_count);
|
||||
}
|
||||
}
|
||||
|
||||
curves.tag_positions_changed();
|
||||
|
|
Loading…
Reference in New Issue