Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

setAttrMapping([absolute=boolean], [attribute=string], [axis=string], [clutch=string], [device=string], [offset=float], [relative=boolean], [scale=float], [selection=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

setAttrMapping is undoable, queryable, and NOT editable.

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.

Return value

None

In query mode, return type is based on queried flag.

Flags

absolute, attribute, axis, clutch, device, offset, relative, scale, selection
Long name (short name) Argument types Properties
absolute(a) boolean create
Make the mapping absolute.
attribute(at) string createmultiuse
The attribute used in the attachment.
axis(ax) string create
The axis on the device used in the attachment.
clutch(c) string create
The clutch button used in the attachment.
device(d) string create
The device used in the attachment.
offset(o) float create
Specify the offset value.
relative(r) boolean create
Make the mapping relative.
scale(s) float create
Specify the scale value.
selection(sl) boolean create
This flag specifies the mapping should be on the selected objects

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.

Python examples

import maya.cmds as cmds

cmds.attachDeviceAttr( d='spaceball', ax='XAxis', at='translateX' )
cmds.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.