[Bf-blender-cvs] [213f8294b5c] blender-v2.92-release: Fix T84906: Loop select can fail when starting from an ngon

Campbell Barton noreply at git.blender.org
Fri Jan 29 00:09:19 CET 2021


Commit: 213f8294b5c801c367fbddd6c1b4e6656908e71e
Author: Campbell Barton
Date:   Fri Jan 29 09:47:17 2021 +1100
Branches: blender-v2.92-release
https://developer.blender.org/rB213f8294b5c801c367fbddd6c1b4e6656908e71e

Fix T84906: Loop select can fail when starting from an ngon

When stepping over an ngon's edges, check the number of edges & faces,
to ensure the topology connected to the ngon would be walked along.

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

M	source/blender/bmesh/intern/bmesh_walkers_impl.c

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

diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 35350383e49..c23551ecca7 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -852,6 +852,10 @@ static void bmw_EdgeLoopWalker_begin(BMWalker *walker, void *data)
       BM_vert_edge_count_nonwire(e->v1),
       BM_vert_edge_count_nonwire(e->v2),
   };
+  const int vert_face_count[2] = {
+      BM_vert_face_count(e->v1),
+      BM_vert_face_count(e->v2),
+  };
 
   v = e->v1;
 
@@ -927,7 +931,11 @@ static void bmw_EdgeLoopWalker_begin(BMWalker *walker, void *data)
    * doesn't differentiate between the number of sides of faces opposite `f_hub`,
    * only that each of the connected faces share an edge.
    */
-  if ((lwalk->is_boundary == false) && (vert_edge_count[0] == 3 || vert_edge_count[1] == 3)) {
+  if ((lwalk->is_boundary == false) &&
+      /* Without checking the face count, the 3 edges could be this edge
+       * plus two boundary edges (which would not be stepped over), see T84906. */
+      ((vert_edge_count[0] == 3 && vert_face_count[0] == 3) ||
+       (vert_edge_count[1] == 3 && vert_face_count[1] == 3))) {
     BMIter iter;
     BMFace *f_iter;
     BMFace *f_best = NULL;



More information about the Bf-blender-cvs mailing list