PDA

View Full Version : Rookie Question: Edge access in maya api


C.Lin.
02-26-2006, 01:22 PM
Hi there, me again...

I'm now working on a mesh operation issue and I have got all the connected face ID for a certain vertex. Then I want to access these faces to get their normal vectors.

But how to access them with their IDs? MFnMesh and MItMeshPolygon do not seem to supply such methods.

A basic problem, but I got sucked.

Thanks for your help.

tciny
02-26-2006, 08:32 PM
Check out MItMeshVertex

Theres an edge and face vertex iterator too

C.Lin.
02-27-2006, 07:23 AM
Thank you for your reply. I know, however, about the edge and vertex iterators, but cannot find any methods for face access by specified face ID. Any comments?

tciny
02-27-2006, 10:33 AM
Ok, some pseudo code:

MItMesVertex vtxIter( meshObj ); // meshObj would be an MObject for your mesh
float stupidFeature;
vtxIter.setIndex( VERTEXINDEX, stupidFeature ); //You MUST pass that stupid float...
MIntArray faces;
vtxIter.getConnectedFaces( faces );

MFnMesh mesh( meshObj );
MVector faceNormal;

for( unsigned i=0; i<faces.length(); i++ )
{
mesh.getPolygonNormal(faces[i], faceNormal, MSpace::kWorld );
// do something with it
}

Hope that helps.

C.Lin.
02-27-2006, 11:45 AM
Thanks a zillion, tciny~~

It really does a lot help. I did not notice the getPolygonNormal method. -_-b

Danke.

CGTalk Moderation
02-27-2006, 11:45 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.