I'm in the process of creating a custom import plugin for maya. I already wrote some import code and created a custom MPxSurfaceShape
class (I'm mainly interested in drawing the surface from within the viewport).
The shape gets crated by a MPxCommand
which reads a file from the disk. Now I would like to add this object to my maya scene from within the plugin. But unfortunately I can't find a function that takes a MPxNode
/MPxSurfaceShape
and adds it to Maya so that it can be displayed.
In all examples I've seen the node is instantiated from within mel. But I want to link this instance a file. Which prevents me from just creating the node and then editing it.
A similar solution might be found in either the apiMeshShape
example in the maya plugin folder or here: https://github.com/ADN-DevTech/Maya-Locator/ (also supports the loading of external data).