Geometry Nodes: fix spline length node after recent refactor
Differential Revision: https://developer.blender.org/D14276
This commit is contained in:
parent
7bd3762b7c
commit
5791835678
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue