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

Synopsis

attachDeviceAttr([attribute=string], [axis=string], [camera=boolean], [cameraRotate=boolean], [cameraTranslate=boolean], [clutch=string], [device=string], [selection=boolean])

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

attachDeviceAttr is undoable, queryable, and NOT editable.

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.

Return value

None

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

Related

assignInputDevice, detachDeviceAttr, devicePanel, getInputDeviceRange, getModifiers, listDeviceAttachments, listInputDeviceAxes, listInputDeviceButtons, listInputDevices, recordAttr, setAttrMapping, setInputDeviceMapping, unassignInputDevice

Flags

attribute, axis, camera, cameraRotate, cameraTranslate, clutch, device, selection
Long name (short name) Argument types Properties
attribute(at) string createmultiuse
specify the attribute to attach to
axis(ax) string create
specify the axis to attach from.
camera(cam) boolean create
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) boolean create
This flag attaches the device/axis to the current cameras rotation controls.
cameraTranslate(ct) boolean create
This flag attaches the device/axis to the current cameras translate controls.
clutch(c) string create
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) string create
specify which device to assign the command string.
selection(sl) boolean create
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.

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( '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.)

cmds.attachDeviceAttr( d='spaceball', ax='XAxis', at='translateX' )

# This command will assign the XAxis of the spaceball to
# the translateX attribute of the selected objects.

cmds.attachDeviceAttr( d='wacom', ax='puck:X', c='puckButton1', at='translateX', sl=True )
cmds.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.