[Bf-blender-cvs] [adcb3c6ee14] blender-v2.90-release: Fix T80728: UV edge select splits UV's for lasso/box/circle select

Campbell Barton noreply at git.blender.org
Mon Sep 21 09:50:36 CEST 2020


Commit: adcb3c6ee14d58ee9b9ff78db1b393f7c7394d70
Author: Campbell Barton
Date:   Mon Sep 14 21:03:24 2020 +1000
Branches: blender-v2.90-release
https://developer.blender.org/rBadcb3c6ee14d58ee9b9ff78db1b393f7c7394d70

Fix T80728: UV edge select splits UV's for lasso/box/circle select

Oversight in 411c5238a2fef 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.

===================================================================

M	source/blender/editors/uvedit/uvedit_select.c

===================================================================

diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c
index 149c5cf1f96..ffa88b97557 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -2855,9 +2855,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;
@@ -2865,29 +2862,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 */
@@ -3086,8 +3072,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;
@@ -3095,29 +3079,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);
@@ -3277,8 +3250,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;
@@ -3286,32 +3257,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);



More information about the Bf-blender-cvs mailing list