I have this pet peeve: Whenever I create joint hierarchies in Maya, it will automatically setup the joint orientation value for you (based on option set in the ‘Joint Tool’ tool settings). That, is handy. However, the last joint in the chain isn’t auto-oriented: A joint’s auto-orientation is based on the vector between it, and its child. So obviously, the last joint in the chain has no child, so it can’t use this system. The result is, the last joint is always oriented to the worldspace global axis. Which is almost exactly never what I want.
The workaround is easy, just make a little script to process all the joints in a selected hierarchy. But it sure would be nice if they had an option to do this automatically in the UI….
"""
Eric Pavey - 2008-12-19
For the selected hierarchies, zero the joint orient values
on all leaf joints
"""
# Python code
import maya.cmds as mc
kids = mc.listRelatives(mc.ls(selection=True), children=True, type="joint", allDescendents=True)
for k in kids:
if mc.listRelatives(k, children=True, type="joint") is None:
for attr in [".jointOrientX", ".jointOrientY", ".jointOrientZ"]:
mc.setAttr(k+attr, 0)
print "Zeroed '" + k + ".jointOrient'"