diff options
author | Hans Goudey <h.goudey@me.com> | 2021-10-13 22:28:05 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-10-13 22:28:05 +0300 |
commit | 1ae79b704a6f38adb1b5dfa35ed3f1e338a05f33 (patch) | |
tree | 228b857bcae85fe813fdc2902b352b9d57ced21b /source/blender | |
parent | 10abaf3ddf08fc891cb7b7ce98bb2166bb1b9f14 (diff) |
Fix T92180: Curve subdivide incorrect result for poly splines
The node shifted all new points forward in the spline, so the first
point would appear to be removed.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc index 99379ab7259..0d934108738 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc @@ -63,9 +63,9 @@ static void subdivide_attribute(Span<T> src, for (const int i : range) { const int cuts = offsets[i + 1] - offsets[i]; dst[offsets[i]] = src[i]; - const float factor_delta = 1.0f / (cuts + 1.0f); + const float factor_delta = cuts == 0 ? 1.0f : 1.0f / cuts; for (const int cut : IndexRange(cuts)) { - const float factor = (cut + 1) * factor_delta; + const float factor = cut * factor_delta; dst[offsets[i] + cut] = attribute_math::mix2(factor, src[i], src[i + 1]); } } @@ -75,9 +75,9 @@ static void subdivide_attribute(Span<T> src, const int i = src_size - 1; const int cuts = offsets[i + 1] - offsets[i]; dst[offsets[i]] = src.last(); - const float factor_delta = 1.0f / (cuts + 1.0f); + const float factor_delta = cuts == 0 ? 1.0f : 1.0f / cuts; for (const int cut : IndexRange(cuts)) { - const float factor = (cut + 1) * factor_delta; + const float factor = cut * factor_delta; dst[offsets[i] + cut] = attribute_math::mix2(factor, src.last(), src.first()); } } |