diff options
author | Hans Goudey <h.goudey@me.com> | 2022-10-18 01:08:09 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-10-18 01:08:09 +0300 |
commit | 85875455b9171a602f57102bb4575f6e2c2a9b7f (patch) | |
tree | 99709e1031dd72041bd6f49598b27377f109f2b8 /source/blender/nodes/geometry | |
parent | 161aa5e0d039577964d7080817e3df229aa153c0 (diff) |
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.
Diffstat (limited to 'source/blender/nodes/geometry')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc index a12ae9bbb92..0932624bdc3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc @@ -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(); |