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:
authorHans Goudey <h.goudey@me.com>2022-03-16 00:22:36 +0300
committerHans Goudey <h.goudey@me.com>2022-03-16 00:22:36 +0300
commit379bd6d50ce37e07cbc4fb1e1c47c814f6a7530e (patch)
tree2eddb1b42015e25bcf517c688d0c55a150a1661e /source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
parentd8e3bcf770c25b0780b2c35a72afae00171ba914 (diff)
Curves: Port count spline length output to new data-block
This fixes T96487 in a similar way to 5791835678067b56, and also removes the conversion to old curve type for the "Point Count" output.
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc11
1 files changed, 6 insertions, 5 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 c3d87055745..197cb6e6852 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
@@ -2,6 +2,7 @@
#include "node_geometry_util.hh"
+#include "BKE_curves.hh"
#include "BKE_spline.hh"
namespace blender::nodes::node_geo_input_spline_length_cc {
@@ -82,16 +83,16 @@ static VArray<int> construct_spline_count_gvarray(const CurveComponent &componen
if (!component.has_curves()) {
return {};
}
- const std::unique_ptr<CurveEval> curve = curves_to_curve_eval(*component.get_for_read());
+ const Curves &curves_id = *component.get_for_read();
+ const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry);
- Span<SplinePtr> splines = curve->splines();
- auto count_fn = [splines](int i) { return splines[i]->size(); };
+ auto count_fn = [curves](int64_t i) { return curves.range_for_curve(i).size(); };
if (domain == ATTR_DOMAIN_CURVE) {
- return VArray<int>::ForFunc(splines.size(), count_fn);
+ return VArray<int>::ForFunc(curves.curves_size(), count_fn);
}
if (domain == ATTR_DOMAIN_POINT) {
- VArray<int> count = VArray<int>::ForFunc(splines.size(), count_fn);
+ VArray<int> count = VArray<int>::ForFunc(curves.curves_size(), count_fn);
return component.attribute_try_adapt_domain<int>(
std::move(count), ATTR_DOMAIN_CURVE, ATTR_DOMAIN_POINT);
}