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:
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
index f952e15fbbe..c3d87055745 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
@@ -25,13 +25,16 @@ static VArray<float> construct_spline_length_gvarray(const CurveComponent &compo
const std::unique_ptr<CurveEval> curve = curves_to_curve_eval(*component.get_for_read());
Span<SplinePtr> splines = curve->splines();
- auto length_fn = [splines](int i) { return splines[i]->length(); };
+ Array<float> spline_lenghts(splines.size());
+ for (const int i : splines.index_range()) {
+ spline_lenghts[i] = splines[i]->length();
+ }
if (domain == ATTR_DOMAIN_CURVE) {
- return VArray<float>::ForFunc(splines.size(), length_fn);
+ return VArray<float>::ForContainer(std::move(spline_lenghts));
}
if (domain == ATTR_DOMAIN_POINT) {
- VArray<float> length = VArray<float>::ForFunc(splines.size(), length_fn);
+ VArray<float> length = VArray<float>::ForContainer(std::move(spline_lenghts));
return component.attribute_try_adapt_domain<float>(
std::move(length), ATTR_DOMAIN_CURVE, ATTR_DOMAIN_POINT);
}