From e82ac9e596de98d8b0fcae0c7f10ef87fe2cdd50 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 30 Sep 2019 16:34:48 +0200 Subject: [PATCH] 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 --- .../blender/blenkernel/intern/editlattice.c | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/intern/editlattice.c b/source/blender/blenkernel/intern/editlattice.c index 12e737bbaa8..2d71b847b5b 100644 --- a/source/blender/blenkernel/intern/editlattice.c +++ b/source/blender/blenkernel/intern/editlattice.c @@ -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(<->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);