Fix T70376: Lattice point looses state on modeswitch when shape keys are

present

Selection state of lattice points as well as their weight were not kept
when going in and out of editmode, code would just copy positions.
Now copy the whole BPoint instead.

Reviewers: campbellbarton

Maniphest Tasks: T70376

Differential Revision: https://developer.blender.org/D5948
This commit is contained in:
Philipp Oeser
2019-09-30 16:34:48 +02:00
parent c9b9803a77
commit e82ac9e596

View File

@@ -92,6 +92,21 @@ void BKE_editlattice_load(Object *obedit)
lt = obedit->data;
editlt = lt->editlatt->latt;
MEM_freeN(lt->def);
lt->def = MEM_dupallocN(editlt->def);
lt->flag = editlt->flag;
lt->pntsu = editlt->pntsu;
lt->pntsv = editlt->pntsv;
lt->pntsw = editlt->pntsw;
lt->typeu = editlt->typeu;
lt->typev = editlt->typev;
lt->typew = editlt->typew;
lt->actbp = editlt->actbp;
if (lt->editlatt->shapenr) {
actkey = BLI_findlink(&lt->key->block, lt->editlatt->shapenr - 1);
@@ -112,22 +127,6 @@ void BKE_editlattice_load(Object *obedit)
bp++;
}
}
else {
MEM_freeN(lt->def);
lt->def = MEM_dupallocN(editlt->def);
lt->flag = editlt->flag;
lt->pntsu = editlt->pntsu;
lt->pntsv = editlt->pntsv;
lt->pntsw = editlt->pntsw;
lt->typeu = editlt->typeu;
lt->typev = editlt->typev;
lt->typew = editlt->typew;
lt->actbp = editlt->actbp;
}
if (lt->dvert) {
BKE_defvert_array_free(lt->dvert, lt->pntsu * lt->pntsv * lt->pntsw);