C++ API Reference
MItMeshPolygon Class Reference

Polygon iterator. More...

#include <MItMeshPolygon.h>

Public Member Functions

 MItMeshPolygon (const MObject &polyObject, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MItMeshPolygon (const MDagPath &polyObject, MObject &component=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
virtual ~MItMeshPolygon ()
 Destructor. More...
 
bool isDone (MStatus *ReturnStatus=NULL)
 Indicates if all of the polygons have been traversed yet. More...
 
MStatus next ()
 Advance to the next polygon in the iteration. More...
 
MStatus reset ()
 Reset the iterator to the first polygon. More...
 
MStatus reset (const MObject &polyObject)
 Reset the iterator to the first polygon in the supplied surface. More...
 
MStatus reset (const MDagPath &polyObject, MObject &component=MObject::kNullObj)
 Reset the iterator with the given surface and component. More...
 
unsigned int count (MStatus *ReturnStatus=NULL)
 Return the number of polygons in the iteration. More...
 
unsigned int polygonVertexCount (MStatus *ReturnStatus=NULL)
 Return the number of vertices for the current polygon. More...
 
MPoint center (MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL)
 Return the position of the center of the current polygon. More...
 
MObject polygon (MStatus *ReturnStatus=NULL)
 Deprecated in 2019.0 More...
 
MObject currentItem (MStatus *ReturnStatus=NULL)
 Get the current polygon in the iteration as a component. More...
 
unsigned int index (MStatus *ReturnStatus=NULL)
 Returns the index of the current polygon. More...
 
MStatus setIndex (int index, int &prevIndex)
 This method sets the index of the current face to be accessed. More...
 
unsigned int vertexIndex (int index, MStatus *ReturnStatus=NULL)
 Returns the object-relative index of the specified vertex of the current polygon. More...
 
MStatus getVertices (MIntArray &vertices)
 This method gets the indices of the vertices of the current face. More...
 
MPoint point (int index, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL)
 Return the position of the vertex at index in the current polygon. More...
 
void getPoints (MPointArray &pointArray, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL)
 Retrieves the positions of the vertices on the current face/polygon that the iterator is pointing to. More...
 
MStatus setPoint (const MPoint &point, unsigned int index, MSpace::Space space=MSpace::kObject)
 Set the vertex at the given index in the current polygon. More...
 
MStatus setPoints (MPointArray &pointArray, MSpace::Space space=MSpace::kObject)
 Sets new locations for vertices of the current polygon that the iterator is pointing to. More...
 
unsigned int normalIndex (int vertex, MStatus *ReturnStatus=NULL) const
 Returns the normal index for the specified vertex. More...
 
MStatus getNormal (MVector &normal, MSpace::Space space=MSpace::kObject) const
 Return the face normal of the current polygon. More...
 
MStatus getNormal (unsigned int Vertexindex, MVector &normal, MSpace::Space space=MSpace::kObject) const
 Returns the vertex-face normal for the vertex in the current polygon. More...
 
MStatus getNormals (MVectorArray &vectorArray, MSpace::Space space=MSpace::kObject) const
 Returns the normals for all vertices in the current face. More...
 
unsigned int tangentIndex (int vertex, MStatus *ReturnStatus=NULL) const
 Returns the tangent (or binormal) index for the specified vertex. More...
 
bool hasUVs (MStatus *ReturnStatus=NULL) const
 Tests whether this face has UV's mapped or not (either all the vertices for a face should have UV's, or none of them do, so the UV count for a face is either 0, or equal to the number of vertices). More...
 
bool hasUVs (const MString &uvSet, MStatus *ReturnStatus=NULL) const
 Tests whether this face has UV's mapped or not (either all the vertices for a face should have UV's, or none of them do, so the UV count for a face is either 0, or equal to the number of vertices). More...
 
MStatus setUV (int vertexId, float2 &uvPoint, const MString *uvSet=NULL)
 Modify the UV value for the given vertex in the current face. More...
 
