Go to: Synopsis. Return value. Related. Flags. Python examples.
hotkeySet(
[name]
, [current=boolean], [delete=boolean], [exists=boolean], [export=string], [hotkeySetArray=boolean], [ip=string], [rename=string], [source=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
hotkeySet is undoable, queryable, and editable.
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.
string | The name of the hotkey set. |
In query mode, return type is based on queried flag.
hotkey, hotkeyCtx
current, delete, exists, export, hotkeySetArray, ip, rename, source
Long name (short name) |
Argument types |
Properties |
|
current(cu)
|
boolean
|
|
|
Sets the hotkey set as the current active hotkey set. In query mode, returns the name of
the current hotkey set.
|
|
delete(delete)
|
boolean
|
|
|
Deletes the hotkey set if it exists. Other flags are ignored.
Returns true|false depending on the delete operation.
|
|
exists(ex)
|
boolean
|
|
|
Returns true|false depending upon whether the specified object
exists. Other flags are ignored.
|
|
export(ep)
|
string
|
|
|
Exports a hotkey set. The argument is used to specify a full path of the output file.
|
|
hotkeySetArray(hsa)
|
boolean
|
|
|
Returns a string array of all existing hotkey set names.
|
|
ip(ip)
|
string
|
|
|
Imports a hotkey set. The argument is used to specify a full path of the hotkey set file to import.
|
|
rename(re)
|
string
|
|
|
Renames an existing hotkey set. All white spaces will be replaced with '_' during operation.
|
|
source(src)
|
string
|
|
|
Specifies the source hotkey set. If flag is not provided, the current active hotkey set is used.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can have multiple arguments, passed either as a tuple or a list.
|
import maya.cmds as cmds
# 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'
cmds.hotkeySet( MyNewKeySet, current=True )
# Query the name of the current key set
cmds.hotkeySet( q=True, current=True )
# Create a new hotkey set with a user hotkey set as source
MyNewKeySet2 = 'MyNewKeySet2'
cmds.hotkeySet( MyNewKeySet2, source='MyNewKeySet' )
# Delete the created hotkey set.
cmds.hotkeySet( MyNewKeySet, edit=True, delete=True )
# Returns all available hotkey sets in Maya
cmds.hotkeySet( q=True, hotkeySetArray=True )
# Export a hotkey set
fileName = (cmds.internalVar( userTmpDir=True ) + "exportHotkeySet1.mhk");
cmds.hotkeySet( MyNewKeySet2, e=True, export=fileName);
# Import a hotkey set
cmds.hotkeySet( e=True, ip=fileName);