From ddc52f2e1d0d15c2176c54691dbc24c549453c3b Mon Sep 17 00:00:00 2001 From: Leon Schittek Date: Fri, 18 Feb 2022 11:25:25 -0600 Subject: Fix: Curve to Mesh node creates caps when curve is cyclic The "Fill Caps" option on the Curve to Mesh node introduced in rBbc2f4dd8b408ee makes it possible to fill the open ends of the sweep to create a manifold mesh. This patch fixes an edge case, where caps were created even when the rail curve (the curve used in the "Curve" input socket) was cyclic making the resulting mesh non-manifold. Differential Revision: https://developer.blender.org/D14124 --- source/blender/blenkernel/intern/curve_to_mesh_convert.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern/curve_to_mesh_convert.cc') diff --git a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc index 833b2fe99ec..097414cced1 100644 --- a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc +++ b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc @@ -186,7 +186,8 @@ static void spline_extrude_to_mesh_data(const ResultInfo &info, } } - if (fill_caps && profile.is_cyclic()) { + const bool has_caps = fill_caps && profile.is_cyclic() && !spline.is_cyclic(); + if (has_caps) { const int poly_size = info.spline_edge_len * info.profile_edge_len; const int cap_loop_offset = info.loop_offset + poly_size * 4; const int cap_poly_offset = info.poly_offset + poly_size; @@ -270,7 +271,8 @@ static inline int spline_extrude_loop_size(const Spline &curve, const bool fill_caps) { const int tube = curve.evaluated_edges_size() * profile.evaluated_edges_size() * 4; - const int caps = (fill_caps && profile.is_cyclic()) ? profile.evaluated_edges_size() * 2 : 0; + const bool has_caps = fill_caps && profile.is_cyclic() && !curve.is_cyclic(); + const int caps = has_caps ? profile.evaluated_edges_size() * 2 : 0; return tube + caps; } @@ -279,7 +281,8 @@ static inline int spline_extrude_poly_size(const Spline &curve, const bool fill_caps) { const int tube = curve.evaluated_edges_size() * profile.evaluated_edges_size(); - const int caps = (fill_caps && profile.is_cyclic()) ? 2 : 0; + const bool has_caps = fill_caps && profile.is_cyclic() && !curve.is_cyclic(); + const int caps = has_caps ? 2 : 0; return tube + caps; } -- cgit v1.2.3