MStatus getUV (int vertexId, float2 &uvPoint, const MString *uvSet=NULL) const
 Return the texture coordinate for the given vertex. More...
 
MStatus setUVs (MFloatArray &uArray, MFloatArray &vArray, const MString *uvSet=NULL)
 Modify the UV value for all vertices in the current face. More...
 
MStatus getUVs (MFloatArray &uArray, MFloatArray &vArray, const MString *uvSet=NULL) const
 Return the all the texture coordinates for the vertices of this face (in local vertex order). More...
 
MStatus getPointAtUV (MPoint &pt, float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, float tolerance=0.0)
 Return the position of the point at the given UV value in the current polygon. More...
 
MStatus getAxisAtUV (MVector &normal, MVector &uTangent, MVector &vTangent, float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, float tolerance=0.0)
 Return the axis of the point at the given UV value in the current polygon. More...
 
MStatus getUVAtPoint (MPoint &pt, float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL)
 Find the point closest to the given point in the current polygon, and return the UV value at that point. More...
 
MStatus getUVIndex (int vertex, int &index, const MString *uvSet=NULL)
 Returns the index of the texture coordinate for the given vertex. More...
 
MStatus getUVIndex (int vertex, int &index, float &u, float &v, const MString *uvSet=NULL)
 Return the index of the texture coordinate for the given vertex. More...
 
MStatus getUVSetNames (MStringArray &setNames) const
 This method is used to find the UV set names mapped to the current face. More...
 
bool hasColor (MStatus *ReturnStatus=NULL) const
 This method determines whether the current face has color-per-vertex set for any vertex. More...
 
bool hasColor (int localVertexIndex, MStatus *ReturnStatus=NULL)
 This method determines whether the current face has color-per-vertex set for the given vertex. More...
 
MStatus getColor (MColor &color, const MString *colorSetName=NULL)
 This method gets the average color of the all the vertices in this face. More...
 
MStatus getColor (MColor &color, int vertexIndex)
 This method gets the color of the specified vertex in this face. More...
 
MStatus getColors (MColorArray &colors, const MString *colorSetName=NULL)
 This method gets the color of the each vertex in the current face. More...
 
MStatus numColors (int &count, const MString *colorSetName=NULL)
 This method checks for the number of colors on vertices in this face. More...
 
MStatus getColorIndex (int vertexIndex, int &colorIndex, const MString *colorSetName=NULL)
 This method returns the colorIndex for a vertex of the current face. More...
 
MStatus getColorIndices (MIntArray &colorIndex, const MString *colorSetName=NULL)
 This method returns the colorIndices for each vertex on the face. More...
 
bool hasValidTriangulation (MStatus *ReturnStatus=NULL) const
 This method checks if the face has a valid triangulation. More...
 
MStatus numTriangles (int &count) const
 This Method checks for the number of triangles in this face in the current triangulation. More...
 
MStatus getTriangle (int localTriIndex, MPointArray &points, MIntArray &vertexList, MSpace::Space space=MSpace::kObject) const
 Get the vertices and vertex positions of the given triangle in the current face's triangulation. More...
 
MStatus getTriangles (MPointArray &points, MIntArray &vertexList, MSpace::Space space=MSpace::kObject) const
 Get the vertices and vertex positions of all the triangles in the current face's triangulation. More...
 
MStatus updateSurface ()
 Signal that this polygonal surface has changed and needs to redraw itself. More...
 
MStatus geomChanged ()
 Reset the geom pointer in the MItMeshPolygon. More...
 
MStatus getEdges (MIntArray &edges)
 This method gets the indices of the edges contained in the current face. More...
 
MStatus getConnectedFaces (MIntArray &faces)
 This method gets the indices of the faces connected to the current face. More...
 
MStatus getConnectedEdges (MIntArray &edges)
 This method gets the indices of the edges connected to the vertices of the current face, but DOES not include the edges contained in the current face. More...
 
MStatus getConnectedVertices (MIntArray &vertices)
 This method gets the object-relative indices of the vertices surrounding the vertices of the current face, but does not include the vertices of the current face. More...
 
bool isConnectedToFace (int index, MStatus *ReturnStatus=NULL)
 This method determines whether the given face is adjacent to the current face. More...
 
bool isConnectedToEdge (int index, MStatus *ReturnStatus=NULL)
 This method determines whether the given edge is connected to a vertex in the current face. More...
 
bool isConnectedToVertex (int index, MStatus *ReturnStatus=NULL)
 This method determines whether the given vertex shares an edge with a vertex in the current face. More...
 
MStatus numConnectedFaces (int &faceCount) const
 This method checks for the number of connected faces. More...
 
MStatus numConnectedEdges (int &edgeCount) const
 This method checks for the number of connected edges on the vertices of this face. More...
 
bool onBoundary (MStatus *ReturnStatus=NULL)
 This method determines whether the current face is on a boundary. More...
 
MStatus getArea (double &area, MSpace::Space space=MSpace::kObject)
 This method gets the area of the face. More...
 
bool zeroArea (MStatus *ReturnStatus=NULL)
 This method checks if its a zero area face. More...
 
MStatus getUVArea (double &area, const MString *uvSet=NULL)
 This method gets the UV area of the face. More...
 
bool zeroUVArea (MStatus *ReturnStatus=NULL)
 This method checks if the UV area of the face is zero. More...
 
bool zeroUVArea (const MString &uvSet, MStatus *ReturnStatus=NULL)
 This method checks if the UV area of the face is zero. More...
 
bool isConvex (MStatus *ReturnStatus=NULL)
 This method checks if the face is convex. More...
 
bool isStarlike (MStatus *ReturnStatus=NULL)
 This method checks if the face is starlike. More...
 
bool isLamina (MStatus *ReturnStatus=NULL)
 This method checks if the face is a lamina (the face is folded over onto itself). More...
 
bool isHoled (MStatus *ReturnStatus=NULL)
 This method checks if the face has any holes. More...
 
bool isPlanar (MStatus *ReturnStatus=NULL)
 This method checks if the face is planar. More...
 
bool isUVReversed (const MString *uvSet=NULL, MStatus *ReturnStatus=NULL)
 This method checks if the winding order of UV's for this face are reversed (clockwise), or not (counter clockwise) More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 

Detailed Description

Polygon iterator.

This class is the iterator for polygonal surfaces (meshes).

The iterator functions in two modes depending on whether a component is specified. When a component is not given or is NULL the iteration will be over all polygons for the surface. When a component is given this iterator will iterate over the polygons (faces) specified in the component. When iterating over components a DAG path to the surface must also be supplied.

Examples:
cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp, convertVerticesToFacesCmd/convertVerticesToFacesCmd.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, lassoTool/lassoTool.cpp, meshOpCmd/meshOpFtyAction.cpp, narrowPolyRenderOverride/narrowPolyRenderOverride.cpp, objExport/objExport.cpp, peltOverlapCmd/peltOverlapCmd.cpp, pointOnMeshInfo/getPointAndNormal.cpp, polyRawExporter/polyWriter.cpp, polyX3DExporter/polyWriter.cpp, splitUVCmd/splitUVCmd.cpp, and splitUVCmd/splitUVFtyAction.cpp.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MItMeshPolygon ( const MObject polyObject,
MStatus ReturnStatus = NULL 
)

Constructor.

Creates an iterator for all polygons of the given surface.

