pymel.core.windows.nameCommand

nameCommand(*args, **kwargs)

This command creates a nameCommand object. Each nameCommand object can be connected to a hotkey. Thereafter, the nameCommand’s command string will be executed whenever the hotkey is pressed (or released, as specified by the user).

Flags:

Long Name / Short Name Argument Types Properties
annotation / ann unicode ../../../_images/create.gif
  A description of the command.
command / c script ../../../_images/create.gif
  The command that is executed when the nameCommand is invoked.
data1 / da1 unicode ../../../_images/create.gif
   
data2 / da2 unicode ../../../_images/create.gif
   
data3 / da3 unicode ../../../_images/create.gif
  These are optional, user-defined data strings that are attached to the nameCommand object. They can be edited or queried using the assignCommand command.
default / d bool ../../../_images/create.gif
  Indicate that this name command is a default command. Default name commands will not be saved to preferences.
sourceType / stp unicode ../../../_images/create.gif
  Sets the language type for the command script. Can only be used in conjunction with the -command flag. Valid values are mel(enabled by default), and python. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.nameCommand

Example:

import pymel.core as pm

# Create a nameCommand object.
#
pm.nameCommand( 'circleToolNameCommand', ann='The Circle Tool', c='pm.setToolTo("circleContext")' )
# Result: u'circleToolNameCommand' #

# Now map the nameCommand to a hotkey.
#
pm.hotkey( keyShortcut='F5', altModifier=True, name='circleToolNameCommand' )