[Bf-blender-cvs] [85875455b91] master: Fix T101872: Curves sculpt deform node crash with changed curve count

Hans Goudey noreply at git.blender.org
Tue Oct 18 00:08:27 CEST 2022


Commit: 85875455b9171a602f57102bb4575f6e2c2a9b7f
Author: Hans Goudey
Date:   Mon Oct 17 17:08:09 2022 -0500
Branches: master
https://developer.blender.org/rB85875455b9171a602f57102bb4575f6e2c2a9b7f

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.

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc

===================================================================

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();



More information about the Bf-blender-cvs mailing list