diff options
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query.c | 28 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query.h | 7 |
2 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c index 51bc86e40eb..219bec15e5b 100644 --- a/source/blender/bmesh/intern/bmesh_query.c +++ b/source/blender/bmesh/intern/bmesh_query.c @@ -207,6 +207,34 @@ bool BM_vert_pair_share_face_check_cb(BMVert *v_a, return false; } +BMFace *BM_vert_pair_shared_face_cb(BMVert *v_a, + BMVert *v_b, + const bool allow_adjacent, + bool (*callback)(BMFace *, BMLoop *, BMLoop *, void *userdata), + void *user_data, + BMLoop **r_l_a, + BMLoop **r_l_b) +{ + if (v_a->e && v_b->e) { + BMIter iter; + BMLoop *l_a, *l_b; + + BM_ITER_ELEM (l_a, &iter, v_a, BM_LOOPS_OF_VERT) { + BMFace *f = l_a->f; + l_b = BM_face_vert_share_loop(f, v_b); + if (l_b && (allow_adjacent || !BM_loop_is_adjacent(l_a, l_b)) && + callback(f, l_a, l_b, user_data)) { + *r_l_a = l_a; + *r_l_b = l_b; + + return f; + } + } + } + + return NULL; +} + /** * Given 2 verts, find the smallest face they share and give back both loops. */ diff --git a/source/blender/bmesh/intern/bmesh_query.h b/source/blender/bmesh/intern/bmesh_query.h index e96984490c0..3a864fbb5dd 100644 --- a/source/blender/bmesh/intern/bmesh_query.h +++ b/source/blender/bmesh/intern/bmesh_query.h @@ -62,6 +62,13 @@ bool BM_vert_pair_share_face_check_cb(BMVert *v_a, bool (*test_fn)(BMFace *f, void *user_data), void *user_data) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); +BMFace *BM_vert_pair_shared_face_cb(BMVert *v_a, + BMVert *v_b, + const bool allow_adjacent, + bool (*callback)(BMFace *, BMLoop *, BMLoop *, void *userdata), + void *user_data, + BMLoop **r_l_a, + BMLoop **r_l_b) ATTR_NONNULL(1, 2, 4, 6, 7); BMFace *BM_vert_pair_share_face_by_len(BMVert *v_a, BMVert *v_b, BMLoop **r_l_a, |