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:
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
index a303be99242..3edaccba506 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
@@ -100,18 +100,22 @@ static Array<float> curve_length_point_domain(const CurveEval &curve)
MutableSpan spline_factors{lengths.as_mutable_span().slice(offsets[i], spline.size())};
spline_factors.first() = 0.0f;
switch (splines[i]->type()) {
- case Spline::Type::Bezier: {
+ case CURVE_TYPE_BEZIER: {
calculate_bezier_lengths(static_cast<const BezierSpline &>(spline), spline_factors);
break;
}
- case Spline::Type::Poly: {
+ case CURVE_TYPE_POLY: {
calculate_poly_length(static_cast<const PolySpline &>(spline), spline_factors);
break;
}
- case Spline::Type::NURBS: {
+ case CURVE_TYPE_NURBS: {
calculate_nurbs_lengths(static_cast<const NURBSpline &>(spline), spline_factors);
break;
}
+ case CURVE_TYPE_CATMULL_ROM: {
+ BLI_assert_unreachable();
+ break;
+ }
}
}
});
@@ -201,8 +205,9 @@ class CurveParameterFieldInput final : public GeometryFieldInput {
{
if (component.type() == GEO_COMPONENT_TYPE_CURVE) {
const CurveComponent &curve_component = static_cast<const CurveComponent &>(component);
- const CurveEval *curve = curve_component.get_for_read();
- if (curve) {
+ if (curve_component.has_curves()) {
+ const std::unique_ptr<CurveEval> curve = curves_to_curve_eval(
+ *curve_component.get_for_read());
return construct_curve_parameter_varray(*curve, mask, domain);
}
}
@@ -234,8 +239,8 @@ class CurveLengthFieldInput final : public GeometryFieldInput {
{
if (component.type() == GEO_COMPONENT_TYPE_CURVE) {
const CurveComponent &curve_component = static_cast<const CurveComponent &>(component);
- const CurveEval *curve = curve_component.get_for_read();
- if (curve) {
+ if (curve_component.has_curves()) {
+ std::unique_ptr<CurveEval> curve = curves_to_curve_eval(*curve_component.get_for_read());
return construct_curve_length_varray(*curve, mask, domain);
}
}
@@ -267,8 +272,9 @@ class IndexOnSplineFieldInput final : public GeometryFieldInput {
{
if (component.type() == GEO_COMPONENT_TYPE_CURVE) {
const CurveComponent &curve_component = static_cast<const CurveComponent &>(component);
- const CurveEval *curve = curve_component.get_for_read();
- if (curve) {
+ if (curve_component.has_curves()) {
+ const std::unique_ptr<CurveEval> curve = curves_to_curve_eval(
+ *curve_component.get_for_read());
return construct_index_on_spline_varray(*curve, mask, domain);
}
}