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

This commit is contained in:
Alan Troth 2020-06-16 16:44:05 +10:00 committed by Campbell Barton
parent f72419b9ae
commit a64b8aca39
Notes: blender-bot 2024-04-11 14:26:06 +02:00
Referenced by issue #81861, 2.9x: Crash when editing curves with Cycles (Embree related?)
Referenced by issue #78900, Single vertex sliding crashes
Referenced by issue #61777, Proportional editing does not influence all objects in edit mode
7 changed files with 45 additions and 12 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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__);

View File

@ -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;
}

View File

@ -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;
}