diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-08-01 09:10:57 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-08-01 09:10:57 +0400 |
commit | dc90e758b4c91a0c7e6406498301e82ccecf2fdb (patch) | |
tree | ea9f248f3cf1f6d4392d84b65ba6e49c3a115ef6 /source/blender/editors/transform/transform_generics.c | |
parent | c1438a57db01dfd69c48672451cc6b81d518015f (diff) |
2.5 - More tweaks to realtime record
* New NLA Tracks/Strips are now only created if the 'layered' button (visible in the timeline header when autokeying is on, and the playback is running) is enabled. This multiple bones to be able to be animated in the same action, but done in multiple passes.
* Made Alt-A work in timeline header too.
Diffstat (limited to 'source/blender/editors/transform/transform_generics.c')
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 8a7bc51c19e..2279bf4dff5 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -294,10 +294,12 @@ 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 + /* check if we need a new strip if: + * - if animtimer is running + * - we're not only keying for available channels + * - the option to add new actions for each round is not enabled */ - if (IS_AUTOKEY_FLAG(INSERTAVAIL)==0) { + if (IS_AUTOKEY_FLAG(INSERTAVAIL)==0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) { /* 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); @@ -306,20 +308,26 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer) * 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); + float astart, aend; - /* 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; + /* only push down if action is more than 1-2 frames long */ + calc_action_range(adt->action, &astart, &aend, 1); + if (aend > astart+2.0f) { + 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; + } } } } |