fix [#27485] Create new shapekey on lattice
authorCampbell Barton <ideasman42@gmail.com>
Thu, 26 May 2011 06:34:31 +0000 (06:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 26 May 2011 06:34:31 +0000 (06:34 +0000)
source/blender/blenkernel/intern/object.c

index 3523d1812a04ca357cf022074803e519dc316e41..e2a07427ce279a3e1f320b023b4ae480ca23fb5d 100644 (file)
@@ -3037,9 +3037,14 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
 
        if(newkey || from_mix==FALSE) {
                kb= add_keyblock(key, name);
-
-               /* create from lattice */
-               latt_to_key(lt, kb);
+               if (!newkey) {
+                       KeyBlock *basekb= (KeyBlock *)key->block.first;
+                       kb->data= MEM_dupallocN(basekb->data);
+                       kb->totelem= basekb->totelem;
+               }
+               else {
+                       latt_to_key(lt, kb);
+               }
        }
        else {
                /* copy from current values */
@@ -3075,7 +3080,10 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
                        KeyBlock *basekb= (KeyBlock *)key->block.first;
                        kb->data= MEM_dupallocN(basekb->data);
                        kb->totelem= basekb->totelem;
-               } else curve_to_key(cu, kb, lb);
+               }
+               else {
+                       curve_to_key(cu, kb, lb);
+               }
        }
        else {
                /* copy from current values */