Last active
August 12, 2024 07:41
-
-
Save benmorgantd/9fe73ed80481913047f41b60eba10915 to your computer and use it in GitHub Desktop.
Maya script that forces the Local Rotation Axis display on or off for all joints/transforms or the selected joints/transforms.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
it doesn't work in maya 2023