Quick Orient Joint Chain Script

This one comes in handy a lot.

When you go to orient a group of joints, it never correctly orients the end joint in the chain. That frustrated me, so I decided to write a quick script that does it for you.

All it does is orient the selected and set the jointOrients of the last relative of the selected joint in the chain to zero. Obviously this doesn’t work in every situation, but I found it works great in small joint chain situations like FK feet.

If anything, it might save me some time from manually setting joint orientations. The more I can do that, the better 😛

import maya.cmds as cmds

# orient joint chain
# Orients the joints in a chain to normal attributes then nulls the orients
# of the last joint

def orientJointChain():
    sel = cmds.ls(sl=1,o=1,type="joint")
    cmds.OrientJoint()
    jointChildren = cmds.listRelatives(sel,ad=1)
    endJoint = jointChildren[0]
    cmds.setAttr(endJoint + ".jointOrientX",0)
    cmds.setAttr(endJoint + ".jointOrientY",0)
    cmds.setAttr(endJoint + ".jointOrientZ",0)

orientJointChain()

 

Advertisements
Image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s