pymel.core.system.setAttrMapping

setAttrMapping(*args, **kwargs)

This command applies an offset and scale to a specified device attachment. This command is different than the setInputDeviceMapping command, which applies a mapping to a device axis. 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 resulting value is added to the previous calculated value. The calculated value will also take into account the setInputDeviceMapping, if it was defined. As an example, if the space ball is setup with absolute attachment mappings, 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 get a constantly increasing (or constantly decreasing) value. Note that the definition of relative is different than the definition used by the setInputDeviceMapping command. In general, both a relative attachment mapping (this command) and a relative device mapping (setInputDeviceMapping) should not be used together one the same axis. In query mode, return type is based on queried flag.

Flags:

Long Name / Short Name Argument Types Properties
absolute / a bool ../../../_images/create.gif
  Make the mapping absolute.
attribute / at unicode ../../../_images/create.gif
  The attribute used in the attachment.
axis / ax unicode ../../../_images/create.gif
  The axis on the device used in the attachment.
clutch / c unicode ../../../_images/create.gif
  The clutch button used in the attachment.
device / d unicode ../../../_images/create.gif
  The device used in the attachment.
offset / o float ../../../_images/create.gif
  Specify the offset value.
relative / r bool ../../../_images/create.gif
  Make the mapping relative.
scale / s float ../../../_images/create.gif
  Specify the scale value.
selection / sl bool ../../../_images/create.gif
  This flag specifies the mapping should be on the selected objects Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.setAttrMapping

Example:

import pymel.core as pm

pm.attachDeviceAttr( d='spaceball', ax='XAxis', at='translateX' )
pm.setAttrMapping( d='spaceball', ax='XAxis', at='translateX', scale=0.01 )

# The first command will assign the XAxis of the spaceball to
# the translateX attribute of the selected objects.
# The second command sets the scaling of attribute value to
# 0.01 of the value of the axis. This results in finer control
# since the motions of the spaceball are damped.