Fix T80728: UV edge select splits UV's for lasso/box/circle select
Oversight in 411c5238a2 ignored sticky selection.
Use 'uvedit_edge_select_set_with_sticky' to make sure
sticky options are respected.
Also skip checking the existing selection since that only checks the
current UV, not all connected UV's which is needed for sticky selection.
The extra checks to avoid updating UV's isn't such an advantage as
only meshed in the selected region are tagged for updating.
This commit is contained in:
@@ -2924,9 +2924,6 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
else if (use_edge && !pinned) {
|
||||
changed = true;
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false);
|
||||
|
||||
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
|
||||
if (!uvedit_face_visible_test(scene, efa)) {
|
||||
continue;
|
||||
@@ -2934,29 +2931,18 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BMLoop *l_prev = BM_FACE_FIRST_LOOP(efa)->prev;
|
||||
MLoopUV *luv_prev = BM_ELEM_CD_GET_VOID_P(l_prev, cd_loop_uv_offset);
|
||||
bool luv_select_prev = uvedit_uv_select_test(scene, l_prev, cd_loop_uv_offset);
|
||||
|
||||
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
|
||||
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
|
||||
const bool luv_select = uvedit_uv_select_test(scene, l, cd_loop_uv_offset);
|
||||
if ((select != luv_select) || (select != luv_select_prev)) {
|
||||
if (BLI_rctf_isect_pt_v(&rectf, luv->uv) &&
|
||||
BLI_rctf_isect_pt_v(&rectf, luv_prev->uv)) {
|
||||
uvedit_uv_select_set(scene, em, l, select, false, cd_loop_uv_offset);
|
||||
uvedit_uv_select_set(scene, em, l_prev, select, false, cd_loop_uv_offset);
|
||||
BM_elem_flag_enable(l->v, BM_ELEM_TAG);
|
||||
BM_elem_flag_enable(l_prev->v, BM_ELEM_TAG);
|
||||
}
|
||||
if (BLI_rctf_isect_pt_v(&rectf, luv->uv) && BLI_rctf_isect_pt_v(&rectf, luv_prev->uv)) {
|
||||
uvedit_edge_select_set_with_sticky(
|
||||
sima, scene, em, l_prev, select, false, cd_loop_uv_offset);
|
||||
changed = true;
|
||||
}
|
||||
l_prev = l;
|
||||
luv_prev = luv;
|
||||
luv_select_prev = luv_select;
|
||||
}
|
||||
}
|
||||
|
||||
if (sima->sticky == SI_STICKY_VERTEX) {
|
||||
uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* other selection modes */
|
||||
@@ -3155,8 +3141,6 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
else if (use_edge) {
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false);
|
||||
|
||||
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
|
||||
if (!uvedit_face_visible_test(scene, efa)) {
|
||||
continue;
|
||||
@@ -3164,29 +3148,18 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BMLoop *l_prev = BM_FACE_FIRST_LOOP(efa)->prev;
|
||||
MLoopUV *luv_prev = BM_ELEM_CD_GET_VOID_P(l_prev, cd_loop_uv_offset);
|
||||
bool luv_select_prev = uvedit_uv_select_test(scene, l_prev, cd_loop_uv_offset);
|
||||
|
||||
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
|
||||
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
|
||||
const bool luv_select = uvedit_uv_select_test(scene, l, cd_loop_uv_offset);
|
||||
if ((select != luv_select) || (select != luv_select_prev)) {
|
||||
if (uv_circle_select_is_edge_inside(luv->uv, luv_prev->uv, offset, ellipse)) {
|
||||
changed = true;
|
||||
uvedit_uv_select_set(scene, em, l, select, false, cd_loop_uv_offset);
|
||||
uvedit_uv_select_set(scene, em, l_prev, select, false, cd_loop_uv_offset);
|
||||
BM_elem_flag_enable(l->v, BM_ELEM_TAG);
|
||||
BM_elem_flag_enable(l_prev->v, BM_ELEM_TAG);
|
||||
}
|
||||
if (uv_circle_select_is_edge_inside(luv->uv, luv_prev->uv, offset, ellipse)) {
|
||||
uvedit_edge_select_set_with_sticky(
|
||||
sima, scene, em, l_prev, select, false, cd_loop_uv_offset);
|
||||
changed = true;
|
||||
}
|
||||
l_prev = l;
|
||||
luv_prev = luv;
|
||||
luv_select_prev = luv_select;
|
||||
}
|
||||
}
|
||||
|
||||
if (sima->sticky == SI_STICKY_VERTEX) {
|
||||
uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false);
|
||||
@@ -3346,8 +3319,6 @@ static bool do_lasso_select_mesh_uv(bContext *C,
|
||||
}
|
||||
}
|
||||
else if (use_edge) {
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false);
|
||||
|
||||
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
|
||||
if (!uvedit_face_visible_test(scene, efa)) {
|
||||
continue;
|
||||
@@ -3355,32 +3326,21 @@ static bool do_lasso_select_mesh_uv(bContext *C,
|
||||
|
||||
BMLoop *l_prev = BM_FACE_FIRST_LOOP(efa)->prev;
|
||||
MLoopUV *luv_prev = BM_ELEM_CD_GET_VOID_P(l_prev, cd_loop_uv_offset);
|
||||
bool luv_select_prev = uvedit_uv_select_test(scene, l_prev, cd_loop_uv_offset);
|
||||
|
||||
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
|
||||
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
|
||||
const bool luv_select = uvedit_uv_select_test(scene, l, cd_loop_uv_offset);
|
||||
if ((select != luv_select) || (select != luv_select_prev)) {
|
||||
if (do_lasso_select_mesh_uv_is_point_inside(
|
||||
region, &rect, mcoords, mcoords_len, luv->uv) &&
|
||||
do_lasso_select_mesh_uv_is_point_inside(
|
||||
region, &rect, mcoords, mcoords_len, luv_prev->uv)) {
|
||||
uvedit_uv_select_set(scene, em, l, select, false, cd_loop_uv_offset);
|
||||
uvedit_uv_select_set(scene, em, l_prev, select, false, cd_loop_uv_offset);
|
||||
changed = true;
|
||||
BM_elem_flag_enable(l->v, BM_ELEM_TAG);
|
||||
BM_elem_flag_enable(l_prev->v, BM_ELEM_TAG);
|
||||
}
|
||||
if (do_lasso_select_mesh_uv_is_point_inside(
|
||||
region, &rect, mcoords, mcoords_len, luv->uv) &&
|
||||
do_lasso_select_mesh_uv_is_point_inside(
|
||||
region, &rect, mcoords, mcoords_len, luv_prev->uv)) {
|
||||
uvedit_edge_select_set_with_sticky(
|
||||
sima, scene, em, l_prev, select, false, cd_loop_uv_offset);
|
||||
changed = true;
|
||||
}
|
||||
l_prev = l;
|
||||
luv_prev = luv;
|
||||
luv_select_prev = luv_select;
|
||||
}
|
||||
}
|
||||
|
||||
if (sima->sticky == SI_STICKY_VERTEX) {
|
||||
uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset);
|
||||
}
|
||||
}
|
||||
else { /* Vert Sel */
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false);
|
||||
|
||||
Reference in New Issue
Block a user