Home Website Youtube GitHub

[Solved] Wrist rotation control won't freeze transform

Hello mGear community! I’m new here and trying to learn mGear. 3.60

I have set up a biped rig using the biped template from shifter.

Once I place then guides and build skeleton. The wrist rotation controls are not freeze transformed.
This is with IK wrist which controls rotation and translation for wrist.

After building rig from guides the rotation channel has values and I want them to be 0.

Please let me know if there’s a solution for this. Thank you

1 Like

Hi welcome,

First of all, understand that there is a difference between zeroing out a control, and “freeze transforming” a control. I don’t recommend freezing any controls.

arm_L0_ikcns_ctl is world-aligned by default. You can fix this in a post Python script if you like.

This script aligns the parent of arm_L0_ik_ctl to match. Then adds another zero-out parent to arm_L0_ikcns_ctl to zero it out.

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_ikcns_ctl'.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)
4 Likes

Thank you so much Chrislesage! :star_struck:

The script worked. I was doing it manually earlier, but this saves so much time. You’re the best!

Newbies to scripting. Add the line below at the top of the script for it to work.

import pymel.core as pm

1 Like

Ah yes, thanks, edited that!

1 Like

Hello,

I’m having a similar issue.
I ran this code and it created an offset group. But when I re-set to the bind pose it reverts back to having those values back.

I guess it’s the issue with the picker setting it back to the “default” pose it remembers.

Is there a way to update the picker?

Hi Valeriya,

Can you clarify what you’re trying to do? Are you talking about “Go to bind pose” in the Maya skin menu, or a button or function in the Anim Picker? I know you can “Reset” in the mGear right-click menu. I’m not familiar with a reset button in the Picker.

But they are different things. Bind pose is related to joint skeletons. Resetting a controller works on the transform values of controllers.

The mGear “Reset” should set the controller to 0,0,0,0,0,0,1,1,1. I might be wrong, but I don’t think it remembers any default pose values in translate/rotate/scale.

So if it is going to the wrong pose, there might be something else to investigate. There might be an offset in the parent transform it added. Maybe you had a warning or error when running the script above? Or maybe your rig is setup in a different way, and the script needs to be altered to better suit your rig.

Thank you for your reply

I see… I was pressing the wrong thing. I was pressing the pink button in the picker “Reset Bind Pose” thinking that it would reset to the default pose. If I press that, the hand IK control snaps back to having values in the rotation channels. Is this correct?

Ah I see. You are using the “Synoptic”, not the “Anim Picker”. They are two different tools.

That button name is misleading, since “bind pose” is related to skeletons. (Or at least I thought so… Maybe you can store and reset anything with a dagPose node. I guess I’m not sure.)

The Anim Picker is very easy to edit and customize. The Synoptic is very difficult and strange to customize (in my opinion). And Miquel has said, “It is recommended to use Anim_picker. Synoptic is not in development anymore”.


As for your wrist problem, can you screenshot the values on your wrist control after you run my script above? Maybe we can still figure that out.

AND, if you go to the mGear menu and check “mGear Viewport Menu”, you can right click on controls and hit “Reset”. Or you can go to the menu, Animbits → Smart Reset Attributes SRT. If you reset the wrist in those ways, does it also snap to the wrong position?

1 Like

Oh, that is actually a good point.

I was wandering if it is possible to edit the picker = Synoptic.
My animation friends were complaining that Synoptic was confusing.
Where can I find some information on creating actual picker?

It seems I can’t upload images here yet as a new user.

Hello all,

I’m having the same issue. but when i run the above script i get this error msg :

"# Error: unexpected indent # "

i tried running the script line by line to see where it hits a snag and its at this line :

transform.matchWorldTransform(ikCtrl, ikCns)

when i run the full thing in one go i get this error :

# Error: MayaNodeError: file C:\Program Files\Autodesk\Maya2019\Python\lib\site-packages\pymel\core\general.py line 2282: Maya Node does not exist (or is not unique):: u’arm_L0_ikcns_ctl’ #

I’m having this issues on the “Epic_arm_01” component

Ty for the help.

"# Error: unexpected indent # " python is strict in with indentation (with tabs or using spaces) Please review that :wink:

wow ty for the really quick answer.
But i did a direct copy paste of the script above.

PrtScr capture_3

where am i going wrong?

Update

I just tested the script on the regular biped and it works like a charm!

I think the issue is that the “Epic_Arm” component does not have a “_ikcns_ctl”
or the Nomenclature is different so its not working… my crappy scripting brain is trying to figure this out but its not working >.<

oh! yes the other error is that can find u’arm_L0_ikcns_ctl
I should have read more carefully your previous post :sweat_smile:

Yeah but u’arm_L0_ikcns_ctl does not exist in the Epic Arm
(on a side note i have no clue where the “u” is coming from in the u’arm_L0_ikcns_ctl)

I tired renaming arm_l_ikcns on the rig to arm_L0_ikcns_ctl (on boths sides) and it didn’t work

I also tried changing this line of code :

ikCns = pm.PyNode(‘arm_{}0_ikcns_ctl’.format(side))
to this:
ikCns = pm.PyNode(‘arm_{}0_ikcns’.format(side))

To no avail.

i mean i can do it manually to create the dummy grp to hold the “dirty” transforms. But having to do this manually every time does kinda suck.

And i still don’t know where i’m going wrong with changes on the script.
This is the “Epic_Arm” hierarchy in maya
PrtScr capture_4

It’s hard to tell where you’re getting stuck, because you’re showing several different combinations of names. And the code example you said doesn’t match the outliner screenshot you posted.

You said you changed the code to
ikCns = pm.PyNode('arm_{}0_ikcns'.format(side))
That would be arm_L0_ikcns
And your outliner screenshot is arm_l_ikcns

I know you said you tried different names, but it’s a bit difficult to follow what combination of things you tried.

The only 2 things I can think of:

  1. Make sure you make a note of the difference between L vs. l. It seems like you are already trying to fix that. If you want to use lowercase l and r, you’d need to change to
    for side in 'lr':
  2. If you get an error, Maya Node does not exist (or is not unique) either the name doesn’t match, OR check that there isn’t already a node with the same name. If there are 2 nodes with the same name, you’ll get the same error.

<3 you guys. TY for all the help.
It was a bit of everything that i was getting wrong… lol . . .
I guess my dyslexia is not helping either. BUT finally got it to work.

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

def fix_ik_hand_orientation(side):
ikCns = pm.PyNode(‘arm_{}_ikcns’.format(side))
ikCtrl = pm.PyNode('arm
{}_ik’.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)

This is the version that worked for me