Parameters
[in]polyObjectThe surface to iterate over
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MItMeshPolygon ( const MDagPath polyObject,
MObject component = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Constructor.

Creates an iterator for the polygons of the given component. If no component is specified then the iteration will be for all polygons of the given surface.

Parameters
[in]polyObjectThe surface (mesh) to iterate over
[in]componentThe polygons of the polyObject to iterate over
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
~MItMeshPolygon ( )
virtual

Destructor.

Frees up storage used by the iterator.

Member Function Documentation

bool isDone ( MStatus ReturnStatus = NULL)

Indicates if all of the polygons have been traversed yet.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if all polygons have been traversed, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, and splitUVCmd/splitUVFtyAction.cpp.
MStatus next ( )

Advance to the next polygon in the iteration.

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, and splitUVCmd/splitUVFtyAction.cpp.
MStatus reset ( )

Reset the iterator to the first polygon.

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, pointOnMeshInfo/getPointAndNormal.cpp, and splitUVCmd/splitUVFtyAction.cpp.
MStatus reset ( const MObject polyObject)

Reset the iterator to the first polygon in the supplied surface.

Parameters
[in]polyObjectThe polygon for the iteration
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus reset ( const MDagPath polyObject,
MObject component = MObject::kNullObj 
)

Reset the iterator with the given surface and component.

If component is null then the iteration will be for all polygons in the given surface. If component has invalid indices those will be automatically removed.

Parameters
[in]polyObjectThe surface (mesh) to iterate over
[in]componentThe polygons (faces) of the polyObject to iterate over
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
unsigned int count ( MStatus ReturnStatus = NULL)

Return the number of polygons in the iteration.

Parameters
[out]ReturnStatusStatus code
Returns
The number of polygons in the iteration
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp.
unsigned int polygonVertexCount ( MStatus ReturnStatus = NULL)

Return the number of vertices for the current polygon.

Parameters
[out]ReturnStatusStatus code
Returns
The number of vertices for the current polygon
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
splitUVCmd/splitUVFtyAction.cpp.
MPoint center ( MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
)

Return the position of the center of the current polygon.

Parameters
[in]spaceThe coordinate system for this operation
[out]ReturnStatusStatus code
Returns
The center of the current polygon
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MObject polygon ( MStatus ReturnStatus = NULL)

Deprecated in 2019.0

Get the current polygon in the iteration as a component.

Deprecated:
Use the MItMeshPolygon::currentItem method.
2019.0:
Deprecated in this version.

Components are used to specify one or more polygons and are useful in operating on groups of non-contiguous polygons for a surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters
[out]ReturnStatusStatus code
Returns
The current polygon in the iteration
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.
MObject currentItem ( MStatus ReturnStatus = NULL)

Get the current polygon in the iteration as a component.

Components are used to specify one or more polygons and are useful in operating on groups of non-contiguous polygons for a surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters
[out]ReturnStatusStatus code
Returns
The current polygon in the iteration
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.
unsigned int index ( MStatus ReturnStatus = NULL)

Returns the index of the current polygon.

Parameters
[out]ReturnStatusStatus code
Returns
The index of the current polygon
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, and splitUVCmd/splitUVFtyAction.cpp.
MStatus setIndex ( int  index,
int &  prevIndex 
)

This method sets the index of the current face to be accessed.

The current face will no longer be in sync with any previous iteration.

Parameters
[in]indexThe index of desired face to access.
[in]prevIndexThe index of the current face in the iteration
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
Examples:
pointOnMeshInfo/getPointAndNormal.cpp.
unsigned int vertexIndex ( int  index,
MStatus ReturnStatus = NULL 
)

Returns the object-relative index of the specified vertex of the current polygon.

The index returned may be used to refer to an element in the vertex list returned by MFnMesh::getPoints.

Parameters
[in]indexThe face-relative index of the vertex in the polygon
[out]ReturnStatusStatus code
Returns
The index in the polygon array of the given vertex
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getVertices ( MIntArray vertices)

This method gets the indices of the vertices of the current face.

Parameters
[out]verticesAn array to place all the vertex indices into
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MPoint point ( int  index,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
)

Return the position of the vertex at index in the current polygon.

Parameters
[in]indexThe face-relative index of the vertex in the current polygon
[in]spaceThe coordinate system for this operation
[out]ReturnStatusStatus code
Returns
The vertex position
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
void getPoints ( MPointArray pointArray,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
)

Retrieves the positions of the vertices on the current face/polygon that the iterator is pointing to.

Vertex positions will be inserted into the given array and will be indexed using face-relative vertex IDs (ie. ordered from 0 to (vertexCount of the face) - 1), which should not be confused with the vertexIDs of each vertex in relation to the entire mesh object.

Parameters
[out]pointArrayThe array where the vertex positions will be stored
[in]spaceThe coordinate system for this operation
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setPoint ( const MPoint point,
unsigned int  index,
MSpace::Space  space = MSpace::kObject 
)

Set the vertex at the given index in the current polygon.

Parameters
[in]pointThe new position for the vertex
[in]indexThe face-relative index of the vertex in the current polygon
[in]spaceThe coordinate system for this operation
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setPoints ( MPointArray pointArray,
MSpace::Space  space = MSpace::kObject 
)

Sets new locations for vertices of the current polygon that the iterator is pointing to.

Parameters
[in]pointArrayThe new positions for the vertices.
[in]spaceThe coordinate system for this operation.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
unsigned int normalIndex ( int  localVertexIndex,
MStatus ReturnStatus = NULL 
) const

Returns the normal index for the specified vertex.

This index refers to an element in the normal array returned by MFnMesh::getNormals. These normals are per-polygon per-vertex normals. See the MFnMesh description for more information on normals.

Parameters
[in]localVertexIndexThe face-relative index of the vertex to examine for the current polygon
[out]ReturnStatusStatus code
Returns
The index of the normal for the specified vertex
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getNormal ( MVector normal,
MSpace::Space  space = MSpace::kObject 
) const

Return the face normal of the current polygon.

Parameters
[out]normalStorage for the normal
[in]spaceThe transformation space
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Unable to do world space transformation.
MStatus getNormal ( unsigned int  index,
MVector normal,
MSpace::Space  space = MSpace::kObject 
) const

Returns the vertex-face normal for the vertex in the current polygon.

Parameters
[in]indexface-relative vertex index of the vertex whose normal to retrieve
[out]normalStorage for the normal
[in]spaceThe transformation space
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Unable to do world space transformation.
MStatus getNormals ( MVectorArray normalArray,
MSpace::Space  space = MSpace::kObject 
) const

Returns the normals for all vertices in the current face.

Parameters
[out]normalArrayStorage for the normals
[in]spaceThe transformation space
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Unable to do world space transformation.
unsigned int tangentIndex ( int  localVertexIndex,
MStatus ReturnStatus = NULL 
) const

Returns the tangent (or binormal) index for the specified vertex.

This index refers to an element in the normal array returned by MFnMesh::getTangents. These tangent or binormals are per-polygon per-vertex. See the MFnMesh description for more information on tangents and binormals.

Parameters
[in]localVertexIndexThe face-relative index of the vertex to examine for the current polygon
[out]ReturnStatusStatus code
Returns
The index of the tangent for the specified vertex
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool hasUVs ( MStatus ReturnStatus = NULL) const

Tests whether this face has UV's mapped or not (either all the vertices for a face should have UV's, or none of them do, so the UV count for a face is either 0, or equal to the number of vertices).

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if the face has UV's mapped, false otherwise
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
splitUVCmd/splitUVFtyAction.cpp.
bool hasUVs ( const MString uvSet,
MStatus ReturnStatus = NULL 
) const

