BMesh: Add BM_vert_pair_share_face_check

Use to assert if BM_vert_splice is used incorrectly
This commit is contained in:
Campbell Barton
2014-07-16 17:12:08 +10:00
parent 85c7fce3de
commit 58659fc207
3 changed files with 24 additions and 0 deletions

View File

@@ -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)) {

View File

@@ -182,6 +182,26 @@ BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v)
#endif
}
/**
* 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.
*/

View File

@@ -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,