diff options
author | Jacques Lucke <jacques@blender.org> | 2022-09-29 14:32:03 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-10-03 15:59:17 +0300 |
commit | 66853162d5d0920cc2f2638d8355d013bc0b1408 (patch) | |
tree | 6819da793325193d02ed03ba7e02e66a5298ccb5 | |
parent | c1c66c7b577b1b2fd076254246677600afe4c1d2 (diff) |
Fix: Spline Parameter node produces NaN when curve is a single point
Issue found in file from T101256.
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc index 6fe806adb7c..00d3129a63d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc @@ -126,6 +126,10 @@ static VArray<float> construct_curve_parameter_varray(const bke::CurvesGeometry value *= factor; } } + else if (curve_lengths.size() == 1) { + /* The curve is a single point. */ + curve_lengths[0] = 0.0f; + } else { /* It is arbitrary what to do in those rare cases when all the points are * in the same position. In this case we are just arbitrarily giving a valid |