The draggerContext allows the user to program the behavior of the mouse or an equivalent dragging device in MEL.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
anchorPoint (ap) | float, float, float | ||
|
|||
button (bu) | int | ||
|
|||
currentStep (cs) | int | ||
Current step (press-drag-release sequence) for dragger context. When queried before first press event happened, returns 0. Flag can have multiple arguments, passed either as a tuple or a list. |
|||
cursor (cur) | unicode | ||
|
|||
dragCommand (dc) | callable | ||
|
|||
dragPoint (dp) | float, float, float | ||
|
|||
drawString (ds) | unicode | ||
|
|||
exists (ex) | bool | ||
|
|||
finalize (fnz) | callable | ||
|
|||
helpString (hs) | unicode | ||
history (ch) | bool | ||
|
|||
holdCommand (hc) | callable | ||
|
|||
image1 (i1) | unicode | ||
image2 (i2) | unicode | ||
image3 (i3) | unicode | ||
|
|||
initialize (inz) | callable | ||
|
|||
modifier (mo) | unicode | ||
|
|||
name (n) | unicode | ||
|
|||
plane (pl) | float, float, float | ||
|
|||
prePressCommand (ppc) | callable | ||
|
|||
pressCommand (pc) | callable | ||
|
|||
projection (pr) | unicode | ||
Sets current projection of drag point. Valid types are: viewPlaneproject to view planeobjectViewPlaneproject to object plane (parallel to view plane)objectPlaneproject to specified plane defined by object location and normal (default) 0,1,0planeproject to specified plane defined by origin and normal (default) 0,1,0sketchPlaneproject to sketch planexAxisproject to closest point on X axisyAxisproject to closest point on Y axiszAxisproject to closest point on Z axisboundingSphereproject to closest point on object sphere boundsboundingBoxproject to closest point on object bounding box |
|||
releaseCommand (rc) | callable | ||
|
|||
snapping (snp) | bool | ||
|
|||
space (sp) | unicode | ||
|
|||
stepsCount (sc) | int | ||
|
|||
undoMode (um) | unicode | ||
Undo queue mode for the context actions. Acceptable values are: alldefault behaviour when every action that happens during dragger context activity is recorded as an individual undo chunk.step- all the actions that happen between each press and release are combined into one undo chunk.sequence- all the actions that happen between very first press and very last release are combined into single undo chunk. This works exactly the same as stepfor a single step dragger context. |
Derived from mel command maya.cmds.draggerContext
Example:
import pymel.core as pm
# Procedure called on press
def SampleContextPress():
pressPosition = pm.draggerContext( 'sampleContext', query=True, anchorPoint=True)
print ("Press: " + str(pressPosition))
# Procedure called on drag
def SampleContextDrag():
dragPosition = pm.draggerContext( 'sampleContext', query=True, dragPoint=True)
button = pm.draggerContext( 'sampleContext', query=True, button=True)
modifier = pm.draggerContext( 'sampleContext', query=True, modifier=True)
print ("Drag: " + str(dragPosition) + " Button is " + str(button) + " Modifier is " + modifier + "\n")
message = str(dragPosition[0]) + ", " + str(dragPosition[1])
pm.draggerContext( 'sampleContext', edit=True, drawString=message)
# Define draggerContext with press and drag procedures
pm.draggerContext( 'sampleContext', pressCommand='SampleContextPress()', dragCommand='SampleContextDrag()', cursor='hand' );
# Set the tool to the sample context created
# Results can be observed by dragging mouse around main window
pm.setToolTo('sampleContext')