This command associates a command string (i.e. a mel script) with the input device. When the device moves or a button on the device is pressed, the command string is executed as if you typed it into the window. If the command string contains the names of buttons or axes of the device, the current value of these buttons/axes are substituted in. Buttons are reported as booleans and axes as doubles. This command is most useful for associating buttons on a device with commands. For using a device to capture continous movements it is much more efficient to attach the device directly into the dependency graph.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
clutch (c) | unicode | ||
specify a clutch button. This button must be down for the command string to be executed. If no clutch is specified the command string is executed everytime the device state changes |
|||
continuous (ct) | bool | ||
if this flag is set the command string is continously (once for everytime the device changes state). By default if a clutch button is specified the command string is only executed once when the button is pressed. |
|||
device (d) | unicode | ||
|
|||
immediate (im) | bool | ||
Immediately executes the command, without using the queue.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
multiple (m) | bool | ||
if this flag is set the other command strings associated with this device are not deleted. By default, when a new command string is attached to the device, all other command strings are deleted. |
Derived from mel command maya.cmds.assignInputDevice
Example:
import pymel.core as pm
pm.assignInputDevice( 'setKeyframe', d='spaceball', c='Button1' )
# This command will assign button1 on the spaceball with
# the setKeyframe command. This is very much like using
# the spaceball buttons as hotkeys.
pm.assignInputDevice( '"currentTime -e Axis0"', d='midi', ct=True, m=True )
# This command will execute the command to set the time
# to the value of the first midi slider. As the slider
# moves this command will be executed. So the slider
# will control time.