Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-07-31 11:43:47 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-31 11:43:47 +0400
commita1eef5bb4d1ac64cfde0a5055a889116ee855b7f (patch)
tree9d6d41c69b672868f0e8f09d7dd0430cc4ade00b /source/blender/editors/transform/transform_generics.c
parent6f847863a131cc61addbe6485abf2f24ae150ff1 (diff)
Animato - NLA + Realtime Animating Goodies
* When doing realtime recording of animation (i.e. transforming objects + bones while animation playback is running, and auto-keying is enabled), animation will be added to a new NLA Track+Strip combo everytime a single 'loop' of the frame range has finished. This will allow 'passes' over the animation to be less destructive. * Made the evaluation of the active action (when NLA data is present), be handled as part of the normal NLA system evaluation code (as if it were just another strip in a track at the end). The immediate benefit is that there are now some settings (available in the "Animation Data" panel in the NLA Editor with a strip selected) which allow for the way the active action is combined with the NLA stack results. For instance, the way that the action extrapolates is used in the recording tweaks above.
Diffstat (limited to 'source/blender/editors/transform/transform_generics.c')
-rw-r--r--source/blender/editors/transform/transform_generics.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 62b68589d98..8a7bc51c19e 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -92,6 +92,7 @@
#include "ED_markers.h"
#include "ED_mesh.h"
#include "ED_retopo.h"
+#include "ED_screen_types.h"
#include "ED_space_api.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
@@ -288,6 +289,42 @@ static void animedit_refresh_id_tags (ID *id)
}
}
+/* for the realtime animation recording feature, handle overlapping data */
+static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer)
+{
+ ScreenAnimData *sad= animtimer->customdata;
+
+ /* if animtimer is running and we're not interested in only keying for available channels,
+ * check if there's a keyframe on the current frame
+ */
+ if (IS_AUTOKEY_FLAG(INSERTAVAIL)==0) {
+ /* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
+ if (sad->flag & ANIMPLAY_FLAG_JUMPED) {
+ AnimData *adt= BKE_animdata_from_id(id);
+
+ /* perform push-down manually with some differences
+ * NOTE: BKE_nla_action_pushdown() sync warning...
+ */
+ if ((adt->action) && !(adt->flag & ADT_NLA_EDIT_ON)) {
+ NlaStrip *strip= add_nlastrip_to_stack(adt, adt->action);
+
+ /* clear reference to action now that we've pushed it onto the stack */
+ adt->action->id.us--;
+ adt->action= NULL;
+
+ /* adjust blending + extend so that they will behave correctly */
+ strip->extendmode= NLASTRIP_EXTEND_NOTHING;
+ strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_ACTIVE);
+
+ /* also, adjust the AnimData's action extend mode to be on
+ * 'nothing' so that previous result still play
+ */
+ adt->act_extendmode= NLASTRIP_EXTEND_NOTHING;
+ }
+ }
+ }
+}
+
/* called for updating while transform acts, once per redraw */
void recalcData(TransInfo *t)
{
@@ -716,6 +753,8 @@ void recalcData(TransInfo *t)
// TODO: maybe the ob->adt check isn't really needed? makes it too difficult to use...
if (/*(ob->adt) && */(t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
short targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
+
+ animrecord_check_state(t->scene, &ob->id, t->animtimer);
autokeyframe_pose_cb_func(t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
}
@@ -745,6 +784,7 @@ void recalcData(TransInfo *t)
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
// TODO: maybe the ob->adt check isn't really needed? makes it too difficult to use...
if (/*(ob->adt) && */(t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+ animrecord_check_state(t->scene, &ob->id, t->animtimer);
autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
}
}