Skip to content

Instantly share code, notes, and snippets.

@jocelynkim
Created February 6, 2019 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jocelynkim/430c163a90826f16994a9398c7fe477c to your computer and use it in GitHub Desktop.
Save jocelynkim/430c163a90826f16994a9398c7fe477c to your computer and use it in GitHub Desktop.
Maya script that force toggles all Local Rotation Axis displays to be on or off, for all joints or for selected joints/transforms.
from pymel.core import *
# toggleLRA()
# Function: force toggles all Local Rotation Axis displays to be on or off, for all joints or for selected joints/transforms.
# Jocelyn Kim - repurposed script from benmorgantd's gist, bm_axisDisplay. Thank you!!! :)
win = window(title="Toggle Local Rotation Axis Displays", rtf=True)
layout = columnLayout()
chkBox = checkBox(label = "Display LRAs?", value = True, parent = layout)
btn = button(label = "TOGGLE!", parent = layout)
def buttonPressed (*args):
# check if user specifies any kind of selection
if len(cmds.ls(sl=1, type="joint")) == 0 or len(cmds.ls(sl=1)) == 0:
allObj = False
else:
allObj = True
# for ALL joints in the scene...
if allObj:
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", chkBox.getValue())
# for the joints that the user selected...
else:
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", chkBox.getValue())
btn.setCommand (buttonPressed)
win.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment