View Full Version : [C++ API] Using MPxSurfaceShape

02 February 2011, 06:19 AM
Hi people, I'm diving into shape creation in maya and am seeing that it is a lot more tedious than I expected. Creating the surface data using MFnMesh I'm ok with as these are just arrays related to each other, but the actual shape is what I found to be a bit more than I exptected.

I am going through the apiMeshShape example and was wondering if one really does need to implement tweaks, control points etc. What If I just want to create a simple shape with geometry that is not meant to be edited by the user? Can all that be omitted? Or is there an easier way to create shapes? Could an MPxNode calculate mesh data for an output and connect that into the inMesh attribute of lets say a cube? Would that override the cubes vertexes and draw whatever is being fed into it?

By that same example I was also wondering about construction history on a shape....lets say I the separate node calculating the vertex/face/edge list and will be sending that mesh over to a shape node...custom or something like a polygon cube's shape does the node keep the mesh data to draw the shape after the creator node is unplugged or deleted?

02 February 2011, 04:00 AM
apiMeshShape is a relatively more complex example, esp. if you look at the Maya 2012 version which would support render in Viewport 2.0. For something simple you can look at apiSimpleShape example.

But if you just want to let Maya to do the rendering, you really don't need to write a custom shape. You want to write a custom shape if you want to handle the render yourself, with, say, OpenGL directly. You can just compute the meshdata in Maya internal format and feed it to a mesh.inMesh attribute like you said yourself.

02 February 2011, 04:13 AM
Ah excellent...I guess I was in the right track. I assume that most of the code inside apiMeshShape is pretty much the default code included with native maya shape nodes right? With the difference you said...add ones custom draw functions. In which case I also wonder....if the custom locator node is just a tiny part of the implementation of a custom shape node?...that is ...just the benefit of having the draw function...but no real geometry implementation in the sense that one can query and modify vertex data that is being drawn to screen.....of course that could be implemented if one wanted to.

Thanks for the reply!

CGTalk Moderation
02 February 2011, 04:13 AM
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.