Commit: ed52efdd3501b0991452a2a151d8a05fb34b2d5d
Author: Grigory Revzin
Date:   Sun Jun 22 19:02:04 2014 +0400
https://developer.blender.org/rBed52efdd3501b0991452a2a151d8a05fb34b2d5d

Scratch shape key now exists only in EM

Stopped writing it to disk and to undo, pointless!

===================================================================

M       source/blender/blenkernel/intern/key.c
M       source/blender/blenloader/intern/writefile.c
M       source/blender/editors/mesh/editmesh_utils.c

===================================================================

diff --git a/source/blender/blenkernel/intern/key.c 
b/source/blender/blenkernel/intern/key.c
index bd91c70..11062e9 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -2094,9 +2094,7 @@ void BKE_key_init_scratch(Object *ob)
        KeyBlock *kb = BKE_keyblock_from_object(ob);
        if (key && kb && key->totkey > 0) {
                key->scratch.origin = kb;
-               if (!key->scratch.data) {
-                       key->scratch.data = MEM_mallocN(key->elemsize * 
kb->totelem, "scratch keyblock data");
-               }
+               key->scratch.data = MEM_mallocN(key->elemsize * kb->totelem, 
"scratch keyblock data");
                memcpy(key->scratch.data, kb->data, key->elemsize * 
kb->totelem);
        }
 }
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index 78f8227..dfcf542 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1704,8 +1704,6 @@ static void write_keys(WriteData *wd, ListBase *idbase)
                        }
                }
 
-               if (key->scratch.data)
-                       writedata(wd, DATA, key->scratch.origin->totelem * 
key->elemsize, key->scratch.data);
                key = key->id.next;
        }
        /* flush helps the compression for undo-save */
diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index a8c7362..e031166 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -661,12 +661,13 @@ bool EDBM_mesh_from_editmesh(Object *obedit, bool do_free)
 {
        Mesh *me = obedit->data;
        BMEditMesh *em = me->edit_btmesh;
+       Key *k = me->key;
 
        if (me->edit_btmesh->bm->totvert > MESH_MAX_VERTS) {
                return false;
        }
 
-       if (BKE_key_from_object(obedit) && BKE_keyblock_from_object(obedit)) {
+       if (me->key && BKE_keyblock_from_object(obedit)) {
                if (BKE_editmesh_topo_has_changed(em)) {
                        BKE_key_editdata_to_scratch(obedit, false);
                }
@@ -675,6 +676,11 @@ bool EDBM_mesh_from_editmesh(Object *obedit, bool do_free)
                        recalc_keyblocks_from_scratch(obedit);
                        update_bmesh_shapes(obedit);
                }
+
+               if (do_free) {
+                       MEM_freeN(k->scratch.data);
+                       k->scratch.data = NULL;
+               }
        }
 
        EDBM_mesh_load(obedit);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to