[Bf-blender-cvs] [66dda2b902f] blender-v3.4-release: Fix T102003: Spline parameter length wrong for NURBS

Hans Goudey noreply at git.blender.org
Tue Nov 8 19:32:53 CET 2022


Commit: 66dda2b902f0e2d1ee4a6d956ae5144743f7df2d
Author: Hans Goudey
Date:   Tue Nov 8 12:31:11 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rB66dda2b902f0e2d1ee4a6d956ae5144743f7df2d

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.

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

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



More information about the Bf-blender-cvs mailing list