Home Website Youtube GitHub

How to create a mirror and flip buttons in the new anim picker?

Hi, I’m creating a facial anim picker with the new anim picker included in mGear and I would like to add the typical Mirror, Reset and Flip pose buttons. The problem is that I have 0 knowledge of programming so I don’t know the code to do that. Is there any place or example where I can copy/paste that code? The anim picker template doesn’t have those buttons.
I know that those options are already included in the new mGear viewport menu but I would like to include them also in the picker.
Thanks a lot for your help.
PS: As you can see in the image I already added the Select All and Key All buttons but because I could copy/paste de code from your template.

@Mac
Try this:

import pymel.core as pm
from mgear.core.anim_utils import mirrorPose

current_selection = cmds.ls(selection=True)
controls = [pm.PyNode(x) for x in current_selection]
for ctl in controls:
     '''
     Flip: flip = True
     Mirror: flip = False
     '''
     mirrorPose(flip=False, nodes=[ctl])
1 Like

Hello @Mac

Be careful that you will need to add the init check before running your code.
Check this post

Cheers

1 Like

Thanks a lot guys, this is the way that I did it and it works :wink:

“Mirror pose”

import pymel.core as pm
import maya.cmds as cmds
from mgear.core.anim_utils import mirrorPose
if not INIT:
current_selection = cmds.ls(selection=True)
controls = [pm.PyNode(x) for x in current_selection]
for ctl in controls:
mirrorPose(flip=False, nodes=[ctl])

“Flip pose”

import pymel.core as pm
import maya.cmds as cmds
from mgear.core.anim_utils import mirrorPose
if not INIT:
current_selection = cmds.ls(selection=True)
controls = [pm.PyNode(x) for x in current_selection]
for ctl in controls:
mirrorPose(flip=True, nodes=[ctl])

1 Like