diff options
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc index 94425ab48f4..24d72ad553b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc @@ -394,9 +394,9 @@ static void update_bezier_positions(const FilletData &fd, dst_spline.handle_positions_left()[end_i] = dst_spline.positions()[end_i] - handle_length * next_dir; dst_spline.handle_types_right()[i_dst] = dst_spline.handle_types_left()[end_i] = - BezierSpline::HandleType::Align; + BEZIER_HANDLE_ALIGN; dst_spline.handle_types_left()[i_dst] = dst_spline.handle_types_right()[end_i] = - BezierSpline::HandleType::Vector; + BEZIER_HANDLE_VECTOR; dst_spline.mark_cache_invalid(); /* Calculate the center of the radius to be formed. */ @@ -406,8 +406,8 @@ static void update_bezier_positions(const FilletData &fd, float radius; radius_vec = math::normalize_and_get_length(radius_vec, radius); - dst_spline.handle_types_right().slice(1, count - 2).fill(BezierSpline::HandleType::Align); - dst_spline.handle_types_left().slice(1, count - 2).fill(BezierSpline::HandleType::Align); + dst_spline.handle_types_right().slice(1, count - 2).fill(BEZIER_HANDLE_ALIGN); + dst_spline.handle_types_left().slice(1, count - 2).fill(BEZIER_HANDLE_ALIGN); /* For each of the vertices in between the end points. */ for (const int j : IndexRange(1, count - 2)) { @@ -512,12 +512,12 @@ static SplinePtr fillet_spline(const Spline &spline, copy_common_attributes_by_mapping(spline, *dst_spline_ptr, dst_to_src); switch (spline.type()) { - case Spline::Type::Bezier: { + case CURVE_TYPE_BEZIER: { const BezierSpline &src_spline = static_cast<const BezierSpline &>(spline); BezierSpline &dst_spline = static_cast<BezierSpline &>(*dst_spline_ptr); if (fillet_param.mode == GEO_NODE_CURVE_FILLET_POLY) { - dst_spline.handle_types_left().fill(BezierSpline::HandleType::Vector); - dst_spline.handle_types_right().fill(BezierSpline::HandleType::Vector); + dst_spline.handle_types_left().fill(BEZIER_HANDLE_VECTOR); + dst_spline.handle_types_right().fill(BEZIER_HANDLE_VECTOR); update_poly_positions(fd, dst_spline, src_spline, point_counts); } else { @@ -525,17 +525,21 @@ static SplinePtr fillet_spline(const Spline &spline, } break; } - case Spline::Type::Poly: { + case CURVE_TYPE_POLY: { update_poly_positions(fd, *dst_spline_ptr, spline, point_counts); break; } - case Spline::Type::NURBS: { + case CURVE_TYPE_NURBS: { const NURBSpline &src_spline = static_cast<const NURBSpline &>(spline); NURBSpline &dst_spline = static_cast<NURBSpline &>(*dst_spline_ptr); copy_attribute_by_mapping(src_spline.weights(), dst_spline.weights(), dst_to_src); update_poly_positions(fd, dst_spline, src_spline, point_counts); break; } + case CURVE_TYPE_CATMULL_ROM: { + BLI_assert_unreachable(); + break; + } } return dst_spline_ptr; @@ -568,7 +572,7 @@ static void calculate_curve_fillet(GeometrySet &geometry_set, const std::optional<Field<int>> &count_field, const bool limit_radius) { - if (!geometry_set.has_curve()) { + if (!geometry_set.has_curves()) { return; } @@ -599,10 +603,10 @@ static void calculate_curve_fillet(GeometrySet &geometry_set, fillet_param.limit_radius = limit_radius; - const CurveEval &input_curve = *geometry_set.get_curve_for_read(); - std::unique_ptr<CurveEval> output_curve = fillet_curve(input_curve, fillet_param); + const std::unique_ptr<CurveEval> input_curve = curves_to_curve_eval(*component.get_for_read()); + std::unique_ptr<CurveEval> output_curve = fillet_curve(*input_curve, fillet_param); - geometry_set.replace_curve(output_curve.release()); + geometry_set.replace_curve(curve_eval_to_curves(*output_curve)); } static void node_geo_exec(GeoNodeExecParams params) |