A quick little hotkey for Maya. It simply toggles between the world and object modes of the move, rotate, and scale tools.
It came about after a request from a friend who was getting frustrated whilst working on a task which had him switching between modes a lot. Hopefully others may find it useful as well so feel free to grab the script below, paste into your hotkey editor and assign a key (make sure you have the language set to Python). And I’m sure this could be made more elegant, so if you have a different way of doing it I’d love to see!
'''Simple hotkey command to toggle between object and world modes for
Move, Rotate, and Scale contexts'''
import maya.cmds as cmds
# I want to toggle independently based on what context is being used,
# So the first thing I need to do is get the current context.
current_context = cmds.currentCtx()
# Then there is a different if/else statement depending on context.
if current_context == 'moveSuperContext':
mode = cmds.manipMoveContext( 'Move', q=True, mode=True )
if not mode:
cmds.manipMoveContext( 'Move', e=True, mode=2 )
else:
cmds.manipMoveContext( 'Move', e=True, mode=0 )
if current_context == 'RotateSuperContext':
mode = cmds.manipRotateContext( 'Rotate', q=True, mode=True )
if not mode:
cmds.manipRotateContext( 'Rotate', e=True, mode=1 )
else:
cmds.manipRotateContext( 'Rotate', e=True, mode=0 )
if current_context == 'scaleSuperContext':
mode = cmds.manipScaleContext( 'Scale', q=True, mode=True )
if not mode:
cmds.manipScaleContext( 'Scale', e=True, mode=2 )
else:
cmds.manipScaleContext( 'Scale', e=True, mode=0 )
As a quick side, for the same friend I’m also working on a little widget that can be used to save and recall custom axis orientation in a single click, when it’s ready to go I’ll post it up!