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()
On Wed, Sep 24, 2014 at 12:00 PM, <[email protected]> wrote:
> 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)
>
> ###############################################################
>
> --
> 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 [email protected].
> 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.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2yq5egNwbp-%2BvecmUV%2BJae9R5k87UP9k-ZvfK3wxUqKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.