Monday, September 30, 2013

Rotation Select Axis

Handy little tool to select individual rotation axis handle quicker. Good also for when manipulator gets in the way of select correct axis, and when in gimbal lock.

Its a short one, so just quicker to copy and paste :)
Here's the code
import maya.cmds as cmds
from functools import partial

def rotateContext(axis, *args):
 cmds.manipRotateContext( 'Rotate', e=True, ah=axis)
if cmds.window("rotateContextUI", exists=True):
win = cmds.window("rotateContextUI", title="Rotate Axis UI", w=150, sizeable=False)
cmds.rowColumnLayout(nc=3, columnAttach=[(1,"both", 2), (3, "both", 2)])

cmds.button("X", w=30, bgc=[1,0,0], c=partial(rotateContext, 0))
cmds.button("Y", w=30, bgc=[0,1,0], c=partial(rotateContext, 1))
cmds.button("Z", w=30, bgc=[0,0,1], c=partial(rotateContext, 2))



Post a Comment