pymel.core.system.setInputDeviceMapping

setInputDeviceMapping(*args, **kwargs)

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.

Dynamic library stub function

Flags:

Long Name / Short Name Argument Types Properties
absolute / a bool ../../../_images/create.gif
  report absolute axis values
axis / ax unicode ../../../_images/create.gif
  specify the axis to map
device / d unicode ../../../_images/create.gif
  specify which device to map
offset / o float ../../../_images/create.gif
  specify the axis offset value
relative / r bool ../../../_images/create.gif
  report the change in axis value since the last sample
scale / s float ../../../_images/create.gif
  specify the axis scale value
view / v bool ../../../_images/create.gif
  translate the device coordinates into the coordinates of the active camera
world / w bool ../../../_images/create.gif
  translate the device coordinates into world space coordinates Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.setInputDeviceMapping

Example:

import pymel.core as pm

pm.assignInputDevice( '"move -r XAxis YAxis ZAxis"', d='spaceball' )
pm.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.