pymel.core.windows.hotkeySet¶
- hotkeySet(*args, **kwargs)¶
Manages hotkey sets in Maya. A hotkey set holds hotkey to command mapping information. Default hotkey sets are hotkey sets that are shipped together with Maya. They are locked and cannot be altered. A new hotkey set is always duplicated from an existing hotkey set. In create mode, users can choose to specify which hotkey set to duplicate by using the -source flag. A duplicated hotkey set is independent from the source hotkey set.
Flags:
Long Name / Short Name Argument Types Properties current / cu bool Sets the hotkey set as the current active hotkey set. In query mode, returns the name of the current hotkey set. delete / delete bool Deletes the hotkey set if it exists. Other flags are ignored. Returns true|false depending on the delete operation. exists / ex bool Returns true|false depending upon whether the specified object exists. Other flags are ignored. export / ep unicode Exports a hotkey set. The argument is used to specify a full path of the output file. hotkeySetArray / hsa bool Returns a string array of all existing hotkey set names. ip / ip unicode Imports a hotkey set. The argument is used to specify a full path of the hotkey set file to import. rename / re unicode Renames an existing hotkey set. All white spaces will be replaced with ‘_’ during operation. source / src unicode Specifies the source hotkey set. If flag is not provided, the current active hotkey set is used. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.hotkeySet
Example:
- ::
import pymel.core as pm
# Create a new key set and set it as the active key set. # The current active hotkey set is used as its source. MyNewKeySet = ‘MyNewKeySet’ pm.hotkeySet( MyNewKeySet, current=True ) # Result: u’MyNewKeySet’ #
# Query the name of the current key set pm.hotkeySet( q=True, current=True ) # Result: u’MyNewKeySet’ #
# Create a new hotkey set with a user hotkey set as source MyNewKeySet2 = ‘MyNewKeySet2’ pm.hotkeySet( MyNewKeySet2, source=’MyNewKeySet’ ) # Result: u’MyNewKeySet2’ #
# Delete the created hotkey set. pm.hotkeySet( MyNewKeySet, edit=True, delete=True ) # Result: True #
# Returns all available hotkey sets in Maya pm.hotkeySet( q=True, hotkeySetArray=True ) # Result: [u’MyNewKeySet2’, u’Maya_Default’] #
# Export a hotkey set fileName = (pm.internalVar( userTmpDir=True ) + “exportHotkeySet1.mhk”); pm.hotkeySet( MyNewKeySet2, e=True, export=fileName);
# Import a hotkey set pm.hotkeySet( e=True, ip=fileName);