Custom 'cursors' with Maya API...?


#1

Please could someone give me some pointers as to which Maya API classes deal with creating custom ‘cursors’, like the one used in the Paint Selection tool / 3D Paint tool?

I’ve got a feeling that maybe I should use locators, or something similar - but wouldn’t know how to get the ‘locator’ moving as a cursor…? I would want its shape to change as I move it over the surface of an object, so it would need to be aware of both the position of the mouse (screen / pixel coordinates), and of its own position in world-coordinates.

Oh, and how do I then get Maya to call a given command when I click a mouse button when this cursor is active?

Thanks in advance,

Paul.


#2

I don’t know, but I have a sneaking suspicion it’s done with MPxContext


#3

playmesumch00ns,

You’re quite right. :slight_smile:

Cheers!
/ Daniel


#4

Thanks… does MPxContext allow me to create my own cursors with OpenGL, though?


#5

Originally posted by paulwconnor
Thanks… does MPxContext allow me to create my own cursors with OpenGL, though?

Yes. That’s exactly what you do.

It was a while since I made a tool in Maya but as I remember it there are two types of cursors in Maya; the “mouse cursor sprites” like the selection arrow and the openGL drawn ones like the paintFx ones. I don’t remember the amount of control you get over the mouse sprites but I think it is minimal (predefined list more or less), but you have absolute control of the openGL ones apart from colors since you use your own openGL calls to draw them.

However I have experienced myself and also seen in online discussions that there at least was (Maya 4) one problem with the custom openGL cursors - they might be flickering or not drawn at all when no mousebutton is pressed. I believe that it is an issue with the graphics hardware (the use of overlay layers perhaps?) and perhaps it has been solved in later releases of Maya.

Anyway - At least Maya 4 had a nice section in the API documentation about tools under the “Command plugins” section.

Cheers
/ Daniel


#6

Okay, thanks Daniel - thats very helpful.

Much appreciated,
Paul.


#7

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.