[Bf-blender-cvs] [ddc52f2e1d0] blender-v3.1-release: Fix: Curve to Mesh node creates caps when curve is cyclic

Leon Schittek noreply at git.blender.org
Fri Feb 18 18:28:31 CET 2022


Commit: ddc52f2e1d0d15c2176c54691dbc24c549453c3b
Author: Leon Schittek
Date:   Fri Feb 18 11:25:25 2022 -0600
Branches: blender-v3.1-release
https://developer.blender.org/rBddc52f2e1d0d15c2176c54691dbc24c549453c3b

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

===================================================================

M	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;
 }



More information about the Bf-blender-cvs mailing list