pymel.core.windows.overrideModifier¶
- overrideModifier(*args, **kwargs)¶
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 Ctrlkey behaviour to the ckey then the Ctrlkey will still work as you expect, all you’ve done is allowed yourself to use the ckey as an alternative to the Ctrlkey.
Flags:
Long Name / Short Name Argument Types Properties clear / cl bool Don’t force any modifier keys. press / p unicode Force the following modifier to be pressed. Valid values are Alt, Ctrl, Shift. release / r unicode Force the following modifier to be released. Valid values are Alt, Ctrl, Shift. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.overrideModifier
Example:
import pymel.core as pm # Example 1. # # Map the "a" key such that it behaves just like the "Alt" key. # pm.nameCommand( 'alternateAltPressCommand', annotation='"Alternate Alt-press modifier key"', command='"overrideModifier -press Alt"' ) # Result: u'alternateAltPressCommand' # pm.nameCommand( 'alternateAltReleaseCommand', annotation='"Alternate Alt-release modifier key"', command='"overrideModifier -release Alt"' ) # Result: u'alternateAltReleaseCommand' # pm.hotkey( keyShortcut='a', name='alternateAltPressCommand' ) pm.hotkey( keyShortcut='a', releaseName='alternateAltPressCommand' ) # Example 2. # # The following should restore the "a" hotkey to what it was # previously. # pm.overrideModifier( clear=True ) pm.hotkey( factorySettings=True ) pm.hotkey( sourceUserHotkeys=True )