Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Maya script that forces the Local Rotation Axis display on or off for all joints/transforms or the selected joints/transforms.
import maya.cmds as cmds
# bm_axisDisplay
# Forces the Local Rotation Axis display on or off for all joints or for the selected joints or transforms
def setAxisDisplay(display=False, allObj=False):
# if no joints are selected, do it for all the joints in the scene
# if allObj flag is True then this will toggle the axis display for all objects in the scene, not just joints.
if not allObj:
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)
else:
if len(cmds.ls(sl=1)) == 0:
objList = cmds.ls(transforms=1)
else:
objList = cmds.ls(sl=1)
# set the displayLocalAxis attribute to what the user specifies.
for obj in objList:
cmds.setAttr(obj + ".displayLocalAxis", display)
# turn off the Local Rotation Axis display for all transform nodes in the scene
setAxisDisplay(display=False,allObj=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.