#include <maya/MIOStream.h>
#include <maya/MSimple.h>
#include <maya/MSelectionList.h>
#include <maya/M3dView.h>
#include <maya/MGlobal.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MFnMesh.h>
#include <maya/MDagPath.h>
#include <math.h>
{
cout<<endl;
cout<<"*****************"<<endl;
cout<<"* listPolyHoles *"<<endl;
cout<<"*****************"<<endl;
int numSelected = curSel.
length();
for( int s = 0; s < numSelected; s++ )
{
{
cout<<" Error - object is not a polymesh"<<endl;
stat = MS::kFailure;
return stat;
}
cout<<endl<<"Looking for holes in "<<fnNode.name().asChar()<<endl;
MFnMesh fnMesh( node, &polyStatus );
if( polyStatus == MS::kSuccess )
{
int numHoles = fnMesh.getHoles( holeInfo, holeVertices, &holeStatus );
if( holeStatus == MS::kSuccess )
{
cout<<" Poly has "<<numHoles<<" holes"<<endl;
for( int h = 0; h < numHoles; h++ )
{
int holeFace = holeInfo[3*h];
int holeNumVertices = holeInfo[3*h+1];
int holeStartIndex = holeInfo[3*h+2];
cout<<" Hole "<<h<<":"<<endl;
cout<<" Face "<<holeFace<<endl;
cout<<" Start index "<<holeStartIndex<<endl;
cout<<" "<<holeNumVertices<<" vertices: ";
for( int v = 0; v < holeNumVertices; v++ )
{
int index = holeStartIndex + v;
cout<<holeVertices[index];
}
cout<<endl;
}
}
else
{
cout<<" Error retrieving polygon holes"<<endl;
stat = MS::kFailure;
}
}
else
{
cout<<" Error - object is not a polymesh"<<endl;
stat = MS::kFailure;
}
}
setResult( "listPolyHoles completed." );
return stat;
}