diff options
author | Jacques Lucke <jacques@blender.org> | 2022-03-08 18:09:44 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-03-08 18:09:44 +0300 |
commit | 5791835678067b5656469647990d769249065ee1 (patch) | |
tree | 829832ee0317c1dd858a79a5c61d599be827ef30 /source/blender/nodes | |
parent | 7bd3762b7cfc13336b08ac5915e21f1842b7ba24 (diff) |
Geometry Nodes: fix spline length node after recent refactor
Differential Revision: https://developer.blender.org/D14276
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc | 9 |
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); } |