Skip to content

Instantly share code, notes, and snippets.

@benmorgantd
Last active August 12, 2024 07:41
Show Gist options
  • Save benmorgantd/9fe73ed80481913047f41b60eba10915 to your computer and use it in GitHub Desktop.
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.
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)
@fislysandi
Copy link

holy shit thank you so much.

maya had 22 fucking years to implement this 😂

@Aziz9946
Copy link

it doesn't work in maya 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment