This command associates a device/axis pair with a node/attribute pair. When the device axis moves, the value of the attribute is set to the value of the axis. This value can be scaled and offset using the setAttrScale command. In query mode, return type is based on queried flag.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
attribute (at) | unicode | ||
|
|||
axis (ax) | unicode | ||
|
|||
camera (cam) | bool | ||
This flag attaches the device/axis to the current camera. The mapping between device axes and camera controls is uses a heuristic based on the device descripton. The interaction is a copy of the mouse camera navigation controls. |
|||
cameraRotate (cr) | bool | ||
This flag attaches the device/axis to the current cameras rotation controls.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
cameraTranslate (ct) | bool | ||
|
|||
clutch (c) | unicode | ||
specify a clutch button. This button must be down for the command string to be executed. If no clutch is specified the command string is executed everytime the device state changes |
|||
device (d) | unicode | ||
|
|||
selection (sl) | bool | ||
This flag attaches to the nodes in the selection list. This is different from the default arguments of the command since changing the selection will change the attachments. |
Derived from mel command maya.cmds.attachDeviceAttr
Example:
import pymel.core as pm
pm.attachDeviceAttr( 'surface1.translateX', d='spaceball', ax='XAxis' )
# This command will assign the XAxis of the spaceball to
# the translateX attribute of surface1. This
# assignment is independent of the selection list (i.e.
# if surface1 was selected when the command is executed,
# surface1 will be translated by the spaceball regardless
# of the current selection.)
pm.attachDeviceAttr( d='spaceball', ax='XAxis', at='translateX' )
# This command will assign the XAxis of the spaceball to
# the translateX attribute of the selected objects.
pm.attachDeviceAttr( d='wacom', ax='puck:X', c='puckButton1', at='translateX', sl=True )
pm.attachDeviceAttr( d='wacom', ax='puck:Y', c='puckButton1', at='translateY', sl=True )
# This command will attach the wacom puck X and Y axes to the
# X and Y translate attributes of the selected items.
# When the selection changes so does the attachment.
# The -c option means you can only move the selected items
# with the puck when button1 on the puck is down.