Python API 2.0 Reference
OpenMaya.MItMeshPolygon Class Reference
+ Inheritance diagram for OpenMaya.MItMeshPolygon:

Public Member Functions

def __init__ ()
 
def __iter__ ()
 
def __next__ ()
 
def center ()
 
def count ()
 
def currentItem ()
 
def geomChanged ()
 
def getArea ()
 
def getColor ()
 
def getColorIndex ()
 
def getColorIndices ()
 
def getColors ()
 
def getConnectedEdges ()
 
def getConnectedFaces ()
 
def getConnectedVertices ()
 
def getEdges ()
 
def getNormal ()
 
def getNormals ()
 
def getPointAtUV ()
 
def getPoints ()
 
def getTriangle ()
 
def getTriangles ()
 
def getUV ()
 
def getUVArea ()
 
def getUVAtPoint ()
 
def getUVIndex ()
 
def getUVIndexAndValue ()
 
def getUVSetNames ()
 
def getUVs ()
 
def getVertices ()
 
def hasColor ()
 
def hasUVs ()
 
def hasValidTriangulation ()
 
def index ()
 
def isConnectedToEdge ()
 
def isConnectedToFace ()
 
def isConnectedToVertex ()
 
def isConvex ()
 
def isDone ()
 
def isHoled ()
 
def isLamina ()
 
def isPlanar ()
 
def isStarlike ()
 
def isUVReversed ()
 
def iter ()
 
def iternext ()
 
def next ()
 
def normalIndex ()
 
def numColors ()
 
def numConnectedEdges ()
 
def numConnectedFaces ()
 
def numTriangles ()
 
def onBoundary ()
 
def point ()
 
def polygonVertexCount ()
 
def reset ()
 
def setIndex ()
 
def setPoint ()
 
def setPoints ()
 
def setUV ()
 
def setUVs ()
 
def tangentIndex ()
 
def updateSurface ()
 
def vertexIndex ()
 
def zeroArea ()
 
def zeroUVArea ()
 

Static Public Member Functions

def __new__ ()
 

Detailed Description

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

Constructor & Destructor Documentation

def OpenMaya.MItMeshPolygon.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMaya.MItMeshPolygon.__iter__ ( )
Implement iter(self).
def OpenMaya.MItMeshPolygon.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMaya.MItMeshPolygon.__next__ ( )
Implement next(self).
def OpenMaya.MItMeshPolygon.center ( )
center(space=kObject) -> MPoint

Return the position of the center of the current polygon

* space (int) - The coordinate system for this operation
def OpenMaya.MItMeshPolygon.count ( )
count() -> int

Return the number of polygons in the iteration
def OpenMaya.MItMeshPolygon.currentItem ( )
currentItem() -> MObject

Get the current polygon in the iteration as a component.

Components are used to specify one or more polygons and are usefull 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.
def OpenMaya.MItMeshPolygon.geomChanged ( )
geomChanged() -> self

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
def OpenMaya.MItMeshPolygon.getArea ( )
getArea(space=kObject) -> float

This method gets the area of the face

* space (int) - World Space or Object Space
def OpenMaya.MItMeshPolygon.getColor ( )
getColor(colorSetName=None) -> MColor
getColor(vertexIndex) -> MColor

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

* index (int) - The face-relative vertex index on this face

Or the average color of the all the vertices in this face

* colorSetName (string) - Name of the color set.
def OpenMaya.MItMeshPolygon.getColorIndex ( )
getColorIndex(vertexIndex, colorSetName=None) -> int

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

* vertexIndex (int) - Face-relative index of vertex.
* colorSetName (string) - Name of the color set.
def OpenMaya.MItMeshPolygon.getColorIndices ( )
getColorIndices(colorSetName=None) -> MIntArray

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

* colorSetName (string) - Name of the color set.
def OpenMaya.MItMeshPolygon.getColors ( )
getColors(colorSetName=None) -> MColorArray

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

* colorSetName (string) - Name of the color set.
def OpenMaya.MItMeshPolygon.getConnectedEdges ( )
getConnectedEdges() -> MIntArray

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
def OpenMaya.MItMeshPolygon.getConnectedFaces ( )
getConnectedFaces() -> MIntArray

This method gets the indices of the faces connected to the current face.
def OpenMaya.MItMeshPolygon.getConnectedVertices ( )
getConnectedVertices() -> MIntArray

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
def OpenMaya.MItMeshPolygon.getEdges ( )
getEdges() -> MIntArray

This method gets the indices of the edges contained in the current face.
def OpenMaya.MItMeshPolygon.getNormal ( )
getNormal(space=kObject) -> MVector
getNormal(vertexIndex, [space=]kObject) -> MVector

