Fix: Spline Parameter node produces NaN when curve is a single point

Issue found in file from T101256.
This commit is contained in:
Jacques Lucke 2022-09-29 13:32:03 +02:00
parent ffccdf069b
commit b70b02ee42
Notes: blender-bot 2023-02-13 14:26:44 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #101256, Regression: Trim Curve Node Crash
1 changed files with 4 additions and 0 deletions

View File

@ -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