Record Transform Animation - Quicky feature which makes it super-easy to animate...
authorJoshua Leung <aligorith@gmail.com>
Tue, 17 Feb 2009 08:55:50 +0000 (08:55 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 17 Feb 2009 08:55:50 +0000 (08:55 +0000)
To use, simply enable Auto-Keyframing and start the animation playback from the TimeLine.
Then at any time while the playback is still running (and Auto-Keyframing is still enabled), select any object/bone and start moving it around.
You can also select other objects/bones and move them around using standard transform tools (grab/rotate/scale), or exit transform for the active/selected object(s), and move on to other objects instead. Repeat until satisfactory!

This is similar to the old 'Record IPO' functionality (and/or is closer to the 'Mouse Recording' in 3DSMax), except it's much cooler, and is more flexible at the same time. It's
"good for quick and dirty tests, or things with timing, where it's easier to do it real time" - William Reynish, or "handycam effect or eyes animation" - Pepeland.

Additional Notes:
- for now, the objects that are used for this currently need some animation data already. This limitation is temporary.
- eventually, 'samples' (i.e. baked-data) not keyframes will be made by this tool as samples are more suitable for such large sets of densely spaced points

source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c

index 7dd2abc6a9e16cdf8af56687bf766251ef239215..bfa2394d2923e16181796e061bb2180c5ef3177d 100644 (file)
@@ -4203,7 +4203,7 @@ void autokeyframe_pose_cb_func(Scene *scene, View3D *v3d, Object *ob, int tmode,
 {
        ID *id= &ob->id;
        AnimData *adt= ob->adt;
-       bArmature *arm= ob->data;
+       //bArmature *arm= ob->data;
        bAction *act= (adt) ? adt->action : NULL;
        bPose   *pose= ob->pose;
        bPoseChannel *pchan;
index 479d750865dca918ddc64607211862c7aa91e549..7c865e91c404b3c1ad6608dc1d4ae18d0b674c31 100644 (file)
@@ -561,11 +561,15 @@ void recalcData(TransInfo *t)
                Object *ob= t->poseobj;
                bArmature *arm= ob->data;
                
-               /* if animtimer is running, check if the auto-record feature means that we should record 'samples'
+               /* if animtimer is running, and the object already has animation data,
+                * check if the auto-record feature means that we should record 'samples'
                 * (i.e. uneditable animation values)
                 */
-               if (t->animtimer && IS_AUTOKEY_ON(t->scene)) {
-                       // XXX
+               // XXX experimental feature
+               // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
+               if ((ob->adt) && (t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+                       short targetless_ik= 0; // XXX...
+                       autokeyframe_pose_cb_func(t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
                }
                
                /* old optimize trick... this enforces to bypass the depgraph */
@@ -584,24 +588,16 @@ void recalcData(TransInfo *t)
                                ob->recalc |= OB_RECALC_OB;
                        if(base->flag & BA_HAS_RECALC_DATA)
                                ob->recalc |= OB_RECALC_DATA;
-
-#if 0 // XXX old animation system
-                       /* thanks to ob->ctime usage, ipos are not called in where_is_object,
-                          unless we edit ipokeys */
-                       if(base->flag & BA_DO_IPO) {
-                               if(ob->ipo) {
-                                       IpoCurve *icu;
-                                       
-                                       ob->ctime= -1234567.0;
-                                       
-                                       icu= ob->ipo->curve.first;
-                                       while(icu) {
-                                               calchandles_ipocurve(icu);
-                                               icu= icu->next;
-                                       }
-                               }                               
+                       
+                       /* if animtimer is running, and the object already has animation data,
+                        * check if the auto-record feature means that we should record 'samples'
+                        * (i.e. uneditable animation values)
+                        */
+                       // XXX experimental feature
+                       // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
+                       if ((ob->adt) && (t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+                               autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
                        }
-#endif // XXX old animation system
                        
                        /* proxy exception */
                        if(ob->proxy)
@@ -738,6 +734,7 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
                View3D *v3d = sa->spacedata.first;
                
                t->view = v3d;
+               t->animtimer= CTX_wm_screen(C)->animtimer;
                
                if(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
                t->around = v3d->around;