[Bf-blender-cvs] [b70b02ee429] master: Fix: Spline Parameter node produces NaN when curve is a single point

Jacques Lucke noreply at git.blender.org
Thu Sep 29 13:32:14 CEST 2022


Commit: b70b02ee429d323a83c2e90e189a753bcabe0bf5
Author: Jacques Lucke
Date:   Thu Sep 29 13:32:03 2022 +0200
Branches: master
https://developer.blender.org/rBb70b02ee429d323a83c2e90e189a753bcabe0bf5

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

Issue found in file from T101256.

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

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

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

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



More information about the Bf-blender-cvs mailing list