Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-12-15 03:57:45 +0300
committerHans Goudey <h.goudey@me.com>2021-12-15 03:57:45 +0300
commit67b657f07c96c5782ebf603ab36af607168d7acb (patch)
tree69b16e8b2c7cbfb2b719e73a9bb886d251136324
parent644eb68524b9fc709891860e2c0c40782325a62b (diff)
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.
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc13
1 files changed, 10 insertions, 3 deletions
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 5c12a4bf7bd..2f9dfa8158b 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
@@ -94,9 +94,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: {
@@ -106,7 +111,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;