4
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

Mirroring a pose (animation):

  1. Open the Dope Sheet:
  2. Select your keyframes (e. g. via Border select or circle select etc.) or just press A to select them all.
  3. Press Ctrl + C to copy them.
  4. 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:

  1. Open the Dope Sheet:
  2. Press A to select all keyframes.
  3. Press Shift + D to duplicate them and drag them to the place where you want.
  4. Navigate to the last duplicated keyframe.
  5. Press Shift + M to open up the Mirror Keys menu and klick on 'By Times over Current frame'.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.