Go to: Synopsis. Return value. Flags. Python examples.
overrideModifier([clear=boolean], [press=string], [release=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
overrideModifier is undoable, NOT queryable, and NOT editable.
This command allows you to assign modifier key behaviour to other parts of the system. For example you can use a hotkey or input device instead of a modifer key to perform the same action.Note that the original modifier key behaviour is not altered in anyway. For example, if you've assigned "Ctrl" key behaviour to the "c" key then the "Ctrl" key will still work as you expect, all you've done is allowed yourself to use the "c" key as an alternative to the "Ctrl" key.
None
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
clear(cl)
|
boolean
|
![]() |
||
|
||||
press(p)
|
string
|
![]() ![]() |
||
|
||||
release(r)
|
string
|
![]() ![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds # Example 1. # # Map the "a" key such that it behaves just like the "Alt" key. # cmds.nameCommand( 'alternateAltPressCommand', annotation='"Alternate Alt-press modifier key"', command='"overrideModifier -press Alt"' ) cmds.nameCommand( 'alternateAltReleaseCommand', annotation='"Alternate Alt-release modifier key"', command='"overrideModifier -release Alt"' ) cmds.hotkey( keyShortcut='a', name='alternateAltPressCommand' ) cmds.hotkey( keyShortcut='a', releaseName='alternateAltPressCommand' ) # Example 2. # # The following should restore the "a" hotkey to what it was # previously. # cmds.overrideModifier( clear=True ) cmds.hotkey( factorySettings=True ) cmds.hotkey( sourceUserHotkeys=True )