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.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
absolute (a) | bool | ||
|
|||
attribute (at) | unicode | ||
|
|||
axis (ax) | unicode | ||
|
|||
clutch (c) | unicode | ||
|
|||
device (d) | unicode | ||
|
|||
offset (o) | float | ||
|
|||
relative (r) | bool | ||
|
|||
scale (s) | float | ||
|
|||
selection (sl) | bool | ||
|
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.