From 213f8294b5c801c367fbddd6c1b4e6656908e71e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 29 Jan 2021 09:47:17 +1100 Subject: 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. --- source/blender/bmesh/intern/bmesh_walkers_impl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source/blender/bmesh') 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; -- cgit v1.2.3