Go to: Synopsis. Return value. Related. Flags. MEL examples.

Synopsis

assignInputDevice [-clutch string] [-continuous] [-device string] [-immediate] [-multiple]

assignInputDevice is undoable, queryable, and NOT editable.

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.

Return value

stringCommand result

In query mode, return type is based on queried flag.

Related

attachDeviceAttr, detachDeviceAttr, devicePanel, getInputDeviceRange, getModifiers, listDeviceAttachments, listInputDeviceAxes, listInputDeviceButtons, listInputDevices, recordAttr, setAttrMapping, setInputDeviceMapping, unassignInputDevice

Flags

clutch, continuous, device, immediate, multiple
Long name (short name) Argument types Properties
-clutch(-c) string create
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) create
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) string create
specify which device to assign the command string.
-immediate(-im) create
Immediately executes the command, without using the queue.
-multiple(-m) create
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.

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 be used more than once in a command.

MEL examples

assignInputDevice -d "spaceball" -c "Button1" "setKeyframe";

// This command will assign button1 on the spaceball with
// the setKeyframe command.  This is very much like using
// the spaceball buttons as hotkeys.

assignInputDevice -d "midi" -ct -m "currentTime -e Axis0";

// 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.