diff options
Diffstat (limited to 'source/blender/editors/mesh/bmeshutils.c')
-rw-r--r-- | source/blender/editors/mesh/bmeshutils.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/bmeshutils.c b/source/blender/editors/mesh/bmeshutils.c index e5cda669438..e5048c538bb 100644 --- a/source/blender/editors/mesh/bmeshutils.c +++ b/source/blender/editors/mesh/bmeshutils.c @@ -555,13 +555,14 @@ typedef struct undomesh { } undomesh; /*undo simply makes copies of a bmesh*/ -static void *editbtMesh_to_undoMesh(void *emv) +static void *editbtMesh_to_undoMesh(void *emv, void *obdata) { BMEditMesh *em = emv; + Mesh *obme = obdata; undomesh *me = MEM_callocN(sizeof(undomesh), "undo Mesh"); /*make sure shape keys work*/ - me->me.key = copy_key_nolib(em->me->key); + me->me.key = obme->key ? copy_key_nolib(obme->key) : NULL; /*we recalc the tesselation here, to avoid seeding calls to BMEdit_RecalcTesselation throughout the code.*/ @@ -573,17 +574,22 @@ static void *editbtMesh_to_undoMesh(void *emv) return me; } -static void undoMesh_to_editbtMesh(void *umv, void *emv) +static void undoMesh_to_editbtMesh(void *umv, void *emv, void *obdata) { BMEditMesh *em = emv, *em2; + Object ob = {0,}; undomesh *me = umv; BMesh *bm; int allocsize[4] = {512, 512, 2048, 512}; + ob.data = me; + ob.type = OB_MESH; + ob.shapenr = em->bm->shapenr; + BMEdit_Free(em); bm = BM_Make_Mesh(allocsize); - BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p object=%p", me, em->ob); + BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p object=%p", me, &ob); em2 = BMEdit_Create(bm); *em = *em2; |