From a64b8aca394fbff622309613d7efef2cae28c0d4 Mon Sep 17 00:00:00 2001 From: Alan Troth Date: Tue, 16 Jun 2020 16:44:05 +1000 Subject: Fix T61777: Proportional editing doesn't work with multi edit-mode --- source/blender/editors/transform/transform.c | 21 +++++++++++++++++++++ .../editors/transform/transform_convert_curve.c | 6 ++++-- .../editors/transform/transform_convert_lattice.c | 8 +++++--- .../editors/transform/transform_convert_mball.c | 6 ++++-- .../editors/transform/transform_convert_mesh.c | 9 +++++++-- .../editors/transform/transform_convert_mesh_edge.c | 3 ++- .../editors/transform/transform_convert_mesh_uv.c | 4 ++-- 7 files changed, 45 insertions(+), 12 deletions(-) (limited to 'source/blender/editors/transform') 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; } -- cgit v1.2.3