View Full Version : Delete vertex using API...

04 April 2009, 08:45 PM

I'm looking for a way to do a couple things things -- I'd like to be able to delete a given vertex from a mesh within the C++ API, and I also need a way copy a mesh, to perform the mesh reduction function using the API. I'm very new at this, and I need some help...

To delete a vertex, here is what my code looks like now...



if(component.apiType() == MFn::kMeshVertComponent)
MObject mesh = dagPath.node();
MItMeshVertex vertexIter(dagPath,component);
MFnMesh fnMesh(mesh);
MIntArray vertexList,vertexCount,edgeList;


for(int i = 0; i < edgeList.length();i++)


Now, I know that there exists a deleteVertex function in the MFnMesh class. However, when I try to use it, it doesn't do anything. I check for an error, but it doesn't give me any. So, I'm deleting all the edges around it instead. However... when I try to do this, afterward I check the number of vertices using fnMesh.numVertices, and it works all right (though sometimes it deletes more than one vertex... weird), but the changes are not reflected in the viewport in Maya... the mesh looks like nothing has changed. I can even rotate around, and it looks identical to how ot was before I deleted the vertices. However, if I try to move the mesh at all, Maya freaks out and crashes almost immediately.

The second thing I'm looking to do, is make a copy of the mesh and store it in memory and be able to manipulate it, but I do NOT want the user to be able to see or interact with it.

Finally, like I said, I'd like to be able to do a mesh reduction... Triangulation would be handy as well... Are these things possible?


Robert Bateman
04 April 2009, 09:59 AM

CGTalk Moderation
04 April 2009, 09:59 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.