diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-07-16 11:12:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-07-17 02:20:04 +0400 |
commit | 58659fc20730dd1797ae588cfeb55611aecb792e (patch) | |
tree | 2305a0f81525468ee858cb95e6cb572baaec952d /source/blender/bmesh | |
parent | 85c7fce3de9821de6e806fe057f762577e01ad06 (diff) |
BMesh: Add BM_vert_pair_share_face_check
Use to assert if BM_vert_splice is used incorrectly
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 20 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.h | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 47de0441e83..70ae630dba6 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -1960,6 +1960,8 @@ bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target) return false; } + BLI_assert(BM_vert_pair_share_face_check(v, v_target) == false); + /* move all the edges from v's disk to vtarget's disk */ while ((e = v->e)) { diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 606e93d4a85..685e5443583 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -183,6 +183,26 @@ BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v) } /** + * Check if verts share a face. + */ +bool BM_vert_pair_share_face_check( + BMVert *v_a, BMVert *v_b) +{ + if (v_a->e && v_b->e) { + BMIter iter; + BMFace *f; + + BM_ITER_ELEM (f, &iter, v_a, BM_FACES_OF_VERT) { + if (BM_vert_in_face(f, v_b)) { + return true; + } + } + } + + return false; +} + +/** * Given 2 verts, find the smallest face they share and give back both loops. */ BMFace *BM_vert_pair_share_face_by_len( diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h index 21d20976901..81d19cda806 100644 --- a/source/blender/bmesh/intern/bmesh_queries.h +++ b/source/blender/bmesh/intern/bmesh_queries.h @@ -50,6 +50,8 @@ BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v); BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step); BMLoop *BM_vert_find_first_loop(BMVert *v); +bool BM_vert_pair_share_face_check( + BMVert *v_a, BMVert *v_b) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMFace *BM_vert_pair_share_face_by_len( BMVert *v_a, BMVert *v_b, BMLoop **r_l_a, BMLoop **r_l_b, |