draggerContext command helppeee!!

284 views
Skip to first unread message

e955...@gmail.com

unread,
Sep 23, 2014, 8:00:56 PM9/23/14
to python_in...@googlegroups.com
hello!,

im trying to create a locator upon a button press from the user. i have it all set up to create the locator, but the locator actually appears on the screen upon the button release!.

is there a way to get the locator to appear literally when you press the button down??? - it can print text in script editor exactly on button press but not create it seems,

anyone know how?

heres the current code to create locator:

###############################################################
import maya.cmds as cmds

Context='Context'

def onPress():
print "pressing now!"
cmds.spaceLocator(p=(1,1,1))


if cmds.draggerContext(Context, exists=True):
cmds.deleteUI(Context)
cmds.draggerContext(Context, pressCommand=onPress, name=Context, cursor='crossHair')
cmds.setToolTo(Context)

###############################################################

Justin Israel

unread,
Sep 23, 2014, 9:03:03 PM9/23/14
to python_in...@googlegroups.com
Hey there,

Your command is actually firing and the locator being created when your mouse button presses down, but you aren't seeing the viewport update to show the locator until you release the mouse. I'm guessing it is because a redraw is being blocked/postponed while the mouse down event is happening (just wildly guessing). 

Anyways, try this:

def onPress():
    print "pressing now!"
    cmds.spaceLocator(p=(1,1,1
))
    cmds.refresh()






--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c8ecae5e-97e5-4ad4-8d8d-b4f5632c998c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

e955...@gmail.com

unread,
Sep 24, 2014, 6:20:43 AM9/24/14
to python_in...@googlegroups.com
yay thankyou very much!
Reply all
Reply to author
Forward
0 new messages