Using the Non Linear Action Editor to mix different actions
It's finally time to use the NLA Editor to compose a longer animation using the actions we built in the previous recipes.
Getting ready
As usual, first let's prepare the screen:
Start Blender and press Ctrl + Alt + U to call the User Preferences panel; in the Editing tab, enable the Allow Negative Frames item.
Click on the Save User Settings button and close the panel.
Load the Gidiosaurus_F-Curves.blend file and switch the Graph Editor to the NLA Editor window, and the Dope Sheet below it with the Action Editor window.
If necessary, click on the X icon button in the Action Editor window toolbar to unlink any action from the rig and clear the pose:
The Animation screen with the (still empty) NLA editor window
How to do it…
We are going to add Action strips to the Gidiosaurus_proxy rig, so it's mandatory to have at least one bone selected (any one, but in this case, it's the ctrl_mouth bone):
Put the mouse cursor in the Track Region (NLA-stack) of the NLA Editor window, right under where it shows Gidiosaurus_proxy | <No Action> items, and press Shift + A to add a NlaTrack channel:
Adding a first track to the NLA Editor window
Now, take a moment and load the Gidiosaurus_walkcycle action in the bottom Action Editor window to see the action extension; it starts at frame -15 and ends at frame 45.
Unlink the action in the Action Editor and move the Time Cursor to negative frame -15; put the mouse cursor in the Strip Edit area to the right side of the NlaTrack item and again press Shift + A. From the pop-up menu, select the Gidiosaurus_Walkcycle item:
Loading the Gidiosaurus_walkcycle action into the track
A yellow action strip, with the Gidiosaurus_Walkcycle name superimposed, is added to the track at the Time Cursor location (the vertical green bar showing the frame number. If you now press the Play button in the Player Control on the Timeline toolbar, the animation starts at frame 1 and because the animation is only 40 frames long, it loops correctly, exactly as if the action was loaded in the Action Editor window.
If not already present, press the N key to call the Properties sidepanel of the NLA Editor window, right-click on the action strip to select it, and then go to the Action Clip subpanel. Under Playback Settings, set the Repeat value to 3.000.
Click on the End button in the Timeline toolbar and change the frame value from 40 to 120 (40 frames x 3):
The Gidiosaurus_walkcycle action set to be repeated three times
If you press the Play button now, the animation is repeated 3 times but it doesn't loop correctly anymore because the negative frames keys are also included, in both the second and third repetitions. This is because we loaded the action at frame -15, so this is the Start Frame value for Action Extents (Start Frame = -15, End Frame = 45).
Hence, some adjustment must be done to the action strip:
First, move the Time Cursor to frame 1; with the strip selected, press the Tab key to go into Edit Mode and make the inner keys of the strip visible, both above the strip in the NLA Editor window, and as an Action in the Action Editor window. This way it's simpler to understand what keys are at what frame, and so on.
Second, go to the Active Strip subpanel and under the Strip Extents item, set the Start Frame value to 1.000.
Go to the Action Clip subpanel and under the Action Extents item, set Start Frame to 1.000 as well and the End Frame value to 41.000:
The action in Edit Mode and the Strip Extents and Action Extents values in the Properties subpanel of the NLA window
Press Tab to go out of Edit Mode.
Now, the walk cycle animation loops correctly for all the 120 frames, and obviously it is also possible to loop it even more by raising the Repeat value.
So, the correct and fastest procedure would have been, from the start:
At frame 1, load the action strip in the NLA Editor window.
In the Properties sidepanel, under the Action Extents item in the Action Clip subpanel, set the Start Frame value to 1.000 and the End Frame value to 41.000.
Under Playback Settings, set the Repeat value to 3.000 and the total length of the animation to 120 frames in the End button of the Timeline toolbar:
Recapitulating the action extents values to be set
Now, let's see how to add the other actions:
Put the mouse cursor under the NlaTrack item and press Shift + A to add a new track (NlaTrack.001); load the Gidiosaurus_Roar action strip and move it (G key) to start at frame 10.
Select the Gidiosaurus_Walkcycle strip and in the Active Strip subpanel, disable the Auto Blend In/Out item but leave the values as 0.000. Select the Gidiosaurus_Roar strip and disable the Auto Blend In/Out item as well, then set the Blend In value to 10.000 and the Blend Out value to 5.000.
Add two more tracks, select the NlaTrack.002 track and load the action strip Gidiosaurus_fingers.L, then select the NlaTrack.003 track and load the action strip Gidiosaurus_fingers.R.
Select the Gidiosaurus_fingers.L strip and in the Active Strip subpanel, disable the Auto Blend In/Out item, and leave the values as 0.000; repeat for the Gidiosaurus_fingers.R strip.
Move the two strips separately in different positions inside the 120 frames animation range.
Setting the Blend In and Blend Out values to mix the other actions
Press the Play button in the Player Control on the Timeline toolbar to watch the composited animation and save the file as Gidiosaurus_NLA.blend.
At this point it could be possible to start to render at least some OpenGL preview to see the result, but there are still several steps missing in our workflow before we reach the final goal, from the texturing to the shaders, lighting, and finally beauty-rendering and compositing; all stuff that we'll see in the next few chapters.