diff options
author | Hans Goudey <h.goudey@me.com> | 2022-11-08 21:31:11 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-11-08 21:32:10 +0300 |
commit | 66dda2b902f0e2d1ee4a6d956ae5144743f7df2d (patch) | |
tree | d4657c78028532042deabf8923be87ff01d2e4eb | |
parent | fd352160253c57f14e9ce5aaf8009305fd8bc63d (diff) |
Fix T102003: Spline parameter length wrong for NURBS
The node has always be a bit confusing for the NURBS case, since it
uses the distance between control points since the evaluated/control
point mapping isn't obvious, but it also went above 1, which wasn't
correct.
Instead, retrieve the total length from the point lengths calculated
in the previous step. The results should be the same for other curve
types.
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc | 3 |
1 files changed, 1 insertions, 2 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 3dc89a9058e..159a4661df0 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 @@ -117,9 +117,8 @@ static VArray<float> construct_curve_parameter_varray(const bke::CurvesGeometry threading::parallel_for(curves.curves_range(), 1024, [&](IndexRange range) { for (const int i_curve : range) { - const float total_length = curves.evaluated_length_total_for_curve(i_curve, - cyclic[i_curve]); MutableSpan<float> curve_lengths = lengths.slice(curves.points_for_curve(i_curve)); + const float total_length = curve_lengths.last(); if (total_length > 0.0f) { const float factor = 1.0f / total_length; for (float &value : curve_lengths) { |