Home Website Youtube GitHub

5.1 EPIC_Arm_02 Wrist IK Not zeroed out

hello again,

This was an issue that was address in the past but the fix for it no longer seems to be working. :frowning:

this is the Original post : [Solved] Wrist rotation control won't freeze transform

but when i run the script to fix the issue i’m getting a whole new error that i can’t figure out.
(I had to change some of the string to match my naming convention but the rest is the same script

import pymel.core as pm
from mgear.core import transform
from mgear import rigbits

def fix_ik_hand_orientation(side):
    ikCns = pm.PyNode('arm_{}0_ik_cns'.format(side))
    ikCtrl = pm.PyNode('arm_{}0_ik_ctl'.format(side))
    handChildren = ikCtrl.getChildren(type='transform')
    
    transform.matchWorldTransform(ikCtrl, ikCns)
    transform.matchWorldTransform(ikCns, ikCtrl)
    zeroOut = rigbits.addNPO(ikCns)[0]
    zeroOut.rename('arm_{}0_ikcns_zero'.format(side))
    
for side in 'LR':
    fix_ik_hand_orientation(side)

Error: RuntimeError: file C:\Users\Hobbz\Documents\maya\modules\scripts\mgear\pymaya\cmd.py line 266: Error occurred while calling wrapped function ‘maya.cmds.createNode’: Invalid arguments for flag ‘p’. Expected string, got Transform
Arguments: (‘transform’,)
Keyword Arguments: {‘n’: ‘arm_L0_ik_cns_npo’, ‘p’: nt.Transform(‘spine_C0_1_cnx|arm_L0_root’), ‘ss’: True}
Command for debugging: maya.cmds.createNode(‘transform’, n=‘arm_L0_ik_cns_npo’, p=nt.Transform(‘spine_C0_1_cnx|arm_L0_root’), ss=True)

Thanks agian!

mGear 5 doesn’t use PyMel anymore, and it looks like you are trying to pass PyNodes to the commands.

You’ll have to use the PyNode.name() or whatever the mGear commands equivalent is.

The error is saying it is expecting a string, but you sent it a transform.

1 Like

Ok but i used the same script you gave us last time :stuck_out_tongue:

Would you per chance have an updated version of it that works without Pymel

And mGear has drastically changed since then. :man_shrugging: :sweat_smile:

No, I’m still using mGear 4.x.x. But you just have to change it to strings, as far as I can tell. You can try this. I don’t have Maya open to test it:

import pymel.core as pm
from mgear.core import transform
from mgear import rigbits

def fix_ik_hand_orientation(side):
    ikCns = pm.PyNode('arm_{}0_ik_cns'.format(side))
    ikCtrl = pm.PyNode('arm_{}0_ik_ctl'.format(side))
    handChildren = ikCtrl.getChildren(type='transform')
    
    transform.matchWorldTransform(ikCtrl.name(), ikCns.name())
    transform.matchWorldTransform(ikCns.name(), ikCtrl.name())
    zeroOut = rigbits.addNPO(ikCns.name())[0]
    zeroOut.rename('arm_{}0_ikcns_zero'.format(side))
    
for side in 'LR':
    fix_ik_hand_orientation(side)
1 Like

:frowning:

Error: AttributeError: file C:\Users\Hobbz\Documents\maya\modules\scripts\mgear\core\transform.py line 589: ‘str’ object has no attribute ‘getMatrix’

Well I can’t help further since I haven’t upgraded yet. You can try removing the .name() from the transform.matchWorldTransform() commands. Or you can use pm.matchTransform(ikCtrl, ikCns, space='world') instead. You’ll need to check what each command expects as input. mGear might have it’s own PyNode-like node to pass to the commands too.

1 Like

i mean worse case i can just do the fix manually and just make a null grp to hold the “dirty” transforms in it. it was just handy having the script.

Ty for taking the time though