Tests whether this face has UV's mapped or not (either all the vertices for a face should have UV's, or none of them do, so the UV count for a face is either 0, or equal to the number of vertices).

Parameters
[in]uvSetUV set to work with
[out]ReturnStatusStatus code
Returns
Boolean value: true if the face has UV's mapped, false otherwise
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setUV ( int  vertexId,
float2 &  uvPoint,
const MString uvSet = NULL 
)

Modify the UV value for the given vertex in the current face.

If the face is not already mapped, this method will fail.

Parameters
[in]vertexIdface-relative index of the vertex to set UV for.
[in]uvPointThe UV values to set it to
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getUV ( int  vertex,
float2 &  uvPoint,
const MString uvSet = NULL 
) const

Return the texture coordinate for the given vertex.

Parameters
[in]vertexThe face-relative vertex index to get UV for
[out]uvPointStorage for u and v values
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid vertex index given. The vertex index must be less than polygonVertexCount() and must also be mapped by the specified uvSet.
MStatus setUVs ( MFloatArray uArray,
MFloatArray vArray,
const MString uvSet = NULL 
)

Modify the UV value for all vertices in the current face.

If the face has not already been mapped, this method will fail.

Parameters
[in]uArrayAll the U values - in local face order
[in]vArrayThe corresponding V values
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getUVs ( MFloatArray uArray,
MFloatArray vArray,
const MString uvSet = NULL 
) const

