#include <assert.h>
#include "meshMapUtils.h"
#include <maya/MIntArray.h>
#include <maya/MFnMesh.h>
#include <maya/MItMeshEdge.h>
#include <maya/MItMeshPolygon.h>
#include <maya/MGlobal.h>
#include <maya/MFloatPointArray.h>
#include <maya/MDagPath.h>
#include <maya/MDagPathArray.h>
#include <maya/MObjectArray.h>
#include <maya/MItMeshVertex.h>
#define IDX(i, l) ( ( i + l ) % l )
{
int j = selection.
length() - 1;
while ( j >= 0 )
{
bool found = false;;
for(
unsigned int i = 0 ; i < moreFaces.
length(); i++ )
{
if( selection[j] == moreFaces[i] )
{
found = true;
break;
}
}
if( !found )
{
}
j--;
}
}
MStatus meshMapUtils::traverseFace(
int faceIdx,
int v0,
int v1,
)
{
int vtxCnt = -1;
int dir = 0;
int dummy;
{
return stat;
}
if( faceTraversal[faceIdx] )
{
}
polyIt.setIndex( faceIdx, dummy );
polyIt.getEdges( edgeOrig );
polyIt.getVertices( vtxOrig );
int v0Idx = -1;
int i;
for( i = 0; i < vtxCnt; i++ )
{
if( vtxOrig[i] == v0 )
{
v0Idx = i;
if( vtxOrig[IDX(i+1, vtxCnt)] == v1 )
{
dir = 1;
}
else if( vtxOrig[IDX(i-1, vtxCnt)] == v1 )
{
dir = -1;
}
break;
}
}
if (dir == 0)
{
}
for( i = 0; i < vtxCnt; i++ )
{
vtxSorted[i] = vtxOrig[IDX( v0Idx + i * dir, vtxCnt )];
if( dir == 1 )
{
edgeSorted[i] = edgeOrig[IDX( v0Idx + i * dir, vtxCnt )];
}
else
{
edgeSorted[i] = edgeOrig[IDX( v0Idx - 1 + i * dir, vtxCnt )];
}
}
for ( i = 0; i < vtxCnt; i++ )
{
int index = vtxSorted[i];
if( cvMapping[index] == -1 )
{
{
return stat;
}
newVertices.
append( origVertices[index] );
cvMapping[index] = newVertices.
length()-1;
cvMappingInverse[newVertices.
length()-1] = index;
}
}
newPolygonCounts.
append( vtxCnt );
for ( i = 0; i < vtxCnt; i++ )
{
newPolygonConnects.
append( cvMapping[vtxSorted[i]] );
}
faceTraversal[faceIdx] = true;
for( i = 0; i < (int)edgeSorted.length(); i++ )
{
int nextEdge = edgeSorted[i];
int2 nextEdgeVtx;
stat = theMesh.getEdgeVertices(nextEdge, nextEdgeVtx );
int baseIdx = -1;
bool swap = false;
int j;
for( j = 0; j < (int)vtxSorted.length(); j++ )
{
if( vtxSorted[j] == nextEdgeVtx[0] )
{
baseIdx = j;
break;
}
}
assert( baseIdx != -1 );
if( vtxSorted[IDX(baseIdx+1, vtxCnt)] == nextEdgeVtx[1] )
{
}
else if ( vtxSorted[IDX(baseIdx-1, vtxCnt)] == nextEdgeVtx[1] )
{
swap = true;
}
edgeIt.setIndex( nextEdge, dummy );
edgeIt.getConnectedFaces( connectedFaces );
if( connectedFaces.
length() > 1 )
{
int nextFace;
if( connectedFaces[0] == faceIdx )
{
nextFace = connectedFaces[1];
}
else
{
nextFace = connectedFaces[0];
}
int nextVtx0 = -1;
int nextVtx1 = -1;
if ( !swap )
{
nextVtx0 = nextEdgeVtx[1];
nextVtx1 = nextEdgeVtx[0];
}
else
{
nextVtx0 = nextEdgeVtx[0];
nextVtx1 = nextEdgeVtx[1];
}
stat = traverseFace( path, nextFace, nextVtx0, nextVtx1, faceTraversal,
cvMapping, cvMappingInverse,
newPolygonCounts, newPolygonConnects,
origVertices, newVertices );
{
break;
}
}
}
return stat;
}
{
{
}
for (unsigned int i = 0; i < 3; i++)
{
{
}
seedVtx->
append( fIt.index() );
stat = fIt.getConnectedFaces ( faceList );
{
}
if( i == 0 )
{
finalFaceList = faceList;
}
else
{
meshMapUtils::intersectArrays( finalFaceList, faceList );
}
}
if( finalFaceList.
length() != 1 )
{
}
else
{
*faceIdx = finalFaceList[0];
}
if( !(p0 == p1 ) || !(p0 == p2 ))
{
}
}