Return the face normal of the current polygon.

* space (int) - The transformation space. The keyword 'space' has to be explicitly stated. If not present, the argument will be identified as a 'vertexIndex' argument, and the second form of this function will be used instead.

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

* index (int) - face-relative vertex index of the vertex whose normal to retrieve
* space (int) - The transformation space. Defaults to kObject, the keyword 'space' is optional as well.
def OpenMaya.MItMeshPolygon.getNormals ( )
getNormals(space=kObject) -> MVectorArray

Returns the normals for all vertices in the current face

* space (int) - The transformation space
def OpenMaya.MItMeshPolygon.getPointAtUV ( )
getPointAtUV(uvPoint, space=kObject, uvSet=None, tolerance=0) -> MPoint

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

* uvPoint ([float, float]) - The UV value to try to locate
* space (int) - The coordinate system for this operation
* uvSet (string) - UV set to work with
* tolerance (float) - tolerance value to compare float data type
def OpenMaya.MItMeshPolygon.getPoints ( )
getPoints(space=kObject) -> MPointArray

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. 

* space (int) - The coordinate system for this operation
def OpenMaya.MItMeshPolygon.getTriangle ( )
getTriangle(localTriIndex, space=kObject) -> [MPointArray, MIntArray]

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

* localTriIndex (int) - Local index of the desired triangle in this face
* space (int) - World Space or Object Space
def OpenMaya.MItMeshPolygon.getTriangles ( )
getTriangles(space=kObject) -> [MPointArray, MIntArray]

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

* space (int) - World Space or Object Space
def OpenMaya.MItMeshPolygon.getUV ( )
getUV(vertexId, uvSet=None) -> [float, float]

Return the texture coordinate for the given vertex.

* vertex (int) - The face-relative vertex index to get UV for
* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.getUVArea ( )
getUVArea(uvSet=None) -> float

This method gets the UV area of the face

* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.getUVAtPoint ( )
getUVAtPoint(pt, space=kObject, uvSet=None) -> [float, float]

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

* pt (MPoint) - The point to try to get UV for
* space (int) - The coordinate system for this operation
* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.getUVIndex ( )
getUVIndex(vertex, uvSet=None) -> int

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.

* vertex (int) - The face-relative vertex index of the current polygon
* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.getUVIndexAndValue ( )
getUVIndexAndValue(vertex, uvSet=None) -> [int, float, float]

Return the index and value 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.

* vertex (int) - The face-relative vertex index of the current polygon
* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.getUVs ( )
getUVs(uvSet=None) -> [MFloatArray, MFloatArray]

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

* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.getUVSetNames ( )
getUVSetNames() -> list of strings

This method is used to find the UV set names mapped to the current face
def OpenMaya.MItMeshPolygon.getVertices ( )
getVertices() -> MIntArray

This method gets the indices of the vertices of the current face
def OpenMaya.MItMeshPolygon.hasColor ( )
hasColor() -> bool
hasColor(localVertexIndex) -> bool

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

* localVertexIndex (int) - face-relative vertex index to check for color on
def OpenMaya.MItMeshPolygon.hasUVs ( )
hasUVs(uvSet=None) -> bool

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).

* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.hasValidTriangulation ( )
hasValidTriangulation() -> bool

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.
def OpenMaya.MItMeshPolygon.index ( )
index() -> int

Returns the index of the current polygon
def OpenMaya.MItMeshPolygon.isConnectedToEdge ( )
isConnectedToEdge(index) -> bool

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

* index (int) - Index of the face to be tested for
def OpenMaya.MItMeshPolygon.isConnectedToFace ( )
isConnectedToFace(index) -> bool

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

* index (int) - Index of the face to be tested for
def OpenMaya.MItMeshPolygon.isConnectedToVertex ( )
isConnectedToVertex(index) -> bool

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

* index (int) - Index of the face to be tested for
def OpenMaya.MItMeshPolygon.isConvex ( )
isConvex() -> bool

This method checks if the face is convex.
def OpenMaya.MItMeshPolygon.isDone ( )
isDone() -> bool

Indicates if all of the polygons have been traversed yet.
def OpenMaya.MItMeshPolygon.isHoled ( )
isHoled() -> bool

This method checks if the face has any holes.
def OpenMaya.MItMeshPolygon.isLamina ( )
isLamina() -> bool

This method checks if the face is a lamina (the face is folded over onto itself).
def OpenMaya.MItMeshPolygon.isPlanar ( )
isPlanar() -> bool

This method checks if the face is planar
def OpenMaya.MItMeshPolygon.isStarlike ( )
isStarlike() -> bool

