Joint Rotation Axis Hide/Show Script

While rigging last night, I wrote this little script that forces the Local Rotation Axis display On/Off. This is different from Display–>Transform Display–>Local Rotation Axis because that works as a toggle, while this accesses the actual attribute  (“obj.displayLocalAxis”) and sets it to True or False.

Here’s the code. It’s a really simple tool that fixes a big annoyance for me in Maya.

import maya.cmds as cmds

# bm_axisDisplay
# Forces the Local Rotation Axis display on or off for all joints or for the selected joints

def setAxisDisplay(display=False):
    # if no joints are selected, do it for all the joints in the scene
    if len(cmds.ls(sl=1, type="joint")) == 0:
        jointList = cmds.ls(type="joint")
    else:
        jointList = cmds.ls(sl=1, type="joint")
    # set the displayLocalAxis attribute to what the user specifies.
    for jnt in jointList:
        cmds.setAttr(jnt + ".displayLocalAxis", display)


"""
import bm_axisDisplay
reload(bm_axisDisplay)
bm_axisDisplay.setAxisDisplay(False)
"""
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