From 89cb41faa0596d898f850f68c46e2b39c25e6452 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 10 Jul 2020 12:55:59 +1000 Subject: UV: allow ripping face-regions This changes the behavior of rip when entire faces are selected. Now face regions are isolated and moved instead of ripping the edge-loop extracted from the selection boundary. This is a convenient alternative to separate selection & move. Resolves T78751. --- source/blender/editors/uvedit/uvedit_rip.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/uvedit/uvedit_rip.c b/source/blender/editors/uvedit/uvedit_rip.c index 934c2e0457f..66903e3eefa 100644 --- a/source/blender/editors/uvedit/uvedit_rip.c +++ b/source/blender/editors/uvedit/uvedit_rip.c @@ -812,26 +812,25 @@ static bool uv_rip_object(Scene *scene, Object *obedit, const float co[2], const } } - /* Mark only boundary edges. */ + /* Special case: if we have selected faces, isolated them. + * This isn't a rip, however it's useful for users as a quick way + * to detech the selection. + * + * We could also extract an edge loop from the boundary + * however in practice it's not that useful, see T78751. */ if (is_select_all_any) { BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - if (BM_elem_flag_test(efa, BM_ELEM_TAG)) { - BMLoop *l_first = BM_FACE_FIRST_LOOP(efa); - if (UL(l_first)->is_select_all) { - BMLoop *l_iter = l_first; - do { - BMLoop *l_other = bm_loop_find_other_radial_loop_with_visible_face(l_iter, - cd_loop_uv_offset); - if (l_other != NULL) { - if (UL(l_other)->is_select_all) { - UL(l_iter)->is_select_edge = false; - UL(l_other)->is_select_edge = false; - } - } - } while ((l_iter = l_iter->next) != l_first); + BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { + if (!UL(l)->is_select_all) { + MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); + if (luv->flag & MLOOPUV_VERTSEL) { + luv->flag &= ~MLOOPUV_VERTSEL; + changed = true; + } } } } + return changed; } /* Extract loop pairs or single loops. */ -- cgit v1.2.3