This method checks if the face is starlike. That is, a line from the centre to any vertex lies entirely within the face.
def OpenMaya.MItMeshPolygon.isUVReversed ( )
isUVReversed(faceId) -> bool

Returns True if the texture coordinates (uv's) for the face are
reversed (clockwise), False if they are not reversed (counter clockwise).
def OpenMaya.MItMeshPolygon.iter ( )
iter() -> self

Initializes the iterator object for pythonic iteration.
def OpenMaya.MItMeshPolygon.iternext ( )
iternext() -> self

Used in pythonic iteration to move the iterator
def OpenMaya.MItMeshPolygon.next ( )
next() -> self

Advance to the next polygon in the iteration.
def OpenMaya.MItMeshPolygon.normalIndex ( )
normalIndex(vertex) -> int

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.

* localVertexIndex (int) - The face-relative index of the vertex to examine for the current polygon
def OpenMaya.MItMeshPolygon.numColors ( )
numColors(colorSetName=None) -> int

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

* colorSetName (string) - Name of the color set.
def OpenMaya.MItMeshPolygon.numConnectedEdges ( )
numConnectedEdges() -> int

This method checks for the number of connected edges on the vertices of this face
def OpenMaya.MItMeshPolygon.numConnectedFaces ( )
numConnectedFaces() -> int

This method checks for the number of connected faces
def OpenMaya.MItMeshPolygon.numTriangles ( )
numTriangles() -> int

This Method checks for the number of triangles in this face in the current triangulation
def OpenMaya.MItMeshPolygon.onBoundary ( )
onBoundary() -> bool

This method determines whether the current face is on a boundary
def OpenMaya.MItMeshPolygon.point ( )
point(index, space=kObject) -> MPoint

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

* index (int) - The face-relative index of the vertex in the current polygon
* space (int) - The coordinate system for this operation
def OpenMaya.MItMeshPolygon.polygonVertexCount ( )
polygonVertexCount() -> int

Return the number of vertices for the current polygon
def OpenMaya.MItMeshPolygon.reset ( )
reset() -> self
reset(polyObject) -> self
reset(polyObject, component=None) -> self

Reset the iterator to the first polygon

Reset the iterator to the first polygon in the supplied surface

* polyObject (MObject) - The polygon for the iteration

Reset the iterator with the given surface and component.
If component is None then the iteration will be for all polygons in the given surface.

* polyObject (MDagPath) - The surface (mesh) to iterate over
* component (MObject) - The polygons (faces) of the polyObject to iterate over
def OpenMaya.MItMeshPolygon.setIndex ( )
setIndex(index) -> int

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.
Returns the index of the current face in the iteration

* index (int) - The index of desired face to access.
def OpenMaya.MItMeshPolygon.setPoint ( )
setPoint(point, index, space=kObject) -> self

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

* point (MPoint) - The new position for the vertex
* index (int) - The face-relative index of the vertex in the current polygon
* space (int) - The coordinate system for this operation
def OpenMaya.MItMeshPolygon.setPoints ( )
setPoints(pointArray, space=kObject) -> self

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

* pointArray (MPointArray) - The new positions for the vertices.
* space (int) - The coordinate system for this operation.
def OpenMaya.MItMeshPolygon.setUV ( )
setUV(vertexId, uvPoint, uvSet=None) -> self

Modify the UV value for the given vertex in the current face.
If the face is not already mapped, this method will fail.

* vertexId (int) - face-relative index of the vertex to set UV for.
* uvPoint ([float, float]) - The UV values to set it to
* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.setUVs ( )
setUVs(uArray, vArray, uvSet=None) -> self

Modify the UV value for all vertices in the current face.
If the face has not already been mapped, this method will fail.

* uArray (MFloatArray) - All the U values - in local face order
* vArray (MFloatArray) - The corresponding V values
* uvSet (string) - UV set to work with
def OpenMaya.MItMeshPolygon.tangentIndex ( )
tangentIndex(localVertexIndex) -> int

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.

* localVertexIndex(int) - The face-relative index of the vertex to examine for the current polygon
def OpenMaya.MItMeshPolygon.updateSurface ( )
updateSurface() -> self

Signal that this polygonal surface has changed and needs to redraw itself.
def OpenMaya.MItMeshPolygon.vertexIndex ( )
vertexIndex(index) -> int

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. 

* index (int) - The face-relative index of the vertex in the polygon
def OpenMaya.MItMeshPolygon.zeroArea ( )
zeroArea() -> bool

This method checks if its a zero area face
def OpenMaya.MItMeshPolygon.zeroUVArea ( )
zeroUVArea(uvSet=None) -> bool

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

* uvSet (string) - UV set to work with