Cleanup: bmesh src/dst order in API args
This commit is contained in:
@@ -1804,7 +1804,7 @@ BMEdge *bmesh_jekv(
|
||||
if (check_edge_double) {
|
||||
if (e_splice) {
|
||||
/* removes e_splice */
|
||||
BM_edge_splice(bm, e_splice, e_old);
|
||||
BM_edge_splice(bm, e_old, e_splice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2018,7 +2018,8 @@ bool BM_vert_splice_check_double(BMVert *v_a, BMVert *v_b)
|
||||
/**
|
||||
* \brief Splice Vert
|
||||
*
|
||||
* Merges two verts into one (\a v into \a vtarget).
|
||||
* Merges two verts into one
|
||||
* (\a v_src into \a v_dst, removing \a v_src).
|
||||
*
|
||||
* \return Success
|
||||
*
|
||||
@@ -2026,28 +2027,28 @@ bool BM_vert_splice_check_double(BMVert *v_a, BMVert *v_b)
|
||||
* where \a v and \a vtarget are connected by an edge
|
||||
* (assert checks for this case).
|
||||
*/
|
||||
bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
|
||||
bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src)
|
||||
{
|
||||
BMEdge *e;
|
||||
|
||||
/* verts already spliced */
|
||||
if (v == v_target) {
|
||||
if (v_src == v_dst) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BLI_assert(BM_vert_pair_share_face_check(v, v_target) == false);
|
||||
BLI_assert(BM_vert_pair_share_face_check(v_src, v_dst) == false);
|
||||
|
||||
/* move all the edges from v's disk to vtarget's disk */
|
||||
while ((e = v->e)) {
|
||||
bmesh_edge_vert_swap(e, v_target, v);
|
||||
/* move all the edges from 'v_src' disk to 'v_dst' */
|
||||
while ((e = v_src->e)) {
|
||||
bmesh_edge_vert_swap(e, v_dst, v_src);
|
||||
BLI_assert(e->v1 != e->v2);
|
||||
}
|
||||
|
||||
BM_CHECK_ELEMENT(v);
|
||||
BM_CHECK_ELEMENT(v_target);
|
||||
BM_CHECK_ELEMENT(v_src);
|
||||
BM_CHECK_ELEMENT(v_dst);
|
||||
|
||||
/* v is unused now, and can be killed */
|
||||
BM_vert_kill(bm, v);
|
||||
/* 'v_src' is unused now, and can be killed */
|
||||
BM_vert_kill(bm, v_src);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2197,16 +2198,17 @@ void BM_vert_separate(
|
||||
* \brief Splice Edge
|
||||
*
|
||||
* Splice two unique edges which share the same two vertices into one edge.
|
||||
* (\a e_src into \a e_dst, removing e_src).
|
||||
*
|
||||
* \return Success
|
||||
*
|
||||
* \note Edges must already have the same vertices.
|
||||
*/
|
||||
bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
|
||||
bool BM_edge_splice(BMesh *bm, BMEdge *e_dst, BMEdge *e_src)
|
||||
{
|
||||
BMLoop *l;
|
||||
|
||||
if (!BM_vert_in_edge(e, e_target->v1) || !BM_vert_in_edge(e, e_target->v2)) {
|
||||
if (!BM_vert_in_edge(e_src, e_dst->v1) || !BM_vert_in_edge(e_src, e_dst->v2)) {
|
||||
/* not the same vertices can't splice */
|
||||
|
||||
/* the caller should really make sure this doesn't happen ever
|
||||
@@ -2216,21 +2218,21 @@ bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
|
||||
return false;
|
||||
}
|
||||
|
||||
while (e->l) {
|
||||
l = e->l;
|
||||
BLI_assert(BM_vert_in_edge(e_target, l->v));
|
||||
BLI_assert(BM_vert_in_edge(e_target, l->next->v));
|
||||
bmesh_radial_loop_remove(l, e);
|
||||
bmesh_radial_append(e_target, l);
|
||||
while (e_src->l) {
|
||||
l = e_src->l;
|
||||
BLI_assert(BM_vert_in_edge(e_dst, l->v));
|
||||
BLI_assert(BM_vert_in_edge(e_dst, l->next->v));
|
||||
bmesh_radial_loop_remove(l, e_src);
|
||||
bmesh_radial_append(e_dst, l);
|
||||
}
|
||||
|
||||
BLI_assert(bmesh_radial_length(e->l) == 0);
|
||||
BLI_assert(bmesh_radial_length(e_src->l) == 0);
|
||||
|
||||
BM_CHECK_ELEMENT(e);
|
||||
BM_CHECK_ELEMENT(e_target);
|
||||
BM_CHECK_ELEMENT(e_src);
|
||||
BM_CHECK_ELEMENT(e_dst);
|
||||
|
||||
/* removes from disks too */
|
||||
BM_edge_kill(bm, e);
|
||||
BM_edge_kill(bm, e_src);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ void BM_vert_kill(BMesh *bm, BMVert *v);
|
||||
void bmesh_edge_separate(
|
||||
BMesh *bm, BMEdge *e, BMLoop *l_sep,
|
||||
const bool copy_select);
|
||||
bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target);
|
||||
bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target);
|
||||
bool BM_edge_splice(BMesh *bm, BMEdge *e_dst, BMEdge *e_src);
|
||||
bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src);
|
||||
bool BM_vert_splice_check_double(BMVert *v_a, BMVert *v_b);
|
||||
|
||||
void bmesh_vert_separate(
|
||||
|
||||
@@ -974,7 +974,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
|
||||
v_glue = v_split;
|
||||
}
|
||||
else {
|
||||
BM_vert_splice(bm, v_split, v_glue);
|
||||
BM_vert_splice(bm, v_glue, v_split);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,12 +788,12 @@ static bool bm_edge_collapse(
|
||||
BM_edge_kill(bm, e_clear);
|
||||
|
||||
v_other->head.hflag |= v_clear->head.hflag;
|
||||
BM_vert_splice(bm, v_clear, v_other);
|
||||
BM_vert_splice(bm, v_other, v_clear);
|
||||
|
||||
e_a_other[1]->head.hflag |= e_a_other[0]->head.hflag;
|
||||
e_b_other[1]->head.hflag |= e_b_other[0]->head.hflag;
|
||||
BM_edge_splice(bm, e_a_other[0], e_a_other[1]);
|
||||
BM_edge_splice(bm, e_b_other[0], e_b_other[1]);
|
||||
BM_edge_splice(bm, e_a_other[1], e_a_other[0]);
|
||||
BM_edge_splice(bm, e_b_other[1], e_b_other[0]);
|
||||
|
||||
// BM_mesh_validate(bm);
|
||||
|
||||
@@ -837,10 +837,10 @@ static bool bm_edge_collapse(
|
||||
BM_edge_kill(bm, e_clear);
|
||||
|
||||
v_other->head.hflag |= v_clear->head.hflag;
|
||||
BM_vert_splice(bm, v_clear, v_other);
|
||||
BM_vert_splice(bm, v_other, v_clear);
|
||||
|
||||
e_a_other[1]->head.hflag |= e_a_other[0]->head.hflag;
|
||||
BM_edge_splice(bm, e_a_other[0], e_a_other[1]);
|
||||
BM_edge_splice(bm, e_a_other[1], e_a_other[0]);
|
||||
|
||||
// BM_mesh_validate(bm);
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ void BM_mesh_edgesplit(
|
||||
if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
|
||||
BMEdge *e_other;
|
||||
if ((e_other = BM_edge_find_double(e))) {
|
||||
BM_edge_splice(bm, e, e_other);
|
||||
BM_edge_splice(bm, e_other, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1006,7 +1006,7 @@ bool BM_mesh_intersect(
|
||||
!BM_vert_splice_check_double(v_prev, vi) &&
|
||||
!BM_vert_pair_share_face_check(v_prev, vi))
|
||||
{
|
||||
BM_vert_splice(bm, v_prev, vi);
|
||||
BM_vert_splice(bm, vi, v_prev);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(v_prev->co, vi->co);
|
||||
@@ -1228,7 +1228,7 @@ bool BM_mesh_intersect(
|
||||
if (!BM_edge_exists(UNPACK2(splice_ls[i])) &&
|
||||
!BM_vert_splice_check_double(UNPACK2(splice_ls[i])))
|
||||
{
|
||||
BM_vert_splice(bm, UNPACK2(splice_ls[i]));
|
||||
BM_vert_splice(bm, splice_ls[i][1], splice_ls[i][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,7 +715,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
}
|
||||
|
||||
for (i = 2; i < vout_len; i++) {
|
||||
BM_vert_splice(bm, vout[i], vout[1]);
|
||||
BM_vert_splice(bm, vout[1], vout[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ static PyObject *bpy_bm_utils_vert_splice(PyObject *UNUSED(self), PyObject *args
|
||||
}
|
||||
|
||||
/* should always succeed */
|
||||
ok = BM_vert_splice(bm, py_vert->v, py_vert_target->v);
|
||||
ok = BM_vert_splice(bm, py_vert_target->v, py_vert->v);
|
||||
BLI_assert(ok == true);
|
||||
UNUSED_VARS_NDEBUG(ok);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user