I found the following example which allows to draw text in the 3D viewport in an easy way using the Python 2.0 API: Help
My question is whether it can be modified somehow such that text is drawn in the UV editor instead of the 3D viewport.
I found the following example which allows to draw text in the 3D viewport in an easy way using the Python 2.0 API: Help
My question is whether it can be modified somehow such that text is drawn in the UV editor instead of the 3D viewport.
Ok, another try to draw anything in the UV editor (anything, not necessarily a text).
I found another example in the Maya devkit, this time based on the MPxSurfaceShapeUI
class.
When I add the following methods to the basicShapeUI
class from the example:
def canDrawUV(self):
print('canDrawUV')
return True
def drawUV(self, view, info):
print('drawUV')
create a shape:
cmds.createNode("spBasicShape")
select the shape and open the UV editor, I see that the canDrawUV
method is being called by Maya but unfortunately the drawUV
method is not being called. Any ideas why Maya doesn’t call drawUV
?
Bump. So is it not possible to draw anything in the UV Editor in Maya Python? That would be a real shame.
Ok, after a few weeks of searching it looks like the only option for drawing in the UV Editor is using the MPxTexContext
class and its drawFeedback
method. Drawables which are defined in that method are in fact drawn in the UV Editor.
BUT it looks like the MPxTexContext
class is not exposed in the Python API. So it turns out I will have to move a subset of plugin functionalities to C++ and pass data from Python to C++ somehow.
Thank you Autodesk for not exposing something which seems to be the only option for UV Editor drawing to Python