From fa4a9c7ae61c5fcfdb08384f6f8e28b7fe090662 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Dec 2015 19:42:12 +1100 Subject: BMesh: don't use total faces to detect edits Possible a boolean operation edits the mesh while keeping the same number of faces. --- source/blender/bmesh/tools/bmesh_intersect.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/blender/bmesh/tools/bmesh_intersect.c') diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c index e9642bedba6..e177af9df91 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.c +++ b/source/blender/bmesh/tools/bmesh_intersect.c @@ -963,9 +963,11 @@ bool BM_mesh_intersect( const float eps) { struct ISectState s; - bool has_isect; const int totface_orig = bm->totface; + /* use to check if we made any changes */ + bool has_edit_isect = false, has_edit_boolean = false; + /* needed for boolean, since cutting up faces moves the loops within the face */ const float **looptri_coords = NULL; @@ -1603,6 +1605,8 @@ bool BM_mesh_intersect( BM_face_normal_flip(bm, ftable[groups_array[fg]]); } } + + has_edit_boolean |= (do_flip || do_remove); } MEM_freeN(groups_array); @@ -1659,7 +1663,7 @@ bool BM_mesh_intersect( } } - has_isect = (BLI_ghash_size(s.face_edges) != 0); + has_edit_isect = (BLI_ghash_size(s.face_edges) != 0); /* cleanup */ BLI_ghash_free(s.edgetri_cache, NULL, NULL); @@ -1670,5 +1674,5 @@ bool BM_mesh_intersect( BLI_memarena_free(s.mem_arena); - return has_isect || (totface_orig != bm->totface); + return (has_edit_isect || has_edit_boolean); } -- cgit v1.2.3