pymel.core.system.attachDeviceAttr

attachDeviceAttr(*args, **kwargs)

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.

Flags:
Long name (short name) Argument Types Properties
attribute (at) unicode ../../../_images/create.gif
 
specify the attribute to attach to
axis (ax) unicode ../../../_images/create.gif
 
specify the axis to attach from.
camera (cam) bool ../../../_images/create.gif
 

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 ../../../_images/create.gif
 

This flag attaches the device/axis to the current cameras rotation controls. Flag can have multiple arguments, passed either as a tuple or a list.

cameraTranslate (ct) bool ../../../_images/create.gif
 
This flag attaches the device/axis to the current cameras translate controls.
clutch (c) unicode ../../../_images/create.gif
 

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 ../../../_images/create.gif
 
specify which device to assign the command string.
selection (sl) bool ../../../_images/create.gif
 

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.

Previous topic

pymel.core.system.assignInputDevice

Next topic

pymel.core.system.attrCompatibility

Core

Core Modules

Other Modules

This Page