From fa0ee288268bf1ac8083faff77fc3c53e033340a Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Sun, 21 Jun 2020 14:40:49 +0100 Subject: [PATCH] Check if point's index exists before adding it to the list of points that need to split faces when avoiding creating degenerate faces while merging CSG faces. --- modules/csg/csg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index 440019ed843..54b913711ad 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -905,8 +905,10 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector &p_segment_ vertices[p_segment_indices[closest_idx]].point }; if (are_segements_parallel(edge1, edge2, vertex_snap2)) { - degenerate_points.push_back(outer_edge_idx[0]); - degenerate_points.push_back(outer_edge_idx[1]); + if (!degenerate_points.find(outer_edge_idx[0])) + degenerate_points.push_back(outer_edge_idx[0]); + if (!degenerate_points.find(outer_edge_idx[1])) + degenerate_points.push_back(outer_edge_idx[1]); continue; }