assets/docs/animation.md

74 lines
3.8 KiB
Markdown
Raw Normal View History

2024-01-24 17:16:27 -05:00
# So you wanna animate in Blender?
Various guides for animation.
## Setting Up A New Animation
Upon animating the file, you need to add a new action to the rig. Click on the "New" button on the action editor.
![](images/anim_setup1.png)
Now, name your animation, and configure it to the expected framge range you'll need. The file's animations are currently set to 60 FPS, so 60 frames = 1 second of animation. Also, mark it as cyclic (if it is intended to loop). You can adjust this frame range later if necessary--it's just used for exporting.
![](images/anim_setup2.png)
Finally, hide the Rigify layers you don't want so you can focus more clearly on what you need for blocking out poses. This is the default setup I suggest.
![](images/anim_setup3.png)
Now you're ready to start animating!
## Finalizing an Animation
When you're done with your animation (or want to look at others), go ahead and push it to the NLA stack. You'll have to be on the "AnimationFull" workspace to do this step (see the tabs at the top of the window).
![](images/anim_finalize1.png)
If you're done working on it, mute the track so it doesn't play while working on other animations.
![](images/anim_finalize2.png)
Finally, to reset your rig for further animation, re-enable all the Rigify layers, select all bones in the 3D viewport with the 'A' key (or `Select > All` at the top of the viewport), and then `Pose > Clear Transform > All` to reset bone transforms.
![](images/anim_finalize3.png)
Your rig should be A-posed and ready for more animation!
## Editing Existing Animations
If you want to go back and tweak an already-pushed animation, simply double-click the track, and start it so you can see the preview.
![](images/anim_editing1.png)
When you're done, deselect the track and unstar it.
![](images/anim_editing2.png)
2024-03-06 17:17:16 -05:00
## Exporting Animations
I set up a pipeline for exporting animations that utilizes my Blender add-on, [BoneJuice](https://github.com/arocull/BoneJuice). Please download the `BoneJuice.zip` file from [here](https://github.com/arocull/BoneJuice/releases/), then in Blender go to `Edit > Preferences > Add-Ons > Install`, and select the file.
Once installed, open the animation file you want to export from. Go to the `Scripting` workspace. You might be greeted with some code. This may be out of date, so load the latest pipeline script by opening the new file (red arrow), located at `assets/pipeline/export_anims.py`.
![](images/anim_export1.png)
Once you have the file loaded, click on the character's armature in the viewport to make it active, then run the script (blue arrow).
If the script fails:
- Make sure that the character Armature is your active object
- Make sure you're not editing any animations, and that all animations are pushed to the NLA stack
- Make sure the corresponding output directory exists (`assets/export/infantry/` or `assets/export/insurrectionist/`, you may have to make these manually as they aren't synced with git)
Once the script is run, **do not save the file**.
The pipeline makes changes to the file, bakes out your animations, and intentionally breaks the rig.
If you do accidentally save the file, you can discard your changes via Git Desktop.
Your animations should be exported to the corresponding folder in `assets/export/` as an FBX file.
You can drag this FBX file into the Content folder of Unreal, preferably in the `Content/Characters/Infantry/Animations` (...or `Content/Characters/Insurrectionist/Animations/`).
When the prompt comes up for importing animations, **uncheck the Import Mesh setting, and assign the proper corresponding skeleton**. Then, press the Import All button at the end.
![](images/anim_import1.png)
Finally, make sure any looping animations are actually marked to loop.
![](images/anim_import2.png)
And viola! The implementation of animations from here on out relies on the Animation Blueprint.