[Maya, python] Custom locator with viewport 2.0 support?

Hi!
Is it possible to write custom locator plugin with support for drawing override in viewport 2.0 mode?
The C++ version of “footPrintNode” example was updated in 2012/2013 Maya API documentation and it demonstrates corresponding changes required to be made in plugin’s code (registering MPxDrawOverride, etc.).
But any attempts to achieve this using Python API actually failed for me (and, as far as I know, for some people over there as well).
If it can be done using Python it would be great to have some kind of a working template to start with (maybe properly updated “footPrintNode.py”?).
Please, if anyone has had an experience with solving that kind of task, guide me with advice to pull this off.

I am also interested in this. It threw me today when my custom locators were not working in Maya 2015, only to find that viewport 2.0 is the default viewport now. Would ADSK really institute a default viewport that doesn’t work with scripted plugins or many shading nodes?

[QUOTE=Chris.Evans;24876]Would ADSK really institute a default viewport that doesn’t work with scripted plugins or many shading nodes?[/QUOTE]

yes, yes they would :slight_smile:

The documentation for Maya 2014 have a guide for transitioning from the old viewport to 2.0.
API Guide -> Viewport 2.0 API -> Transition Guide

Hello i’m searching examples for the same problem, for in my case the MPxLocator.
In fact Calon in the transition guide i can read :

Support for Maya nodes implementing the MPxLocator interface can be added by providing an
implementation of MPxDrawOverride and registering it with MDrawRegistry against a
classification string for the Maya plugin node type. See the devkit example “footPrintNode” for more
details.

That’s a beginning, BUT, the footPrintNode have not been updated yet, a least in python.
There is always (in maya 2015) the same old code using the same old viewport.
But the code have been updated in C++.

I’m not cpp friendly so i don’t know to read and write with this langage.

Where can I find a simple hello world in python for the viewport 2.0 ?
Please tel me it exists :wink:

Thank you

BUMP
I’m having the same issue… need my custom locators to show up in viewport 2.0 :frowning:
I was planning to convert the footPrintNode cpp into Python, but seems like Hamletine have tried already.
Is MHWRender available in Python?

Just adding to the thread - I’m working on something similar. Trying to get a custom locator made with Python to work in VP2.0.

Here’s a link to the updated pyFootPrintNode.py for Maya 2016 - it’s available on ADSK’s GitHub:

https://github.com/autodesk-adn/Maya-devkit/blob/master/win/devkit/plug-ins/scripted/pyFootPrintNode.py

I’ve used the code from there to update my custom locator with a MPxDrawOverride, and in Maya 2015 it loads and renders fine in the Legacy viewport but when I switch to VP2.0 the locator disappears and I get the error:
// Error: integer expected //

In Maya 2016, the locator loads but still doesn’t display in VP2.0 =(

So - still plunking away then.

Pinging one more time:

So - at this location:
https://github.com/autodesk-adn/Maya-devkit/tree/master/win/devkit/plug-ins/scripted

You can find three different versions of the footPrint locator code –

footPrintNode.py
pyFootPrintNode.py
pyFootPrintNode_GeometryOverride.py

The first one doesn’t work in Maya 2015 VP2.0. (but works in legacy VP) – this one has regular drawing. No MPxDrawOverride - so won’t work in Maya2016 VP2.0 either.

BOTH of the second and third script files contain implementations of MPxDrawOverride.
BOTH of the second and third files seem to work just fine in Maya 2016 VP2.0
BOTH of the second and third files still do NOT work in Maya 2015 - so for me, that’s a solved “2015 don’t do dat” issue.

I hope that’s a useful summary - I’ve been looking all over and trying a lot of different ways to do this, and the world is frustratingly lacking in information about this!

~Alex