OpenMaya.MItMeshPolygon Class Reference

OpenMaya.MItMeshPolygon Class Reference

Class Description

This class is the iterator for polygonal surfaces (meshes).
+ Inheritance diagram for OpenMaya.MItMeshPolygon:

Public Member Functions

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

Constructor & Destructor Documentation

OpenMaya.MItMeshPolygon.__init__ ( )
x.__init__(...) initializes x; see help(type(x)) for signature

Member Function Documentation

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

Return the number of polygons in the iteration
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.
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
OpenMaya.MItMeshPolygon.getArea ( )
getArea(space=kObject) -> float

This method gets the area of the face

* space (int) - World Space or Object Space
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.
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.
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.
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.
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
OpenMaya.MItMeshPolygon.getConnectedFaces ( )
getConnectedFaces() -> MIntArray

This method gets the indices of the faces connected to the current face.
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
OpenMaya.MItMeshPolygon.getEdges ( )
getEdges() -> MIntArray

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

Return the face normal of the current polygon.

* space (int) - The transformation space

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
OpenMaya.MItMeshPolygon.getNormals ( )
getNormals(space=kObject) -> MVectorArray

Returns the normals for all vertices in the current face

* space (int) - The transformation space
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
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
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
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
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
OpenMaya.MItMeshPolygon.getUVArea ( )
getUVArea(uvSet=None) -> float

This method gets the UV area of the face

* uvSet (string) - UV set to work with
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
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
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
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
OpenMaya.MItMeshPolygon.getUVSetNames ( )
getUVSetNames() -> list of strings

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

This method gets the indices of the vertices of the current face
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
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
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.
OpenMaya.MItMeshPolygon.index ( )
index() -> int

Returns the index of the current polygon
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
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
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
OpenMaya.MItMeshPolygon.isConvex ( )
isConvex() -> bool

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

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

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

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

This method checks if the face is planar
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.
OpenMaya.MItMeshPolygon.next ( )
next() -> self

Advance to the next edge in the iteration.
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
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.
OpenMaya.MItMeshPolygon.numConnectedEdges ( )
numConnectedEdges() -> int

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

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

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

This method determines whether the current face is on a boundary
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
OpenMaya.MItMeshPolygon.polygonVertexCount ( )
polygonVertexCount() -> int

Return the number of vertices for the current polygon
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
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.
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
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.
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
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
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
OpenMaya.MItMeshPolygon.updateSurface ( )
updateSurface() -> self

Signal that this polygonal surface has changed and needs to redraw itself.
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
OpenMaya.MItMeshPolygon.zeroArea ( )
zeroArea() -> bool

This method checks if its a zero area face
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