Return the all the texture coordinates for the vertices of this face (in local vertex order).

Parameters
[out]uArrayStorage for u values
[out]vArrayStorage for v values
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid vertex index given. The vertex index must be less than polygonVertexCount() and must also be mapped by the specified uvSet.
Examples:
pointOnMeshInfo/getPointAndNormal.cpp.
MStatus getPointAtUV ( MPoint pt,
float2 &  uvPoint,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL,
float  tolerance = 0.0 
)

Return the position of the point at the given UV value in the current polygon.

Parameters
[out]ptSpace for the point
[in]uvPointThe UV value to try to locate
[in]spaceThe coordinate system for this operation
[in]uvSetUV set to work with
[in]tolerancetolerance value to compare float data type
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kIndexInvalid The specified UV set is not found.
Examples:
pointOnMeshInfo/getPointAndNormal.cpp.
MStatus getAxisAtUV ( MVector normal,
MVector uTangent,
MVector vTangent,
float2 &  uvPoint,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL,
float  tolerance = 0.0 
)

Return the axis of the point at the given UV value in the current polygon.

The axis or affine space is defined by non-normalized and non-orthogonized U tangent, V tangent and normal. It's useful to detect local surface deformation for meshes with similar UV mapping.

Parameters
[out]normalnormal for the point
[out]uTangentu tangent for the point
[out]vTangentv tangent for the point
[in]uvPointThe UV value to try to locate
[in]spaceThe coordinate system for this operation
[in]uvSetUV set to work with
[in]tolerancetolerance value to compare float data type
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid UV set, or cannot do worldSpace operation.
  • MS::kNotFound The given UV value is not found in face.
MStatus getUVAtPoint ( MPoint pt,
float2 &  uvPoint,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL 
)

Find the point closest to the given point in the current polygon, and return the UV value at that point.

Parameters
[in]ptThe point to try to get UV for
[out]uvPointStorage for the UV value
[in]spaceThe coordinate system for this operation
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getUVIndex ( int  vertex,
int &  index,
const MString uvSet = NULL 
)

Returns the index of the texture coordinate for the given vertex.

This index refers to an element of the texture coordinate array for the polygonal object returned by MFnMesh::getUVs.

Parameters
[in]vertexThe face-relative vertex index of the current polygon
[out]indexStorage for the texture coordinate index of the specified vertex
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter An invalid vertex index given. The vertex index must be less than polygonVertexCount() and must also be mapped by the specified uvSet.
Examples:
splitUVCmd/splitUVFtyAction.cpp.
MStatus getUVIndex ( int  vertex,
int &  index,
float &  u,
float &  v,
const MString uvSet = NULL 
)

Return the index of the texture coordinate for the given vertex.

This index refers to an element of the texture coordinate array for the polygonal object returned by MFnMesh::getUVs.

