draggerContext holdCommand not working

draggerContext holdCommand not working

tsungyuw
Contributor Contributor
387 Views
0 Replies
Message 1 of 1

draggerContext holdCommand not working

tsungyuw
Contributor
Contributor

I am adding holdCommand in draggerContext.

it doesn't do anything. is this a bug?

 

I am using example from help doc and just added hc = 'print("holding")'

 

import maya.cmds as cmds

# Procedure called on press
def SampleContextPress():
pressPosition = cmds.draggerContext( 'sampleContext', query=True, anchorPoint=True)
print ("Press: " + str(pressPosition))

# Procedure called on drag
def SampleContextDrag():
dragPosition = cmds.draggerContext( 'sampleContext', query=True, dragPoint=True)
button = cmds.draggerContext( 'sampleContext', query=True, button=True)
modifier = cmds.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])
cmds.draggerContext( 'sampleContext', edit=True, drawString=message)


# Define draggerContext with press and drag procedures
cmds.draggerContext( 'sampleContext', hc = 'print("holding")',pressCommand='SampleContextPress()', dragCommand='SampleContextDrag()', cursor='hand' );

# Set the tool to the sample context created
# Results can be observed by dragging mouse around main window
cmds.setToolTo('sampleContext')

 

0 Likes
388 Views
0 Replies
Replies (0)