[Bf-blender-cvs] [1ae79b704a6] master: Fix T92180: Curve subdivide incorrect result for poly splines
Hans Goudey
noreply at git.blender.org
Wed Oct 13 21:28:12 CEST 2021
Commit: 1ae79b704a6f38adb1b5dfa35ed3f1e338a05f33
Author: Hans Goudey
Date: Wed Oct 13 14:28:05 2021 -0500
Branches: master
https://developer.blender.org/rB1ae79b704a6f38adb1b5dfa35ed3f1e338a05f33
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.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc
===================================================================
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());
}
}
More information about the Bf-blender-cvs
mailing list