[Bf-blender-cvs] [0a6b6eb13ba] blender-v3.0-release: Fix T94082: Curve to point empty evaluated NURBS crash

Hans Goudey noreply at git.blender.org
Tue Jan 11 09:32:59 CET 2022


Commit: 0a6b6eb13ba63ab355903296cb0c6b3afdc46225
Author: Hans Goudey
Date:   Tue Dec 14 18:57:45 2021 -0600
Branches: blender-v3.0-release
https://developer.blender.org/rB0a6b6eb13ba63ab355903296cb0c6b3afdc46225

Fix T94082: Curve to point empty evaluated NURBS crash

This is basically the same as rBee4ed99866fbb7ab04, the fix is
simply to check if the spline has evaluated points when deciding
the offsets into the result points array.

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

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

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
index 38d7fb99e87..f9eb7780873 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
@@ -78,9 +78,14 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams &params,
         return {0};
       }
       Array<int> offsets(size + 1);
-      for (const int i : offsets.index_range()) {
-        offsets[i] = count * i;
+      int offset = 0;
+      for (const int i : IndexRange(size)) {
+        offsets[i] = offset;
+        if (splines[i]->evaluated_points_size() > 0) {
+          offset += count;
+        }
       }
+      offsets.last() = offset;
       return offsets;
     }
     case GEO_NODE_CURVE_RESAMPLE_LENGTH: {
@@ -90,7 +95,9 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams &params,
       int offset = 0;
       for (const int i : IndexRange(size)) {
         offsets[i] = offset;
-        offset += splines[i]->length() / resolution + 1;
+        if (splines[i]->evaluated_points_size() > 0) {
+          offset += splines[i]->length() / resolution + 1;
+        }
       }
       offsets.last() = offset;
       return offsets;



More information about the Bf-blender-cvs mailing list