diff options
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_core.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 51461190233..b296c367575 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -1915,7 +1915,8 @@ bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target) * * \return Success */ -void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len) +void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, + const bool copy_select) { const int v_edgetot = BM_vert_face_count(v); BMEdge **stack = BLI_array_alloca(stack, v_edgetot); @@ -1970,6 +1971,9 @@ void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len verts[0] = v; for (i = 1; i < maxindex; i++) { verts[i] = BM_vert_create(bm, v->co, v, 0); + if (copy_select) { + BM_elem_select_copy(bm, bm, verts[i], v); + } } /* Replace v with the new verts in each group */ @@ -2052,11 +2056,11 @@ void BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, for (i = 0; i < e_in_len; i++) { BMEdge *e = e_in[i]; if (e->l && BM_vert_in_edge(e, v)) { - bmesh_edge_separate(bm, e, e->l); + bmesh_edge_separate(bm, e, e->l, false); } } - bmesh_vert_separate(bm, v, r_vout, r_vout_len); + bmesh_vert_separate(bm, v, r_vout, r_vout_len, false); } /** @@ -2112,7 +2116,8 @@ bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target) * \note Does nothing if \a l_sep is already the only loop in the * edge radial. */ -void bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep) +void bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep, + const bool copy_select) { BMEdge *e_new; #ifndef NDEBUG @@ -2136,6 +2141,10 @@ void bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep) bmesh_radial_append(e_new, l_sep); l_sep->e = e_new; + if (copy_select) { + BM_elem_select_copy(bm, bm, e_new, e); + } + BLI_assert(bmesh_radial_length(e->l) == radlen - 1); BLI_assert(bmesh_radial_length(e_new->l) == 1); @@ -2159,8 +2168,8 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep) /* peel the face from the edge radials on both sides of the * loop vert, disconnecting the face from its fan */ - bmesh_edge_separate(bm, l_sep->e, l_sep); - bmesh_edge_separate(bm, l_sep->prev->e, l_sep->prev); + bmesh_edge_separate(bm, l_sep->e, l_sep, false); + bmesh_edge_separate(bm, l_sep->prev->e, l_sep->prev, false); if (bmesh_disk_count(v_sep) == 2) { /* If there are still only two edges out of v_sep, then @@ -2178,7 +2187,7 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep) /* Split all fans connected to the vert, duplicating it for * each fans. */ - bmesh_vert_separate(bm, v_sep, &vtar, &len); + bmesh_vert_separate(bm, v_sep, &vtar, &len, false); /* There should have been at least two fans cut apart here, * otherwise the early exit would have kicked in. */ |