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

Synopsis

setInputDeviceMapping [-absolute] [-axis string] [-device string] [-offset float] [-relative] [-scale float] [-view] [-world]

setInputDeviceMapping is undoable, NOT queryable, and NOT editable.

The command sets a scale and offset for all attachments made to a specified device axis. Any attachment made to a mapped device axis will have the scale and offset applied to its values.

The value from the device is multiplied by the scale and the offset is added to this product. With an absolute mapping, the attached attribute gets the resulting value. If the mapping is relative, the final value is the offset added to the scaled difference between the current device value and the previous device value.

This mapping will be applied to the device data before any mappings defined by the setAttrMapping command. A typical use would be to scale a device's input so that it is within a usable range. For example, the device mapping can be used to calibrate a spaceball to work in a specific section of a scene.

As an example, if the space ball is setup with absolute device mappings, constantly pressing in one direction will cause the attached attribute to get a constant value. If a relative mapping is used, and the spaceball is pressed in one direction, the attached attribute will jump a constantly increasing (or constantly decreasing) value and will find a rest value equal to the offset.

There are important differences between how the relative flag is handled by this command and the setAttrMapping command. (See the setAttrMapping documentation for specifics on how it calculates relative values). In general, both a relative device mapping (this command) and a relative attachment mapping (setAttrMapping) should not be used together on the same axis.

Return value

None

Related

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

Flags

absolute, axis, device, offset, relative, scale, view, world
Long name (short name) Argument types Properties
-absolute(-a) create
report absolute axis values
-axis(-ax) string createmultiuse
specify the axis to map
-device(-d) string create
specify which device to map
-offset(-o) float create
specify the axis offset value
-relative(-r) create
report the change in axis value since the last sample
-scale(-s) float create
specify the axis scale value
-view(-v) create
translate the device coordinates into the coordinates of the active camera
-world(-w) create
translate the device coordinates into world space coordinates

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" "move -r XAxis YAxis ZAxis";
setInputDeviceMapping -d "spaceball" -ax "XAxis" -ax "YAxis" -ax "ZAxis" -scale 0.01 -r;

// The first command will assign the move command to the spaceball.
// The second command will scale the three named axes by 0.01 and
// only return the changes in device position.