Parameters
[in]vertexThe face-relative vertex index of the current polygon
[out]indexStorage for the texture coordinate index of the specified vertex
[out]uStorage for u value
[out]vStorage for v value
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter An invalid vertex index given. The vertex index must be less than polygonVertexCount() and must also be mapped by the specified uvSet.
MStatus getUVSetNames ( MStringArray setNames) const

This method is used to find the UV set names mapped to the current face.

Parameters
[out]setNamesThe string array to return the UV sets names in
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred or an internal error.
bool hasColor ( MStatus ReturnStatus = NULL) const

This method determines whether the current face has color-per-vertex set for any vertex.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if at least one vertex has color, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool hasColor ( int  vertexIndex,
MStatus ReturnStatus = NULL 
)

This method determines whether the current face has color-per-vertex set for the given vertex.

Parameters
[in]vertexIndexface-relative vertex index to check for color on
[out]ReturnStatusStatus code
Returns
Boolean value: true if the given vertex has color, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getColor ( MColor color,
const MString colorSetName = NULL 
)

This method gets the average color of the all the vertices in this face.

Parameters
[out]colorThe average color
[in]colorSetNameName of the color set.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getColor ( MColor color,
int  index 
)

This method gets the color of the specified vertex in this face.

Parameters
[out]colorThe color to get
[in]indexThe face-relative vertex index on this face
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getColors ( MColorArray colors,
const MString colorSetName = NULL 
)

This method gets the color of the each vertex in the current face.

Parameters
[out]colorsStorage for the colors of the vertice in this face
[in]colorSetNameName of the color set.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus numColors ( int &  colorCount,
const MString colorSetName = NULL 
)

This method checks for the number of colors on vertices in this face.

Parameters
[out]colorCountStorage for the color count
[in]colorSetNameName of the color set.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getColorIndex ( int  vertexIndex,
int &  colorIndex,
const MString colorSetName = NULL 
)

This method returns the colorIndex for a vertex of the current face.

Parameters
[in]vertexIndexFace-relative index of vertex.
[out]colorIndexColor index filled in this function.
[in]colorSetNameName of the color set.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getColorIndices ( MIntArray colorIndices,
const MString colorSetName = NULL 
)

This method returns the colorIndices for each vertex on the face.

Parameters
[out]colorIndicesColor index filled in this function.
[in]colorSetNameName of the color set.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
bool hasValidTriangulation ( MStatus ReturnStatus = NULL) const

This method checks if the face has a valid triangulation.

If it doesn't, then the face was bad geometry: it may gave degenerate points or cross over itself.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true the face has a valid triangulation false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus numTriangles ( int &  triCount) const

This Method checks for the number of triangles in this face in the current triangulation.

Parameters
[out]triCountStorage for the triangle count
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getTriangle ( int  localTriIndex,
MPointArray points,
MIntArray vertexList,
MSpace::Space  space = MSpace::kObject 
) const

Get the vertices and vertex positions of the given triangle in the current face's triangulation.

Parameters
[in]localTriIndexLocal index of the desired triangle in this face
[out]pointsStorage for all the vertex points
[out]vertexListStorage for all the vertex indices
[in]spaceWorld Space or Object Space
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getTriangles ( MPointArray points,
MIntArray vertexList,
MSpace::Space  space = MSpace::kObject 
) const

Get the vertices and vertex positions of all the triangles in the current face's triangulation.

Parameters
[out]pointsStorage for all the vertex points
[out]vertexListStorage for all the vertex indices
[in]spaceWorld Space or Object Space
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus updateSurface ( )

Signal that this polygonal surface has changed and needs to redraw itself.

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus geomChanged ( )

Reset the geom pointer in the MItMeshPolygon.

This is now being handled automatically inside the iterator, and users should no longer need to call this method directly to sync up the iterator to changes made by MFnMesh

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getEdges ( MIntArray edges)

This method gets the indices of the edges contained in the current face.

Parameters
[out]edgesAn array to place all the edge indices into
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getConnectedFaces ( MIntArray faces)

