[Bf-blender-cvs] [a64b8aca394] master: Fix T61777: Proportional editing doesn't work with multi edit-mode

Alan Troth noreply at git.blender.org
Tue Jun 16 09:01:05 CEST 2020


Commit: a64b8aca394fbff622309613d7efef2cae28c0d4
Author: Alan Troth
Date:   Tue Jun 16 16:44:05 2020 +1000
Branches: master
https://developer.blender.org/rBa64b8aca394fbff622309613d7efef2cae28c0d4

Fix T61777: Proportional editing doesn't work with multi edit-mode

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

M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_convert_curve.c
M	source/blender/editors/transform/transform_convert_lattice.c
M	source/blender/editors/transform/transform_convert_mball.c
M	source/blender/editors/transform/transform_convert_mesh.c
M	source/blender/editors/transform/transform_convert_mesh_edge.c
M	source/blender/editors/transform/transform_convert_mesh_uv.c

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

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index d7da0cfba5c..b02b1814c67 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1917,6 +1917,27 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
     return 0;
   }
 
+  /* When proportional editing is enabled, data_len_all can be non zero when
+   * nothing is selected, if this is the case we can end the transform early.
+   *
+   * By definition transform-data has selected items in beginning,
+   * so only the first item in each container needs to be checked
+   * when looking  for the presence of selected data. */
+  if (t->flag & T_PROP_EDIT) {
+    bool has_selected_any = false;
+    FOREACH_TRANS_DATA_CONTAINER (t, tc) {
+      if (tc->data->flag & TD_SELECTED) {
+        has_selected_any = true;
+        break;
+      }
+    }
+
+    if (!has_selected_any) {
+      postTrans(C, t);
+      return 0;
+    }
+  }
+
   if (event) {
     /* keymap for shortcut header prints */
     t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
diff --git a/source/blender/editors/transform/transform_convert_curve.c b/source/blender/editors/transform/transform_convert_curve.c
index 87812a051c0..5340f5f092f 100644
--- a/source/blender/editors/transform/transform_convert_curve.c
+++ b/source/blender/editors/transform/transform_convert_curve.c
@@ -100,6 +100,7 @@ void createTransCurveVerts(TransInfo *t)
     int count = 0, countsel = 0;
     int count_pt = 0, countsel_pt = 0;
     const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
+    const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0;
     View3D *v3d = t->view;
     short hide_handles = (v3d != NULL) ? (v3d->overlay.handle_display == CURVE_HANDLE_NONE) :
                                          false;
@@ -145,8 +146,9 @@ void createTransCurveVerts(TransInfo *t)
         }
       }
     }
-    /* note: in prop mode we need at least 1 selected */
-    if (countsel == 0) {
+
+    /* Support other objects using PET to adjust these, unless connected is enabled. */
+    if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) {
       tc->data_len = 0;
       continue;
     }
diff --git a/source/blender/editors/transform/transform_convert_lattice.c b/source/blender/editors/transform/transform_convert_lattice.c
index b73a4c1ab2d..e564733266b 100644
--- a/source/blender/editors/transform/transform_convert_lattice.c
+++ b/source/blender/editors/transform/transform_convert_lattice.c
@@ -53,6 +53,7 @@ void createTransLatticeVerts(TransInfo *t)
     int a;
     int count = 0, countsel = 0;
     const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
+    const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0;
 
     bp = latt->def;
     a = latt->pntsu * latt->pntsv * latt->pntsw;
@@ -68,9 +69,10 @@ void createTransLatticeVerts(TransInfo *t)
       bp++;
     }
 
-    /* note: in prop mode we need at least 1 selected */
-    if (countsel == 0) {
-      return;
+    /* Support other objects using PET to adjust these, unless connected is enabled. */
+    if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) {
+      tc->data_len = 0;
+      continue;
     }
 
     if (is_prop_edit) {
diff --git a/source/blender/editors/transform/transform_convert_mball.c b/source/blender/editors/transform/transform_convert_mball.c
index 447733357d6..ce5e4dade5a 100644
--- a/source/blender/editors/transform/transform_convert_mball.c
+++ b/source/blender/editors/transform/transform_convert_mball.c
@@ -47,6 +47,7 @@ void createTransMBallVerts(TransInfo *t)
     float mtx[3][3], smtx[3][3];
     int count = 0, countsel = 0;
     const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
+    const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0;
 
     /* count totals */
     for (ml = mb->editelems->first; ml; ml = ml->next) {
@@ -58,8 +59,9 @@ void createTransMBallVerts(TransInfo *t)
       }
     }
 
-    /* note: in prop mode we need at least 1 selected */
-    if (countsel == 0) {
+    /* Support other objects using PET to adjust these, unless connected is enabled. */
+    if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) {
+      tc->data_len = 0;
       continue;
     }
 
diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c
index e273c23e675..27ddad262f7 100644
--- a/source/blender/editors/transform/transform_convert_mesh.c
+++ b/source/blender/editors/transform/transform_convert_mesh.c
@@ -707,9 +707,10 @@ void createTransEditVerts(TransInfo *t)
      *
      * \note ignore modes here, even in edge/face modes,
      * transform data is created by selected vertices.
-     * \note in prop mode we need at least 1 selected.
      */
-    if (bm->totvertsel == 0) {
+
+    /* Support other objects using PET to adjust these, unless connected is enabled. */
+    if ((!prop_mode || (prop_mode & T_PROP_CONNECTED)) && (bm->totvertsel == 0)) {
       goto cleanup;
     }
 
@@ -734,6 +735,10 @@ void createTransEditVerts(TransInfo *t)
         }
       }
 
+      if (data_len == 0) {
+        goto cleanup;
+      }
+
       /* allocating scratch arrays */
       if (prop_mode & T_PROP_CONNECTED) {
         dists = MEM_mallocN(em->bm->totvert * sizeof(float), __func__);
diff --git a/source/blender/editors/transform/transform_convert_mesh_edge.c b/source/blender/editors/transform/transform_convert_mesh_edge.c
index de90c515042..febfa4cd367 100644
--- a/source/blender/editors/transform/transform_convert_mesh_edge.c
+++ b/source/blender/editors/transform/transform_convert_mesh_edge.c
@@ -50,6 +50,7 @@ void createTransEdge(TransInfo *t)
     float mtx[3][3], smtx[3][3];
     int count = 0, countsel = 0;
     const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
+    const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0;
     int cd_edge_float_offset;
 
     BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
@@ -63,7 +64,7 @@ void createTransEdge(TransInfo *t)
       }
     }
 
-    if (countsel == 0) {
+    if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) {
       tc->data_len = 0;
       continue;
     }
diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c b/source/blender/editors/transform/transform_convert_mesh_uv.c
index 337f7a83f9e..41c09cd8ea2 100644
--- a/source/blender/editors/transform/transform_convert_mesh_uv.c
+++ b/source/blender/editors/transform/transform_convert_mesh_uv.c
@@ -171,8 +171,8 @@ void createTransUVs(bContext *C, TransInfo *t)
       }
     }
 
-    /* note: in prop mode we need at least 1 selected */
-    if (countsel == 0) {
+    /* Support other objects using PET to adjust these, unless connected is enabled. */
+    if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) {
       goto finally;
     }



More information about the Bf-blender-cvs mailing list