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.
This commit is contained in:
2022-11-08 12:31:11 -06:00
parent fd35216025
commit 66dda2b902

View File

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