Go to: Synopsis. Return value. Related.
Flags. Python
examples.
setInputDeviceMapping([absolute=boolean], [axis=string], [device=string], [offset=float], [relative=boolean], [scale=float], [view=boolean], [world=boolean])
Note: Strings representing object names and
arguments must be separated by commas. This is not depicted in the
synopsis.
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.
None
assignInputDevice, attachDeviceAttr, detachDeviceAttr, devicePanel, getInputDeviceRange, getModifiers, listDeviceAttachments, listInputDeviceAxes, listInputDeviceButtons, listInputDevices, recordAttr, setAttrMapping, unassignInputDevice
absolute, axis,
device, offset,
relative, scale, view, world
Long name (short name) |
Argument types |
Properties |
device(d) |
string |
 |
|
specify which device to map |
|
axis(ax) |
string |
  |
|
scale(s) |
float |
 |
|
specify the axis scale value |
|
offset(o) |
float |
 |
|
specify the axis offset value |
|
absolute(a) |
boolean |
 |
|
report absolute axis values |
|
relative(r) |
boolean |
 |
|
report the change in axis value since the last sample |
|
view(v) |
boolean |
 |
|
translate the device coordinates into the coordinates of the
active camera |
|
world(w) |
boolean |
 |
|
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 have multiple arguments, passed
either as a tuple or a list. |
import maya.cmds as cmds
cmds.assignInputDevice( '"move -r XAxis YAxis ZAxis"', d='spaceball' )
cmds.setInputDeviceMapping( d='spaceball', ax=['XAxis', 'YAxis', 'ZAxis'], scale=0.01, r=True )
# 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.