Flip Animation Add-On for Mirroring Keyframes in Blender
After wasting a lot of time when flipping Blender animations made for left side to the right and vice versa, I decided to write an add-on doing it automatically. Have you ever been annoyed about copy & paste X-flipped pose frame by frame? See the video tutorial below how to solve this problem in your project.
Blender allows you to copy poses and paste them as X-flipped Pose within one frame provided your bone names conform to the naming convention. This is nice but when animating a run cycle and you have set up the first half of it, you don't want to copy and paste frame by frame.
I found some problems with newer Blender versions 2.6.3-2.6.6a but I'm currently too busy to fix this. See the GitHub repository for the latest version.
See how to solve the problem with the help of this little add-on called Flip Animation (download here). Tip use 720p quality and full screen mode viewing.
- The first part (≈ 90 seconds) shows how to use it.
- The second part contains more details about how to install it, some background information about the implementation and hints for trouble shooting.
In Append Mode all frames within the specified range are copied and the flipped keyframes are appended starting at end frame + 1
If Append Mode is not checked, Flip Animation mirrors the whole action overwriting the existing keyframes with a flipped version
Operates on the current action of the active armature.
Checks if all preconditions are met (hope so)
Installable via user / preferences / add-on
Not (Yet) Implemented
I was thinking about a Select Mode: Consider only those bones that are selected including their counterparts.
- Nice to exclude some bones from mirroring like the hair for example, which looks more natural if its swinging is modelled manually
- Questionable, if this will be used intensively
- Not yet a final idea to implement it
- You have to be in pose mode to see the Flip Animation panel
- If have more than one armature in your scene, Flip Animation operates on the active armature only
- Check that your bones conform to Blender's bone naming conventions. That means suffix _ or . and then R / L, r / l, right / left, Right / Left. Alternatively you can use them as prefix in similar way.
Examples: Hand_R, Hand.r, Hand.Right, … or R_Hand, r.Hand, Right.Hand
- Does the current keying set contain all relevant channels? For example check that you selected LocRotScale if your keyframes define location, rotation and scaling changes
- If the start or end frame is outside of the defined range of the action, the add-on shows a warning messages in the status field of the info menu
- Note that in append mode all existing keyframes within the range needed for appending, are overwritten.
If we for example specify the range 1-5 all frames between 6 and 10 are deleted and the flipped keyframes are inserted instead
- As the code relies on the Blender operators for copy pose and Past X-Flipped Pose it needs some preconditions met, especially regarding Keying Sets.
- There is a button in Timeline View to enable Automatic Keyframe Insertion for Objects And Bones. This little red recording icon. This needs to be enabled. If it's deactivated, a warning message shows up.
- The same applies for other button right to it called Automatic Keyframe Insertion Using Active Keying Set Only. I decided to make it mandatory because if not, the results might be pretty weird and analysis isn't that easy.
- The keying set to use for inserting and deleting keyframes set right here, should fit the needs of your action. In most cases Available should be a good choice. If you have keyframes containing Location and Rotation values but have configured Location only as active keying set, pasting will not consider your rotation keys.
- Sometimes pasting a pose X-flipped leads to kind of weird results. I ran into this occasionally already before I developed the add-on and noticed some issues within the quaternions as the inversion did not perform right and I found myself editing signs of quaternions. Maybe this is solved in the meantime. If you have this problem at one single bone, just modify the rotation slightly and it disappears in many cases.
- Another issue is bone roll. If you have for example a RootIK bone with let's say a bone roll of 90°, translating it to the right results in a change of the Z coordinate in positive direction. But mirroring keeps the Z coordinate although its sign should be inverted in this case. This is because only X coordinates are affected.
If you see strange effects on partial bones, check whether they really behave as expected i.e. transforming along X results in a changed X coordinate and nothing else. If not try to set the bone roll to 0 (edit mode / Properties shelf / Transform / Roll). But this can affect existing actions relying on your previous bone roll value != 0. So take care of testing everything., you have to fix this manually after mirroring.
- I have tested it on Mac OSX 10.7 with Blender 2.58 and on Linux with Blender 2.6.6. On Mac OSX I ran into problems with 2.6.3 and 2.6.6 (s. my the update note above).
- You can download my really ugly (but working :-) SimpleRig.blend to check if it is basically working in your environment.
- If you want to have debug information in the console, set debug_output = True in FlipAnimation.py. On MacOS and Linux you need to start Blender from terminal. Load your modified FlipAnimation.py in a script window and press Run Script
I just finished the add-on, wrote the blog made the video and then it happened: I stumbled upon this forum thread at blender Artists quick and lazy script to mirror a walk cycle. When you scroll down you see a post by user mishurov where he did a similar thing. If I had found that before I would have saved the work as it turned out that there is new version 2.0 for download at Walk Cycle Mirror 2.0. It's a slightly different approach under the hood but similar in the results and the Author (Alexander Mishurov) seems to have done a good job (I have not yet installed it but looked at the code).
Anyway, it was fun to write an add-on and I won't miss it :)