Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-09-07 17:06:25 +0300
committerJacques Lucke <jacques@blender.org>2021-09-07 17:07:18 +0300
commit73ef2fc2f4e43a56d4b6965845534cc4df76610a (patch)
tree8962c9393a458fdfdefca4d4fb3e624ead5c381c /source/blender/nodes/geometry/nodes
parent08acbdc1ff75607001f770b4281f53ec87449b7f (diff)
Fix T91093: off by one error in when resampling curve
The bug existed in the Curve Resample and Curve to Points node. Differential Revision: https://developer.blender.org/D12416
Diffstat (limited to 'source/blender/nodes/geometry/nodes')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
index 0b71a8cb03a..1382efa025b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
@@ -169,7 +169,7 @@ static std::unique_ptr<CurveEval> resample_curve(const CurveEval &input_curve,
threading::parallel_for(input_splines.index_range(), 128, [&](IndexRange range) {
for (const int i : range) {
const float length = input_splines[i]->length();
- const int count = std::max(int(length / *mode_param.length), 1);
+ const int count = std::max(int(length / *mode_param.length) + 1, 1);
output_splines[i] = resample_spline(*input_splines[i], count);
}
});
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
index 052eb92d269..17cd8e987a7 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
@@ -101,7 +101,7 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams &params,
int offset = 0;
for (const int i : IndexRange(size)) {
offsets[i] = offset;
- offset += splines[i]->length() / resolution;
+ offset += splines[i]->length() / resolution + 1;
}
offsets.last() = offset;
return offsets;