Auto Joint Orientations in Maya

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'"
Updated 'Processing Sketches' page
  • Trackback are closed
  • Comments (3)
    • Los
    • February 18th, 2009 10:12am

    Just used it. Very nice. Thanks Eric!

  1. Excellent. Glad it works for you :)

    • DarenGMcDougal
    • November 9th, 2011 9:16pm

    So great thanks Eric for your information your so excellent.

Comment are closed.