From 5791835678067b5656469647990d769249065ee1 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 8 Mar 2022 16:09:44 +0100 Subject: Geometry Nodes: fix spline length node after recent refactor Differential Revision: https://developer.blender.org/D14276 --- .../blender/nodes/geometry/nodes/node_geo_input_spline_length.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source') 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 construct_spline_length_gvarray(const CurveComponent &compo const std::unique_ptr curve = curves_to_curve_eval(*component.get_for_read()); Span splines = curve->splines(); - auto length_fn = [splines](int i) { return splines[i]->length(); }; + Array spline_lenghts(splines.size()); + for (const int i : splines.index_range()) { + spline_lenghts[i] = splines[i]->length(); + } if (domain == ATTR_DOMAIN_CURVE) { - return VArray::ForFunc(splines.size(), length_fn); + return VArray::ForContainer(std::move(spline_lenghts)); } if (domain == ATTR_DOMAIN_POINT) { - VArray length = VArray::ForFunc(splines.size(), length_fn); + VArray length = VArray::ForContainer(std::move(spline_lenghts)); return component.attribute_try_adapt_domain( std::move(length), ATTR_DOMAIN_CURVE, ATTR_DOMAIN_POINT); } -- cgit v1.2.3