This method gets the indices of the faces connected to the current face.

Parameters
[out]facesAn array to place all the face indices into
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getConnectedEdges ( MIntArray edges)

This method gets the indices of the edges connected to the vertices of the current face, but DOES not include the edges contained in the current face.

Parameters
[out]edgesAn array to place all the edge indices into
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getConnectedVertices ( MIntArray vertices)

This method gets the object-relative indices of the vertices surrounding the vertices of the current face, but does not include the vertices of the current face.

Parameters
[out]verticesAn array to stuff all the vertex indices into
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isConnectedToFace ( int  index,
MStatus ReturnStatus = NULL 
)

This method determines whether the given face is adjacent to the current face.

Parameters
[in]indexIndex of the face to be tested for
[out]ReturnStatusStatus code
Returns
true if connected, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isConnectedToEdge ( int  index,
MStatus ReturnStatus = NULL 
)

This method determines whether the given edge is connected to a vertex in the current face.

Parameters
[in]indexIndex of the edge to be tested for
[out]ReturnStatusStatus code
Returns
Boolean value: true if connected, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isConnectedToVertex ( int  index,
MStatus ReturnStatus = NULL 
)

This method determines whether the given vertex shares an edge with a vertex in the current face.

Parameters
[in]indexIndex of the vertex to be tested for
[out]ReturnStatusStatus code
Returns
Boolean value: true if connected, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus numConnectedFaces ( int &  faceCount) const

This method checks for the number of connected faces.

Parameters
[out]faceCountStorage for the face count
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus numConnectedEdges ( int &  edgeCount) const

This method checks for the number of connected edges on the vertices of this face.

Parameters
[out]edgeCountStorage for the edge count
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
bool onBoundary ( MStatus ReturnStatus = NULL)

This method determines whether the current face is on a boundary.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if on a boundary, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getArea ( double &  area,
MSpace::Space  space = MSpace::kObject 
)

This method gets the area of the face.

Parameters
[out]areaThe area
[in]spaceWorld Space or Object Space
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool zeroArea ( MStatus ReturnStatus = NULL)

This method checks if its a zero area face.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if the face has zero area, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
MStatus getUVArea ( double &  area,
const MString uvSet = NULL 
)

This method gets the UV area of the face.

Parameters
[out]areaThe uv area
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool zeroUVArea ( MStatus ReturnStatus = NULL)

This method checks if the UV area of the face is zero.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if the face has zero UV area, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool zeroUVArea ( const MString uvSet,
MStatus ReturnStatus = NULL 
)

This method checks if the UV area of the face is zero.

Parameters
[in]uvSetUV set to work with
[out]ReturnStatusStatus code
Returns
  • true if the face has zero UV area
  • false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isConvex ( MStatus ReturnStatus = NULL)

This method checks if the face is convex.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if the face is convex, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isStarlike ( MStatus ReturnStatus = NULL)

This method checks if the face is starlike.

That is, a line from the centre to any vertex lies entirely within the face.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if the face is starlike, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isLamina ( MStatus ReturnStatus = NULL)

This method checks if the face is a lamina (the face is folded over onto itself).

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true if the face is a lamina, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isHoled ( MStatus ReturnStatus = NULL)

This method checks if the face has any holes.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true the face has one or more holes, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isPlanar ( MStatus ReturnStatus = NULL)

This method checks if the face is planar.

Parameters
[out]ReturnStatusStatus code
Returns
Boolean value: true the face is planar, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
bool isUVReversed ( const MString uvSet = NULL,
MStatus ReturnStatus = NULL 
)

This method checks if the winding order of UV's for this face are reversed (clockwise), or not (counter clockwise)

Parameters
[in]uvSetUV set to work with
[out]ReturnStatusStatus code
Returns
Boolean value: true if the UV's are reversed (clockwise) false if the UV's are not reversed (counter clockwise).
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid index given.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files: