I have an animation of my character holding a lamp with the right hand. I want to mirror this animation to get my character holding a lamp with the left hand. For each frame I can copy pose and paste it x-flipped. However, I've got many frames and it will take a long time to perform such operation for each frame. Is there any way to do it faster?
Asked
Active
Viewed 1.1k times
6
-
1Does this stil work http://blender.stackexchange.com/questions/18190/can-i-mirror-animations-on-bones/18191#18191 ? – stacker May 30 '15 at 22:33
-
Yes but I have to copy-paste pose for each keyframe which is long – Zelta May 30 '15 at 22:36
3 Answers
3
Mirroring a pose (animation):
- Open the Dope Sheet:
- Select your keyframes (e. g. via Border select or circle select etc.) or just press A to select them all.
- Press Ctrl + C to copy them.
- Navigate to the place where you want to paste them and press Ctrl + Shift + V. This will paste the selected keyframes but it will flip the pose (in order to flip the pose correctly you'll need to name the bones like this: PartOfTheBody_L and PartOfTheBody_R (Left and Right)
Playing an animation in reverse:
- Open the Dope Sheet:
- Press A to select all keyframes.
- Press Shift + D to duplicate them and drag them to the place where you want.
- Navigate to the last duplicated keyframe.
- Press Shift + M to open up the Mirror Keys menu and klick on 'By Times over Current frame'.
Splines
- 124
- 11
2
So after some googling and reading API I came up with a little script to automate the process:
import bpy
scn = bpy.context.scene
bpy.ops.object.mode_set(mode='POSE')
bpy.ops.pose.select_all(action='SELECT')
initial_keyframe = scn.frame_current
scn.frame_set(0)
while True:
bpy.ops.anim.keyframe_insert()
if 'FINISHED' not in bpy.ops.screen.keyframe_jump(next=True):
break
else:
# A hook to update bone positions after jump.
# See http://blender.stackexchange.com/a/8534/14703
scn.frame_set(scn.frame_current)
scn.frame_set(0)
while True:
bpy.ops.pose.copy()
bpy.ops.pose.paste(flipped=True)
bpy.ops.anim.keyframe_insert()
if 'FINISHED' not in bpy.ops.screen.keyframe_jump(next=True):
break
else:
scn.frame_set(scn.frame_current)
scn.frame_set(initial_keyframe)
Running this will x-flip all frames in the animation. Unfortunately copying and pasting pose creates unwanted keyframes so you may want to clean up the result manually.
Zelta
- 181
- 1
- 1
- 6
0
Easy, select the armature in the outliner and then over the viewport Right-Click Mirror > X Global or Y or Z depending on your specific case, then hit Space Bar .
Duarte Farrajota Ramos
- 59,425
- 39
- 130
- 187
Misael
- 1