pymel.core.context.dragAttrContext

dragAttrContext(*args, **kwargs)

The dragAttrContext allows a user to manipulate the attributes of an object by using a virtual slider within the viewport. The virtual slider is used by dragging in a viewport with the middle mouse button. The speed at which the attributes are changed can be controlled by holding down the Ctrl key to slow it down and the Shift key to speed it up.

Flags:

Long Name / Short Name Argument Types Properties
connectTo / ct PyNode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Specifies an attribute to which to connect the context. This is a multi-use flag, but all attributes used must be from one object.
exists / ex bool ../../../_images/create.gif
  Returns true or false depending upon whether the specified object exists. Other flags are ignored.
history / ch bool ../../../_images/create.gif
  If this is a tool command, turn the construction history on for the tool in question.
image1 / i1 unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  First of three possible icons representing the tool associated with the context.
image2 / i2 unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Second of three possible icons representing the tool associated with the context.
image3 / i3 unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Third of three possible icons representing the tool associated with the context.
name / n unicode ../../../_images/create.gif
  If this is a tool command, name the tool appropriately.
reset / r bool ../../../_images/create.gif ../../../_images/edit.gif
  Resets the list of attributes to which the context is connected. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.dragAttrContext

Example:

import pymel.core as pm

pm.polyPlane( w=10, h=10, sx=3, sy=3, ax=(0, 1, 0), tx=1, ch=1 )
# Result: [nt.Transform(u'pPlane1'), nt.PolyPlane(u'polyPlane1')] #

pm.dragAttrContext( 'myDragAttrContext' )
# Result: u'myDragAttrContext' #

# Example 1: Move along X direction and rotate around X at the same time.
pm.dragAttrContext( 'myDragAttrContext', edit=True, connectTo=('pPlane1.translateX', 'pPlane1.rotateX') )
# Result: u'myDragAttrContext' #
pm.setToolTo( 'myDragAttrContext' )

# Example 2: Extrude a face and then modify the distance that it is extruded by.
pm.polyExtrudeFacet( 'pPlane1.f[0]', ch=1, kft=0, pvx=-1.633333373, pvy=-1.111623654, pvz=3.142515589, tx=0, ty=0, tz=0, rx=0, ry=0, rz=0, sx=1, sy=1, sz=1, ran=0, divisions=1, twist=0, taper=1, off=0, ltz=0, ws=0, ltx=0, lty=0, lrx=0, lry=0, lrz=0, lsx=1, lsy=1, lsz=1, ldx=1, ldy=0, ldz=0, w=0, gx=0, gy=-1, gz=0, att=0, mx=0, my=0, mz=0, sma=30 )
# Result: [u'polyExtrudeFace1'] #
pm.dragAttrContext( 'myDragAttrContext', edit=True, connectTo='polyExtrudeFace1.localTranslateZ' )
# Result: u'myDragAttrContext' #
pm.setToolTo( 'myDragAttrContext' )

# Example 3: Do a wedge face and modify both the number of divisions and the
# angle at the same time.
pm.polyWedgeFace( 'pPlane1.f[0]', 'pPlane1.e[30]', ws=1, wedgeAngle=90, divisions=4, ed=30, ch=1 )
# Result: [nt.PolyWedgeFace(u'polyWedgeFace1')] #
pm.dragAttrContext( 'myDragAttrContext', edit=True, connectTo=('polyWedgeFace1.wedgeAngle', 'polyWedgeFace1.divisions') )
# Result: u'myDragAttrContext' #
pm.setToolTo( 'myDragAttrContext' )