- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey, I hope this is the right place to post this question.
I have been working on this Python code to be able to get a hierarchy of joints and display their local rotation axis. Here is what happens: when the "Show Axis" button is pressed it selects the joint hierarchy but only the first joint has the LRA displayed, but when I press the button again the other joints also display their LRA. It should be that all joints show the LRA when the button is pressed.
Here is the code:
from maya import cmds
window = cmds.window( title="Local Rotation Axis", iconName="LRA", widthHeight=(300, 55))
cmds.columnLayout( adjustableColumn=True)
cmds.button( label="Show Axis", c = "showAxis()") ## c = The function to be activated when the button is pressed.
cmds.button( label="Hide Axis", c = "hideAxis()")
cmds.showWindow ( window )
def showAxis(display=True):
selectJoints = cmds.ls(sl=True)
cmds.select(selectJoints, hi=True)
for jnt in selectJoints:
cmds.setAttr(jnt + ".displayLocalAxis", display)
def hideAxis(display=False):
hideJoints = cmds.ls(sl=True)
cmds.select(hideJoints, hi=True)
for jnt in hideJoints:
cmds.setAttr(jnt + ".displayLocalAxis", display)
Any ideas why this is happening? Any help would be appreciated!
Thanks
Solved! Go to Solution.