== Action Editor - IKEY ==
authorJoshua Leung <aligorith@gmail.com>
Sat, 2 Jun 2007 04:09:10 +0000 (04:09 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sat, 2 Jun 2007 04:09:10 +0000 (04:09 +0000)
Modified behaviour of IKEY in Action Editor a bit, so that the keyframes added have been updated to reflect the current state of an object/bone. Previously, it only used the current values of the ipo-curves they were being keyframed (maintained as fallback method now).

source/blender/src/editaction.c

index e9b0e43b410bc36779a0b762bee0cb1a3649f43b..1b0429abda2aba61bc1791375f6df2e4786c54a3 100644 (file)
@@ -2692,9 +2692,10 @@ void insertkey_action(void)
 {
        bAction *act;
        Key *key;
+       Object *ob= OBACT;
        IpoCurve *icu;
        short mode;
-       float cfra, val;
+       float cfra;
        
        /* get data */
        act = G.saction->action;
@@ -2713,8 +2714,10 @@ void insertkey_action(void)
                        if (EDITABLE_ACHAN(achan)) {
                                if (achan->ipo && (SEL_ACHAN(achan) || (mode == 1))) {
                                        for (icu= achan->ipo->curve.first; icu; icu=icu->next) {
-                                               val = icu->curval;
-                                               insert_vert_ipo(icu, cfra, val);
+                                               if (ob)
+                                                       insertkey((ID *)ob, icu->blocktype, achan->name, NULL, icu->adrcode);
+                                               else
+                                                       insert_vert_ipo(icu, cfra, icu->curval);
                                        }
                                }       
                                
@@ -2723,8 +2726,13 @@ void insertkey_action(void)
                                                if (EDITABLE_CONCHAN(conchan)) {
                                                        if (conchan->ipo && (SEL_ACHAN(conchan) || (mode == 1))) {
                                                                for (icu= conchan->ipo->curve.first; icu; icu=icu->next) {
-                                                                       val = icu->curval;
-                                                                       insert_vert_ipo(icu, cfra, val);
+                                                                       /* // commented out as this doesn't seem to work right for some reason
+                                                                       if (ob)
+                                                                               insertkey((ID *)ob, ID_CO, achan->name, conchan->name, CO_ENFORCE);
+                                                                        else
+                                                                               insert_vert_ipo(icu, cfra, icu->curval);
+                                                                       */
+                                                                       insert_vert_ipo(icu, cfra, icu->curval);
                                                                }
                                                        }
                                                }
@@ -2740,8 +2748,7 @@ void insertkey_action(void)
                
                if (key->ipo) {
                        for (icu= key->ipo->curve.first; icu; icu=icu->next) {
-                               val = icu->curval;
-                               insert_vert_ipo(icu, cfra, val);
+                               insert_vert_ipo(icu, cfra, icu->curval);
                        }
                }
        }