MFnMesh Class Reference

#include <MFnMesh.h>

Class Description

Polygonal surface function set.

Note on Terminology: The following terms are used interchangeably:

  • mesh and object,
  • polygon and face,
  • object-relative indices and global/mesh-relative indices,
  • face-relative indices and local indices

object-relative indices - they range between 0..(numVertices()-1)

face-relative indices - they range between 0..(polygonVertexCount(faceId)-1)

This function set provides access to polygonal meshes. Objects of type MFn::kMesh, MFn::kMeshData, and MFn::kMeshGeom are supported. MFn::kMesh objects are shapes in the DAG, MFn::kMeshGeom objects are the raw geometry that the shapes use, and MFn::kMeshData objects are the data that is passed through dependency graph connections.

NOTE: If the function set has been initialized with a MFn::kMesh object then it must have geometry attached.

Mesh Construction Meshes are created by specifying a vertex list, a list of vertex counts per-polygon, and a list of vertices that make up the polygons. Edge data is also maintained for the mesh and can be returned to the caller. The following lists are used by the create method to construct a mesh:

  • vertex list All of the vertices for the mesh are stored in a master vertex list which is an array indexed from 0 to numVertices()-1. Vertices in this list can be shared among polygons.
  • polygon count list This is a list containing the number of vertices for each polygon. Each polygon in the mesh would have an entry in this list containing its number of vertices.
  • vertex connection list This is a list of the vertex id's for each polygon. Since polygons can have different numbers of vertices, the polygon count list is used to determine which polygons are represented by the various sections of this list.

There are several cases in which the create method will alter the data passed in:

  • If the data for the mesh is provided in such a way that the verticies for some polygons are specified in a clockwise direction, and others in a counter-clockwise direction, the edges between neighboring polygons with reversed orderings will be duplicated. In this context, "duplicating an edge" means that copies will be made of the edge's vertices and the index list for the adjoining polygons will be redefined to

use the appropriate vertices.

  • If the vertex connection list for a polygon specifies an edge with the same start and end verticies, those edges will be removed. (ie. a polygon specified as 1 2 2 3 4 will be transformed into 1 2 3 4).
  • If the same vertex appears in the vertex connection list for a polygon more than once, another vertex will be created at the same location, and the list will be altered to use the copy. (ie. a polygon specified as 1 2 3 1 4 will be transformed into 1 2 3 5 4, where 5 is in the same location as 1).

Texture Coordinates (UV's) You can optionally specify texture (uv) coordinates. UV coordinates are 2-d coordinates used for mapping textures to the polygons of a mesh. All of the uv coordinates are stored in one or more named UV sets. The default mesh uv list stores uv coordinates in an array indexed from 0 to numUVs()-1. UV's are referenced on a per-polygon per-vertex basis, so for a polygon with 4 vertices there would be 4 uv's. The uv values for a polygon are set by specifying the index of the uv for each vertex of the polygon. This index is the uv's position in the master uv array. UV's are optional so polygons do not have to have uv values associated with them. There may be only 1 or 2 polygons in a mesh that have uv coordinates set, or all of the polygons may have uv's. UV's can also be shared so several different polygons may reference the same uv's. If you are creating a UV for the first time or changing the order of the UV then you need to set the UV using one of the setUV methods and then assign new indices using one of the assignUV methods. It is not necessary to call assignUV if editing the position of an existing UV.

Color per vertex You can optionally specify color per vertex information using this class. It is possible to create and manipulate color per vertex information using the methods available. Many of the color per vertex methods have a default parameter: colorSet. If unspecified, the method will operate on the current color set.

Normals Some of the Normals in Maya are now user-settable. If the vertex normals are not set or locked, they are computed by maya when the mesh changes. If set or locked, the normals remain frozen relative to the object, unless the user unlocks them. There are 3 types of normals for a mesh:

  • Per-vertex per-polygon Polygonal objects store a list of per-vertex per-polygon normals (similar to the vertex list) This list is what is returned by MFnMesh::getNormals and MItMeshPolygon::getNormal(index, normal). As well, MItMeshPolygon::normalIndex( vertexIndex ) returns the index into the normal list for a particular vertex of the polygon.

For a cube, the list would contain 24 normals (4 vertices * 6 polygons) since the edges for a cube are hard and the per-vertex per-polygon normals cannot be shared. For a sphere or torus, which has smooth edges, the normals can be shared, and thus the normal list contains the same number of normals as vertices.

  • Per-polygon normals Polygonal objects store a normal for each polygon. These normals can be accessed via MItMeshPolygon::getNormal(normal) or MFnMesh::getPolygonNormal. So, a cube, which is comprised of 6 polygons would contain 6 such normals.
  • Per-vertex You can also access a normal for each vertex of the mesh, independent of any polygons. Such normals are not stored in the object, but instead are calculated by Maya upon request as the average of all the per-polygon normals for the polygons adjacent to the vertex. These normals are what is returned by MFnMesh::getVertexNormal or MItMeshVertex::getNormal.

Blind Data MFnMesh allows you to create Blind Data types, and to create and access mesh component level blind data, but not object level blind data. Object level data may be assigned through the polyBlindData command or the Blind Data Editor. However, object level blind data is just an ordinary compound dynamic attribute directly on the object. The parent attribute name is BlindDataNNNN where NNNN is the blind data typeID. e.g. if your typeId is 1001 your object will have a compound dynamic attr called BlindData1001.

Handling Components There are also three iterator classes which provide more specific control over the vertices, edges, and polygons of a mesh and are useful when dealing with components. See MItMeshPolygon, MItMeshEdge, and MItMeshVertex.

+ Examples:
+ Inheritance diagram for MFnMesh:

Public Types

enum  MColorRepresentation { kAlpha = 1, kRGB = 3, kRGBA = 4 }
 Specifies which color components are used by a colorSet. More...
 
enum  SplitPlacement { kOnEdge, kInternalPoint, kInvalid }
 Specifies how a point along split is to be determined. More...
 
enum  BoolOperation { kUnion = 1, kDifference, kIntersection }
 Boolean operators. More...
 
- Public Types inherited from MFnDagNode
enum  { kNextPos = 0xff }
 Anonymous enum to store constant values. More...
 
enum  MObjectColorType { kUseDefaultColor = 0, kUseIndexColor, kUseRGBColor }
 Enum to set how an object is colored. More...
 
- Public Types inherited from MFnDependencyNode
enum  MAttrClass { kLocalDynamicAttr = 1, kNormalAttr, kExtensionAttr, kInvalidAttr }
 Specifies the scope of the attribute. More...
 
enum  MdgTimerState { kTimerOff, kTimerOn, kTimerUninitialized, kTimerInvalidState }
 Possible states for the node's timer. More...
 
enum  MdgTimerMetric {
  kTimerMetric_callback, kTimerMetric_compute, kTimerMetric_dirty, kTimerMetric_draw,
  kTimerMetric_fetch, kTimerMetric_callbackViaAPI, kTimerMetric_callbackNotViaAPI, kTimerMetric_computeDuringCallback,
  kTimerMetric_computeNotDuringCallback, kTimerMetrics
}
 The different timer metrics which can be queried. More...
 
enum  MdgTimerType { kTimerType_self, kTimerType_inclusive, kTimerType_count, kTimerTypes }
 The types of timers which can be queried. More...
 

Public Member Functions

virtual MFn::Type type () const
 Function set type. More...
 
virtual ~MFnMesh ()
 Destructor. More...
 
 MFnMesh ()
 Default constructor.
 
 MFnMesh (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MFnMesh (const MDagPath &object, MStatus *ret=NULL)
 Constructor. More...
 
MObject create (int numVertices, int numPolygons, const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface. More...
 
MObject create (int numVertices, int numPolygons, const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface. More...
 
MObject create (int numVertices, int numPolygons, const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, bool storeDoubles, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface. More...
 
MObject create (int numVertices, int numPolygons, const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray &uArray, const MFloatArray &vArray, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new polygonal mesh given an array of vertices, polygon connection information, UV information, and sets this function set to operate on the new surface. More...
 
MObject create (int numVertices, int numPolygons, const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray &uArray, const MFloatArray &vArray, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new polygonal mesh given an array of vertices, polygon connection information, UV information, and sets this function set to operate on the new surface. More...
 
MObject generateSmoothMesh (MObject parentOrOwner=MObject::kNullObj, MMeshSmoothOptions *options=NULL, MStatus *ReturnStatus=NULL)
 Creates a new polygonal mesh using either the Smooth Mesh Preview attributes of this mesh or a set of options specified in an MMeshSmoothOptions object. More...
 
MStatus getSmoothMeshDisplayOptions (MMeshSmoothOptions &options) const
 Retrieve the current display smoothing options for the mesh. More...
 
MStatus setSmoothMeshDisplayOptions (const MMeshSmoothOptions &options)
 Sets the current display smoothing options for the mesh. More...
 
MObject addPolygon (const MPointArray &vertexArray, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Adds a new polygon to this polygonal mesh. More...
 
MObject addPolygon (const MPointArray &vertexArray, int &faceIndex, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Adds a new polygon to this polygonal mesh. More...
 
MObject addPolygon (const MPointArray &vertexArray, const MIntArray &loopCounts, int &faceIndex, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Adds a new polygon to this polygonal mesh. More...
 
MStatus addHoles (int faceIndex, const MPointArray &vertexArray, const MIntArray &loopCounts, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance)
 Adds holes to a mesh polygon. More...
 
MStatus deleteFace (int index, MDGModifier *modifier=NULL)
 Delete this face. More...
 
MStatus deleteEdge (int index, MDGModifier *modifier=NULL)
 Delete this edge. More...
 
MStatus deleteVertex (int index, MDGModifier *modifier=NULL)
 Delete this vertex. More...
 
MStatus split (MIntArray &placements, MIntArray &edgeList, MFloatArray &edgeFactors, MFloatPointArray &internalPoints)
 This function splits a set of edges and faces in a continuous manner. More...
 
MStatus subdivideFaces (MIntArray &faceList, int divisionCount)
 This function subdivides multiple faces. More...
 
MStatus subdivideEdges (MIntArray &edgeList, int divisionCount)
 This function subdivides edges at regular intervals. More...
 
MStatus extrudeFaces (MIntArray &faceList, int extrusionCount, MFloatVector *translation, bool extrudeTogether, float thickness=0.0f, float offset=0.0f)
 This function extrudes a set of faces. More...
 
MStatus extrudeEdges (MIntArray &edgeList, int extrusionCount, MFloatVector *translation, bool extrudeTogether, float thickness=0.0f, float offset=0.0f)
 This function extrudes edges. More...
 
MStatus duplicateFaces (MIntArray &faceList, MFloatVector *translation)
 This function duplicates a set of faces and detaches them from the rest of the mesh. More...
 
MStatus extractFaces (MIntArray &faceList, MFloatVector *translation)
 This function detaches a set of faces from the mesh so that the resulting mesh will contain one more independant piece of geometry and leaves a hole where the faces use to be. More...
 
MStatus collapseFaces (MIntArray &faceList)
 This function collapse faces into vertices. More...
 
MStatus collapseEdges (MIntArray &edgeList)
 This function collapse edges into vertices. More...
 
int numVertices (MStatus *ReturnStatus=NULL) const
 Returns the number of vertices in the vertex list for this mesh. More...
 
int numEdges (MStatus *ReturnStatus=NULL) const
 Returns the number of edges for this mesh. More...
 
int numPolygons (MStatus *ReturnStatus=NULL) const
 Returns the number of polygons for this mesh. More...
 
int numFaceVertices (MStatus *ReturnStatus=NULL) const
 Returns the number of face-vertices for this mesh. More...
 
int polygonVertexCount (int polygonId, MStatus *ReturnStatus=NULL) const
 Returns the number of vertices for the specified polygon. More...
 
int numUVs (MStatus *ReturnStatus=NULL) const
 Returns the number of texture (uv) coordinates for this mesh. More...
 
int numUVs (const MString &uvSet, MStatus *ReturnStatus=NULL) const
 Returns the number of texture (uv) coordinates for this mesh. More...
 
int numColors (MStatus *ReturnStatus=NULL) const
 Returns the number of (vertex) color for this mesh. More...
 
int numColors (const MString &colorSet, MStatus *ReturnStatus=NULL) const
 Returns the number of colors (vertex data) for this mesh. More...
 
int numNormals (MStatus *ReturnStatus=NULL) const
 Returns the number of per-polygon per-vertex normals for this mesh. More...
 
bool hasColorChannels (const MString &colorSet, MStatus *ReturnStatus=NULL) const
 This method returns if the color set has RGB components. More...
 
bool hasAlphaChannels (const MString &colorSet, MStatus *ReturnStatus=NULL) const
 This method returns true if the color set has Alpha component. More...
 
MColorRepresentation getColorRepresentation (const MString &colorSet, MStatus *ReturnStatus=NULL) const
 This method returns the color representation (RGB/RGBA/A) of a color set. More...
 
bool isColorClamped (const MString &colorSet, MStatus *ReturnStatus=NULL) const
 This method returns if the color set has its R,G,B,and A components clamped in the range from 0 to 1. More...
 
MStatus setIsColorClamped (const MString &colorSet, bool clamped)
 Set the color set to be clamped. More...
 
MStatus getTriangles (MIntArray &triangleCounts, MIntArray &triangleVertices) const
 Returns the number of triangles for every polygon face and the vertex Ids of each triangle vertex. More...
 
MStatus getTriangleOffsets (MIntArray &triangleCounts, MIntArray &triangleIndices) const
 Returns the number of triangles for every polygon face and the offset into the vertex indices array for each triangle vertex (see getVertices()). More...
 
MStatus booleanOp (BoolOperation op, MFnMesh &mesh1, MFnMesh &mesh2)
 This method is obsolete. More...
 
MStatus booleanOps (BoolOperation op, const MObjectArray &meshes, bool useLegacy=false)
 Computes the boolean between multiple meshes. More...
 
bool closestIntersection (const MFloatPoint &raySource, const MFloatVector &rayDirection, const MIntArray *faceIds, const MIntArray *triIds, bool idsSorted, MSpace::Space space, float maxParam, bool testBothDirections, MMeshIsectAccelParams *accelerator, MFloatPoint &hitPoint, float *hitRayParam, int *hitFace, int *hitTriangle, float *hitBary1, float *hitBary2, float tolerance=1e-6, MStatus *ReturnStatus=NULL)
 Finds the closest intersection of a ray starting at raySource and travelling in rayDirection with the mesh. More...
 
bool anyIntersection (const MFloatPoint &raySource, const MFloatVector &rayDirection, const MIntArray *faceIds, const MIntArray *triIds, bool idsSorted, MSpace::Space space, float maxParam, bool testBothDirections, MMeshIsectAccelParams *accelerator, MFloatPoint &hitPoint, float *hitRayParam, int *hitFace, int *hitTriangle, float *hitBary1, float *hitBary2, float tolerance=1e-6, MStatus *ReturnStatus=NULL)
 Finds any intersection of a ray starting at raySource and travelling in rayDirection with the mesh. More...
 
bool allIntersections (const MFloatPoint &raySource, const MFloatVector &rayDirection, const MIntArray *faceIds, const MIntArray *triIds, bool idsSorted, MSpace::Space space, float maxParam, bool testBothDirections, MMeshIsectAccelParams *accelerator, bool sortHits, MFloatPointArray &hitPoints, MFloatArray *hitRayParams, MIntArray *hitFaces, MIntArray *hitTriangles, MFloatArray *hitBary1, MFloatArray *hitBary2, float tolerance=1e-6, MStatus *ReturnStatus=NULL)
 Finds all intersections of a ray starting at raySource and travelling in rayDirection with the mesh. More...
 
MStatus sortIntersectionFaceTriIds (MIntArray *faceIds, MIntArray *triIds)
 Convenience routine for sorting faceIds or face/triangle ids before passing them into the closestIntersection(), allIntersections(), or anyIntersection() methods. More...
 
MStatus freeCachedIntersectionAccelerator ()
 If the mesh has a cached accelerator structure, then this routine forces it to be deleted. More...
 
MString cachedIntersectionAcceleratorInfo (MStatus *ReturnStatus=NULL)
 Retrieves a string that describes the intersection acceleration structure for this object, if any. More...
 
bool intersect (const MPoint &raySource, const MVector &rayDirection, MPointArray &points, double tolerance=kMFnMeshPointTolerance, MSpace::Space space=MSpace::kObject, MIntArray *polygonIds=NULL, MStatus *ReturnStatus=NULL) const
 Determines whether the given ray intersects this polygon and if so, returns the points of intersection. More...
 
MStatus getClosestPointAndNormal (const MPoint &toThisPoint, MPoint &theClosestPoint, MVector &theNormal, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL, MMeshIsectAccelParams *accelParams=NULL) const
 Returns the closest point on this surface to the given point. More...
 
MStatus getClosestPoint (const MPoint &toThisPoint, MPoint &theClosestPoint, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL, MMeshIsectAccelParams *accelerator=NULL) const
 Returns the closest point on this surface to the given point. More...
 
MStatus getClosestNormal (const MPoint &toThisPoint, MVector &theNormal, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL, MMeshIsectAccelParams *accelerator=NULL) const
 Returns the closest point on this surface to the given point. More...
 
MStatus getClosestUVs (const float2 &toThisUVPoint, MIntArray &uvIds, const MString *uvSet=NULL) const
 Returns the IDs of the UVs on this surface which are nearest in uv space to the given uv set and coordinate. More...
 
MStatus getConnectedShaders (unsigned int instanceNumber, MObjectArray &shaders, MIntArray &indices) const
 Returns all the shaders (sets) connected to the specified instance of this mesh, as well as an array of polygon/shader assignments. More...
 
MObject copy (const MObject &source, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method creates a copy of a given source mesh. More...
 
MStatus updateSurface ()
 Signal that this polygonal mesh has changed and needs to redraw itself. More...
 
MStatus syncObject ()
 If a non-api operation happens that many have changed the underlying Maya object wrapped by this api object, make sure that the api object references a valid maya object. More...
 
const float * getRawPoints (MStatus *) const
 This method returns a pointer to the internal vertex list for this mesh. More...
 
const double * getRawDoublePoints (MStatus *) const
 This method returns a pointer to the internal vertex list for this mesh. More...
 
const float * getRawNormals (MStatus *) const
 This method returns a pointer to the internal normal list for this mesh. More...
 
MStatus getPoints (MFloatPointArray &vertexArray, MSpace::Space space=MSpace::kObject) const
 This method copies the vertex list for this mesh into the given point array. More...
 
MStatus getPoints (MPointArray &vertexArray, MSpace::Space space=MSpace::kObject) const
 This method copies the vertex list for this mesh into the given point array. More...
 
MStatus setPoints (MFloatPointArray &vertexArray, MSpace::Space space=MSpace::kObject)
 This method copies the points in the given point array to the vertices of this polygon. More...
 
MStatus setPoints (MPointArray &vertexArray, MSpace::Space space=MSpace::kObject)
 This method copies the points in the given point array to the vertices of this mesh. More...
 
MStatus getVertices (MIntArray &vertexCount, MIntArray &vertexList) const
 This method retrieves the object-relative (mesh-relative/global) vertex indices for all polygons. More...
 
MStatus getPolygonVertices (int polygonId, MIntArray &vertexList) const
 This method retrieves the object-relative (mesh-relative/global) vertex indices for the specified polygon. More...
 
MStatus getPolygonTriangleVertices (int polygonId, int triangleId, int triangleVertices[3]) const
 This method retrieves the object-relative (mesh-relative/global) vertex indices for the specified triangle in the specified polygon. More...
 
MStatus setPoint (int vertexId, const MPoint &pos, MSpace::Space space=MSpace::kObject)
 Sets the position of specified vertex in the vertex list for this mesh. More...
 
MStatus getPoint (int vertexId, MPoint &pos, MSpace::Space space=MSpace::kObject) const
 Get the position of the specified vertex in this mesh's vertex list. More...
 
MStatus getNormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const
 This method copies the normal list for this mesh into the given array. More...
 
MStatus setNormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject)
 Set the normal array (user normals) More...
 
MStatus getFaceVertexNormal (int faceIndex, int vertexIndex, MVector &normal, MSpace::Space space=MSpace::kObject) const
 Return a per-vertex-per-face normal for a given face (polygon) and given vertex. More...
 
MStatus getFaceVertexNormals (int faceIndex, MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const
 Return all per-vertex-per-face normals for a given face. More...
 
MStatus getNormalIds (MIntArray &normalIdCounts, MIntArray &normalIds) const
 Return normal indices for all vertices for a all faces. More...
 
MStatus getFaceNormalIds (int faceIndex, MIntArray &normals) const
 Return normal indices for all vertices for a given face. More...
 
MStatus setFaceVertexNormal (MVector &normal, int faceIndex, int vertexIndex, MSpace::Space space=MSpace::kObject, MDGModifier *modifier=NULL)
 Set Normal for this face/vertex pair. More...
 
MStatus setVertexNormal (MVector &normal, int vertexIndex, MSpace::Space space=MSpace::kObject, MDGModifier *modifier=NULL)
 Set Shared Normal for this vertex. More...
 
MStatus setFaceVertexNormals (MVectorArray &normalArray, MIntArray &faceList, MIntArray &vertexList, MSpace::Space space=MSpace::kObject)
 Set Normals for the given face/vertex pairs. More...
 
MStatus setVertexNormals (MVectorArray &normalArray, MIntArray &vertexList, MSpace::Space space=MSpace::kObject)
 Set Shared Normals for these vertices. More...
 
MStatus getVertexNormal (int vertexId, MVector &normal, MSpace::Space space=MSpace::kObject) const
 This method is obsolete. More...
 
MStatus getVertexNormal (int vertexId, bool angleWeighted, MVector &normal, MSpace::Space space=MSpace::kObject) const
 Return the normal at the given vertex. More...
 
MStatus getVertexNormals (bool angleWeighted, MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const
 Return all vertex normals. More...
 
MStatus getPolygonNormal (int polygonId, MVector &normal, MSpace::Space space=MSpace::kObject) const
 Return the normal at the given polygon. More...
 
bool isNormalLocked (int normalId, MStatus *ReturnStatus=NULL) const
 Test if the normal for a face/vertex pairs is locked (user defined). More...
 
MStatus lockVertexNormals (MIntArray &vertexList)
 Lock Shared Normals for these vertices. More...
 
MStatus lockFaceVertexNormals (MIntArray &faceList, MIntArray &vertexList)
 Lock Normals for these face/vertex pairs. More...
 
MStatus unlockVertexNormals (MIntArray &vertexList)
 Unlock Shared Normals for these vertices. More...
 
MStatus unlockFaceVertexNormals (MIntArray &faceList, MIntArray &vertexList)
 Unlock Normals for these face/vertex pairs. More...
 
int getTangentId (int faceIndex, int vertexIndex, MStatus *ReturnStatus=NULL) const
 Return the tangent index for a given face vertex. More...
 
MStatus getTangents (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const
 Return the tangent vectors for all face vertices. More...
 
MStatus getFaceVertexTangent (int faceIndex, int vertexIndex, MVector &tangent, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const
 Return the normalized tangent vector at a given face vertex. More...
 
MStatus getFaceVertexTangents (int faceIndex, MFloatVectorArray &tangents, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const
 Return all per-vertex-per-face tangents for a given face. More...
 
MStatus getBinormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const
 Return the binormal vectors for all face vertices. More...
 
MStatus getFaceVertexBinormal (int faceIndex, int vertexIndex, MVector &normal, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const
 Return the binormal vector at a given face vertex. More...
 
MStatus getFaceVertexBinormals (int faceIndex, MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const
 Return all per-vertex-per-face binormals for a given face. More...
 
bool isRightHandedTangent (int tangentId, const MString *uvSetName=NULL, MStatus *ReturnStatus=NULL) const
 Returns true if the normal, tangent and binormal form a right handed coordinate system. More...
 
bool isPolygonConvex (int faceIndex, MStatus *ReturnStatus=NULL) const
 This method determines if the specified polygon is convex. More...
 
MStatus getEdgeVertices (int edgeId, int2 &vertexList) const
 This method retrieves the object-relative (mesh-relative/global) vertex indices corresponding to the specified edge. More...
 
bool isEdgeSmooth (int edgeId, MStatus *ReturnStatus=NULL) const
 This method determines if the specified edge is smooth (soft). More...
 
MStatus setEdgeSmoothing (int edgeId, bool smooth=true)
 This method sets the specified edge to be hard or smooth (soft). More...
 
MStatus setEdgeSmoothings (const MIntArray &edgeIds, const MIntArray &smooths)
 This method sets the specified edges to be hard or smooth (soft). More...
 
MStatus cleanupEdgeSmoothing ()
 This method updates the mesh after setEdgeSmoothing has been done. More...
 
MStatus getCreaseEdges (MUintArray &edgeIds, MDoubleArray &creaseData) const
 This method returns the crease edges of the mesh, and also the crease data associated with those edges. More...
 
MStatus setCreaseEdges (const MUintArray &edgeIds, const MDoubleArray &creaseData)
 This method sets the specified edges of the mesh as crease edges. More...
 
MUintArray getInvisibleFaces (MStatus *ReturnStatus=NULL) const
 This method returns the invisible faces of the mesh. More...
 
MStatus setInvisibleFaces (const MUintArray &faceIds, bool makeVisible=false)
 This method sets the specified faces of the mesh to be visible or invisible. More...
 
MStatus getCreaseVertices (MUintArray &vertexIds, MDoubleArray &creaseData) const
 This method returns the crease vertices of the mesh, and also the crease data associated with those vertices. More...
 
MStatus setCreaseVertices (const MUintArray &vertexIds, const MDoubleArray &creaseData)
 This method sets the specified vertices of the mesh as crease vertices. More...
 
int numUVSets (MStatus *ReturnStatus=NULL) const
 Returns the number of uv sets for an object. More...
 
MString createUVSetWithName (const MString &uvSetName, MDGModifier *modifier=NULL, MStatus *ReturnStatus=NULL, const MUintArray *instances=NULL)
 Create a new empty uv set for this mesh. More...
 
MString copyUVSetWithName (const MString &fromName, const MString &toName, MDGModifier *modifier=NULL, MStatus *ReturnStatus=NULL)
 Copies a uv set from one to another for this mesh. More...
 
MStatus renameUVSet (const MString &origName, const MString &newName, MDGModifier *modifier=NULL)
 Renames a uv set from one name to another for this mesh. More...
 
MStatus deleteUVSet (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL)
 Deletes a named uv set from the object. More...
 
MStatus setCurrentUVSetName (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL)
 Set the "current" uv set for this object. More...
 
MString currentUVSetName (MStatus *ReturnStatus=NULL, int instance=kMFnMeshInstanceUnspecified) const
 Get the name of the "current" uv set. More...
 
MStatus getUVSetNames (MStringArray &setNames) const
 Get the names of all of the uv sets on this object. More...
 
MStatus getUVSetFamilyNames (MStringArray &familyNames) const
 Get the names of all of the uv set families on this object. More...
 
MStatus getUVSetsInFamily (const MString &familyName, MStringArray &setNames) const
 Get the names of the uv sets that belong to this set family. More...
 
bool isUVSetPerInstance (const MString &name, MStatus *ReturnStatus=NULL) const
 Return true if this set is per-instance, and false if it is shared across all instances. More...
 
MStatus getFaceUVSetNames (int polygonId, MStringArray &setNames) const
 This method returns the list of UV sets mapped to a face. More...
 
MStatus getAssociatedUVSetTextures (const MString uvSetName, MObjectArray &textures) const
 Get a list of texture nodes which are using a given uv set. More...
 
MStatus getAssociatedUVSetInstances (const MString &uvSetName, MIntArray &instances) const
 Get a list of the instance numbers associated with this uv map. More...
 
MStatus setUVs (const MFloatArray &uArray, const MFloatArray &vArray, const MString *uvSet=NULL)
 Sets all of the texture coordinates (uv's) for this mesh. More...
 
MStatus setSomeUVs (const MIntArray &uvIds, const MFloatArray &uArray, const MFloatArray &vArray, const MString *uvSet=NULL)
 Sets the specified texture coordinates (UV's) for this mesh. More...
 
MStatus getUVs (MFloatArray &uArray, MFloatArray &vArray, const MString *uvSet=NULL) const
 This method copies the texture coordinate list for this mesh into the given uv arrays. More...
 
MStatus setUV (int uvId, float u, float v, const MString *uvSet=NULL)
 Sets the specified texture coordinate. More...
 
MStatus getUV (int uvId, float &u, float &v, const MString *uvSet=NULL) const
 Get the value of the specified texture coordinate from this mesh's uv list. More...
 
MStatus getPointAtUV (int polygonId, MPoint &theClosestPoint, 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 getPointsAtUV (MIntArray &polygonIds, MPointArray &points, const float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, float tolerance=0.0) const
 Return the positions of the points at the given UV value on the mesh. More...
 
MStatus getUVAtPoint (MPoint &pt, float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, int *closestPolygon=NULL)
 Find the point closest to the given point, and return the UV value at that point. More...
 
MStatus getAxisAtPoint (MPoint &pt, MVector &normal, MVector &uTangent, MVector &vTangent, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, int *closestPolygon=NULL)
 Find the point on the mesh which is closest to the given point, and return the axis at that point. More...
 
MStatus getPolygonUV (int polygonId, int vertexIndex, float &u, float &v, const MString *uvSet=NULL) const
 Get the value of the specified texture coordinate for a vertex in a polygon. More...
 
MStatus getPolygonUVid (int polygonId, int vertexIndex, int &uvId, const MString *uvSet=NULL) const
 Get the id of the specified texture coordinate for a vertex in a polygon. More...
 
MStatus assignUV (int polygonId, int vertexIndex, int uvId, const MString *uvSet=NULL)
 Maps a texture coordinate to a specified vertex of a polygon. More...
 
MStatus assignUVs (const MIntArray &uvCounts, const MIntArray &uvIds, const MString *uvSet=NULL)
 This method maps all texture coordinates for the mesh. More...
 
MStatus clearUVs (const MString *uvSet=NULL)
 This method clears out all texture coordinates for the mesh, and leaves behind an empty UVset. More...
 
MStatus getAssignedUVs (MIntArray &uvCounts, MIntArray &uvIds, const MString *uvSet=NULL) const
 Get assigned UVs. More...
 
MStatus getUvShellsIds (MIntArray &uvShellIds, unsigned int &nbUvShells, const MString *uvSet=NULL) const
 Constructs an array of unique integer for each UV shell. More...
 
MStatus getPinUVs (MUintArray &pinIds, MDoubleArray &pinData, const MString *uvSet=NULL) const
 This method returns the pin uvs of the mesh, and also the pin data associated with those uvs. More...
 
MStatus setPinUVs (const MUintArray &pinIds, const MDoubleArray &pinData, const MString *uvSet=NULL)
 This method sets the specified uvs of the mesh as "pinned" uvs, a "pinned" uv is one which should not be modified. More...
 
bool isPolygonUVReversed (int polygonId, const MString *uvSet=NULL, MStatus *ReturnStatus=NULL) const
 This method determines if the winding order of texture coordinates (uv's) for specified polygon are reversed (clockwise) More...
 
int numColorSets (MStatus *ReturnStatus=NULL) const
 Returns the number of color sets for an object. More...
 
MString createColorSetWithName (const MString &colorSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL, MStatus *ReturnStatus=NULL)
 Create a new empty color set for this mesh. More...
 
MStatus deleteColorSet (const MString &colorSetName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL)
 Deletes a named color set from the object. More...
 
MStatus setCurrentColorSetName (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL)
 Set the "current" or "working" color set for this object. More...
 
MString currentColorSetName (int instance=kMFnMeshInstanceUnspecified, MStatus *ReturnStatus=NULL) const
 Get the name of the "current" or "working" color set. More...
 
MStatus getColorSetNames (MStringArray &setNames) const
 Get the names of all of the colors sets on this object. More...
 
MStatus getColorSetFamilyNames (MStringArray &familyNames) const
 Get the names of all of the color set families on this object. More...
 
MStatus getColorSetsInFamily (const MString &familyName, MStringArray &setNames) const
 Get the names of the color sets that belong to this set family. More...
 
bool isColorSetPerInstance (const MString &name, MStatus *ReturnStatus=NULL) const
 Return true if this color set is per-instance, and false if it is shared across all instances. More...
 
MStatus getAssociatedColorSetInstances (const MString &setName, MIntArray &instances) const
 Get a list of the instance numbers associated with this color map. More...
 
MStatus setFaceColor (MColor &color, int index)
 Set vertex-face Color for all vertices on this face. More...
 
MStatus setFaceColor (MColor &color, int index, MColorRepresentation rep)
 Set vertex-face Color of specified channels for all vertices on this face. More...
 
MStatus setVertexColor (MColor &color, int index, MDGModifier *modifier=NULL)
 Set color for this vertex. More...
 
MStatus setVertexColor (MColor &color, int index, MDGModifier *modifier, MColorRepresentation rep)
 Set color of specified channels for this vertex. More...
 
MStatus setFaceVertexColor (MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier=NULL)
 Set color for this vertex in this face. More...
 
MStatus setFaceVertexColor (MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier, MColorRepresentation rep)
 Set color of specified channels for this vertex in this face. More...
 
MStatus setFaceVertexColor (int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier=NULL)
 Set color for this vertex in this face. More...
 
MStatus setFaceVertexColor (int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier, MColorRepresentation rep)
 Set color of specified channels for this vertex in this face. More...
 
MStatus setFaceColors (MColorArray &colors, MIntArray &faceList)
 Set color for these faces. More...
 
MStatus setFaceColors (MColorArray &colors, MIntArray &faceList, MColorRepresentation rep)
 Set color of specified channels for these faces. More...
 
MStatus setVertexColors (MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier=NULL)
 Set color for these vertices. More...
 
MStatus setVertexColors (MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep)
 Set color of specified channels for these vertices. More...
 
MStatus setFaceVertexColors (MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier=NULL)
 Set colors for these face/vertex pairs. More...
 
MStatus setFaceVertexColors (MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep)
 Set colors of specified channels for these face/vertex pairs. More...
 
MStatus removeFaceColors (MIntArray &faceList)
 Remove previously set color these faces. More...
 
MStatus removeVertexColors (MIntArray &vertexList)
 Remove color from these vertices. More...
 
MStatus removeFaceVertexColors (MIntArray &faceList, MIntArray &vertexList)
 Remove colors for these face/vertex pairs. More...
 
MStatus getVertexColors (MColorArray &colors, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL)
 Get colors for all Vertices of the given colorSet. More...
 
MStatus getFaceVertexColors (MColorArray &colors, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL)
 Get colors for all vertex/faces of the given color set. More...
 
MStatus getFaceVertexColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet=NULL)
 Get an index into the array returned by getFaceVertexColors. More...
 
MStatus setColors (const MColorArray &colors, const MString *colorSet=NULL)
 Sets all of the colors for this mesh. More...
 
MStatus setColors (const MColorArray &colors, const MString *colorSet, MColorRepresentation rep)
 Sets all of the colors of specified channels for this mesh. More...
 
MStatus setSomeColors (const MIntArray &colorIds, const MColorArray &colors, const MString *colorSet=NULL)
 Sets the specified colors for this mesh. More...
 
MStatus setSomeColors (const MIntArray &colorIds, const MColorArray &colors, const MString *colorSet, MColorRepresentation rep)
 Sets the specified colors of specified channels for this mesh. More...
 
MStatus getColors (MColorArray &colors, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL) const
 This method copies the color array for this mesh into the given color array. More...
 
MStatus getColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet=NULL)
 Get an index into the array returned by getColors. More...
 
MStatus setColor (int colorId, const MColor &color, const MString *colorSet=NULL)
 Sets the specified color values. More...
 
MStatus setColor (int colorId, const MColor &color, const MString *colorSet, MColorRepresentation rep)
 Sets the specified color values of specified channels. More...
 
MStatus getColor (int colorId, MColor &color, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL) const
 Get the value of the specified texture coordinate from this mesh's color list. More...
 
MStatus assignColor (int polygonId, int vertexIndex, int colorId, const MString *colorSet=NULL)
 Maps a color value to a specified vertex of a polygon. More...
 
MStatus assignColors (const MIntArray &colorIds, const MString *colorSet=NULL)
 This method maps all colors for the mesh. More...
 
MStatus clearColors (const MString *colorSet=NULL)
 This method clears out all color for the mesh, and leaves behind an empty color set. More...
 
bool displayColors (MStatus *ReturnStatus=NULL) const
 Determine if the mesh node is set to display vertex colors. More...
 
MStatus setDisplayColors (bool enable)
 Set whether the mesh node should display vertex colors. More...
 
int getHoles (MIntArray &holeInfoArray, MIntArray &holeVertexArray, MStatus *ReturnStatus=NULL)
 Retrieves a list of the holes in the polygon. More...
 
bool onBoundary (int polygonId, MStatus *ReturnStatus=NULL) const
 A method to determines whether the specified face in the mesh is a boundary face. More...
 
bool isBlindDataTypeUsed (int blindDataId, MStatus *ReturnStatus=NULL) const
 Is this BlindData type id is already in use in this scene? More...
 
MStatus createBlindDataType (int blindDataId, MStringArray longNames, MStringArray shortNames, MStringArray formatNames)
 Create a new blind data type. More...
 
bool hasBlindDataComponentId (int compID, MFn::Type compType, int blindDataId, MStatus *ReturnStatus=NULL) const
 Does this component have blind data with the given ID. More...
 
bool hasBlindData (MFn::Type compType, int blindDataId, MStatus *ReturnStatus=NULL) const
 Returns true if any component of the given type on this mesh have blind data with the given ID. More...
 
bool hasBlindDataComponentId (int compID, MFn::Type compType, MStatus *ReturnStatus=NULL) const
 Does this component have any kind of blind data. More...
 
bool hasBlindData (MFn::Type compType, MStatus *ReturnStatus=NULL) const
 Does any component of this type have any blind data. More...
 
MStatus getBlindDataTypes (MFn::Type compType, MIntArray &blindDataIds) const
 Get the list of blind data ID's associated with the given component type on this mesh. More...
 
MStatus getBlindDataAttrNames (int blindDataId, MStringArray &longNames, MStringArray &shortNames, MStringArray &formatNames) const
 Get the blind data attribute names and types for the specified blind data type id. More...
 
MStatus getFaceVertexBlindDataIndex (int faceIndex, int vertexIndex, int &blindDataIndex) const
 Get the single index to retrieve face-vertex blind data. More...
 
MStatus getBlindDataFaceVertexIndices (int blindDataIndex, int &faceIndex, int &vertexIndex) const
 Get the face and vertex indices from the face-vertex blind data index. More...
 
MStatus getIntBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, int &data) const
 Get the blind data value for the specified blind data attribute of the specified component. More...
 
MStatus getIntBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MIntArray &data) const
 Get the blind data value for the specified blind data attribute of the given type of component. More...
 
MStatus getFloatBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, float &data) const
 Get the blind data value for the specified blind data attribute of the specified component. More...
 
MStatus getFloatBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MFloatArray &data) const
 Get the blind data value for the specified blind data attribute for all components of the given type. More...
 
MStatus getDoubleBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, double &data) const
 Get the blind data value for the specified blind data attribute of the specified component. More...
 
MStatus getDoubleBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MDoubleArray &data) const
 Get the blind data value for the specified blind data attribute for all components of the given type. More...
 
MStatus getBoolBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, bool &data) const
 Get the blind data value for the specified blind data attribute of the specified component. More...
 
MStatus getBoolBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MIntArray &data) const
 Get the blind data value for the specified blind data attribute for all components of the given type. More...
 
MString stringBlindDataComponentId (int compID, MFn::Type compType, int blindDataId, MString attrName, MStatus *ReturnStatus=NULL) const
 Get the blind data value for the specified blind data attribute of the specified component. More...
 
MStatus getStringBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MStringArray &data) const
 Get the blind data value for the specified blind data attribute for all components of the given type. More...
 
MString binaryBlindDataComponentId (int compID, MFn::Type compType, int blindDataId, MString attrName, MStatus *ReturnStatus=NULL) const
 Get the blind data value for the specified blind data attribute of the specified component. More...
 
MStatus getBinaryBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MStringArray &data) const
 Get the blind data value for the specified blind data attribute for all components of the given type. More...
 
MStatus setIntBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, int data)
 Set a value for an integer blind data attribute. More...
 
MStatus setIntBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, int data)
 Set a value for an integer blind data on an array of components. More...
 
MStatus setIntBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MIntArray &data)
 Set a values for an integer blind data on an array of components. More...
 
MStatus setFloatBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, float data)
 Set a value for a float blind data attribute. More...
 
MStatus setFloatBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, float data)
 Set a value for float blind data on an array of components. More...
 
MStatus setFloatBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MFloatArray &data)
 Set a values for a float blind data on an array of components. More...
 
MStatus setDoubleBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, double data)
 Set a value for a double blind data attribute. More...
 
MStatus setDoubleBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, double data)
 Set a value for double blind data on an array of components. More...
 
MStatus setDoubleBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MDoubleArray &data)
 Set a values for a double blind data on an array of components. More...
 
MStatus setBoolBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, bool data)
 Set a value for a boolean blind data attribute. More...
 
MStatus setBoolBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, bool data)
 Set a value for boolean blind data on an array of components. More...
 
MStatus setBoolBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MIntArray &data)
 Set a values for a boolean blind data on an array of components. More...
 
MStatus setStringBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString data)
 Set a value for a string blind data attribute. More...
 
MStatus setStringBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MString data)
 Set a value for string blind data on an array of components. More...
 
MStatus setStringBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MStringArray &data)
 Set a values for a string blind data on an array of components. More...
 
MStatus setBinaryBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString data)
 Set a value for a binary blind data attribute. More...
 
MStatus setBinaryBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MString data)
 Set a value for binary blind data on an array of components. More...
 
MStatus setBinaryBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MStringArray &data)
 Set a values for a binary blind data on an array of components. More...
 
MStatus setBinaryBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, char *data, int length)
 Set a value for a binary blind data attribute. More...
 
MStatus clearBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName)
 Delete a value for a binary blind data attribute on a particular componenr. More...
 
MStatus clearBlindData (MFn::Type compType, int blindDataId, MString attrName)
 Delete the values for the given attribute on the given binary blind data type from all components of the given type. More...
 
MStatus clearBlindData (MFn::Type compType)
 Delete all blind data from components of the given type, e.g. More...
 
MStatus clearBlindData (int compID, MFn::Type compType, int blindDataId)
 Delete the values for a binary blind data type (all its attributes) from a particular component. More...
 
MStatus clearBlindData (MFn::Type compType, int blindDataId)
 Delete the values for a binary blind data type (all its attributes) from all components of the given type. More...
 
void setCheckSamePointTwice (bool check=true)
 This method allows the turning on or off of duplicate point checking when polygons are created or added using this class. More...
 
bool getCheckSamePointTwice (void)
 Return true if checking for duplicate points is turned on. More...
 
MStatus createInPlace (int numVertices, int numPolygons, const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects)
 Replaces the existing polygonal mesh with a new one specified by array of vertices and polygon connection information. More...
 
MStatus copyInPlace (const MObject &source)
 This method creates copies the given source mesh onto the current surface. More...
 
MString createColorSetWithName (const MString &colorSetName, MDGModifier *modifier, MStatus *ReturnStatus)
 This method is obsolete. More...
 
MObject generateSmoothMesh (MObject parentOrOwner, MStatus *ReturnStatus)
 This method is obsolete. More...
 
 MFnMesh (const MObject &object, MStatus *ret=NULL)
 Constructor. More...
 
MString currentColorSetName (MStatus *ReturnStatus) const
 This method is obsolete. This method is not available in Python. More...
 
MObject addPolygon (MPointArray &vertexArray, double polyTolerance, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance, bool forceGeometry=true, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method is obsolete. This method is not available in Python. More...
 
bool intersect (MPoint &raySource, MVector &rayDirection, MPointArray &points, MStatus *ReturnStatus=NULL) const
 This method is obsolete. This method is not available in Python. More...
 
bool intersect (const MPoint &raySource, const MVector &rayDirection, MPointArray &points, MStatus *ReturnStatus=NULL) const
 This method is obsolete. This method is not available in Python. More...
 
MStatus getBlindDataAttrNames (int blindDataId, MStringArray &longNames, MStringArray &shortNames) const
 Get the blind data attribute names for the specified blind data type id. More...
 
bool hasBlindData (int compID, MFn::Type compType, int blindDataId, MStatus *ReturnStatus=NULL) const
 This method is obsolete. This method is not available in Python. More...
 
bool hasBlindData (int compID, MFn::Type compType, MStatus *ReturnStatus=NULL) const
 This method is obsolete. This method is not available in Python. More...
 
MStatus createUVSet (MString &uvSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL)
 This method is not available in Python. More...
 
MStatus copyUVSet (const MString &fromName, MString &toName, MDGModifier *modifier=NULL)
 This method is not available in Python. More...
 
MStatus getCurrentUVSetName (MString &setName, int instance=kMFnMeshInstanceUnspecified) const
 This method is not available in Python. More...
 
MStatus createColorSet (MString &colorSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL)
 This method is not available in Python. More...
 
MStatus createColorSet (MString &colorSetName, MDGModifier *modifier, bool clamped, MColorRepresentation rep, const MUintArray *instances=NULL)
 This method is not available in Python. More...
 
MStatus getCurrentColorSetName (MString &setName, int instance=kMFnMeshInstanceUnspecified) const
 This method is not available in Python. More...
 
MStatus getStringBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString &data) const
 This method is obsolete. This method is not available in Python. More...
 
MStatus getBinaryBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString &data) const
 This method is obsolete. This method is not available in Python. More...
 
virtual const adsk::Data::Associationsmetadata (MStatus *ReturnStatus=NULL) const
 This method is not available in Python. More...
 
virtual MStatus setMetadata (const adsk::Data::Associations &)
 This method is not available in Python. More...
 
virtual MStatus validateMetadata (MString &errors) const
 This method is not available in Python. More...
 
- Public Member Functions inherited from MFnDagNode
virtual ~MFnDagNode ()
 Destructor. More...
 
 MFnDagNode ()
 Class Constructor. More...
 
 MFnDagNode (MObject &object, MStatus *ret=NULL)
 This method is not available in Python. More...
 
 MFnDagNode (const MDagPath &object, MStatus *ret=NULL)
 Class Constructor. More...
 
MObject create (const MTypeId &typeId, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new DAG node with the given type tag. More...
 
MObject create (const MTypeId &typeId, const MString &name, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new DAG node with the given type tag. More...
 
MObject create (const MString &type, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new DAG node with the given type tag. More...
 
MObject create (const MString &type, const MString &name, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new DAG node with the given type tag. More...
 
unsigned int parentCount (MStatus *ReturnStatus=NULL) const
 Determines the number of parent Nodes of the Node. More...
 
MObject parent (unsigned int i, MStatus *ReturnStatus=NULL) const
 Queries the DAG Node attached to the Function Set for the parent Node corresponding to the given index. More...
 
MStatus addChild (MObject &child, unsigned int index=kNextPos, bool keepExistingParents=false)
 Makes the given DAG Node a child of the DAG Node to which this instance of the Function Set is attached. More...
 
MStatus removeChild (MObject &child)
 Removes the given DAG Node from the parent. More...
 
MStatus removeChildAt (unsigned int index)
 Removes the child at the given index from the parent. More...
 
unsigned int childCount (MStatus *ReturnStatus=NULL) const
 Determines the number of child Nodes of the Node. More...
 
MObject child (unsigned int i, MStatus *ReturnStatus=NULL) const
 Queries the DAG Node attached to the Function Set for the child Node corresponding to the given index. More...
 
MObject dagRoot (MStatus *ReturnStatus=NULL)
 Determines the root of the first DAG Path to the DAG Node attached to the Function Set. More...
 
bool hasParent (const MObject &node, MStatus *ReturnStatus=NULL) const
 Determines whether or not the given Node is a parent of the DAG Node attached to the Function Set. More...
 
bool hasChild (const MObject &node, MStatus *ReturnStatus=NULL) const
 Determines whether or not the given Node is a child of the DAG Node attached to the Function Set. More...
 
bool isChildOf (const MObject &node, MStatus *ReturnStatus=NULL) const
 Determines whether or not the DAG Node attached to the Function Set is a child of the given node. More...
 
bool isParentOf (const MObject &node, MStatus *ReturnStatus=NULL) const
 Determines whether or not the DAG Node attached to the Function Set is a parent of the given node. More...
 
bool inUnderWorld (MStatus *ReturnStatus=NULL) const
 Determines whether or not the DAG Node is an underworld node. More...
 
bool inModel (MStatus *ReturnStatus=NULL) const
 Determines whether or not the DAG Node is in the model. More...
 
bool isInstanceable (MStatus *ReturnStatus=NULL) const
 Returns true if the DAG node can be instanced, and false otherwise. More...
 
MStatus setInstanceable (const bool how)
 Sets whether or not the DAG node is instanceable. More...
 
bool isInstanced (bool indirect=true, MStatus *ReturnStatus=NULL) const
 Determines whether the DAG Node attached to the Function Set is directly or indirectly instanced. More...
 
bool isInstancedAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Returns true if the specified attribute is instanced. More...
 
unsigned int instanceCount (bool total, MStatus *ReturnStatus=NULL) const
 Determines the number of times the Node attached to the Function Set is instanced. More...
 
MObject duplicate (bool instance=false, bool instanceLeaf=false, MStatus *ReturnStatus=NULL) const
 This method duplicates the DAG hierarchy rooted at the current node. More...
 
MStatus getPath (MDagPath &path) const
 Returns a DAG Path to the DAG Node attached to the Function Set. More...
 
MStatus getAllPaths (MDagPathArray &paths) const
 Determines all DAG Paths to the DAG Node attached to the Function Set. More...
 
MString fullPathName (MStatus *ReturnStatus=NULL) const
 Return a string representing the full path from the root of the dag to this object. More...
 
MString partialPathName (MStatus *ReturnStatus=NULL) const
 Return a string representing the partial path from the root of the dag to this object. More...
 
MMatrix transformationMatrix (MStatus *ReturnStatus=NULL) const
 Returns the object space transformation matrix for this DAG node. More...
 
bool isIntermediateObject (MStatus *ReturnStatus=NULL) const
 Returns true if this object is an intermediate in a geometry calculation. More...
 
MStatus setIntermediateObject (bool isIntermediate)
 Sets whether this object is an intermediate in a geometry calculation. More...
 
int objectColor (MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MStatus setObjectColor (int color)
 Sets the index for the current user defined inactive color used by the node. More...
 
bool usingObjectColor (MStatus *ReturnStatus=NULL) const
 
MStatus setUseObjectColor (bool useObjectColor)
 
MObjectColorType objectColorType (MStatus *ReturnStatus=NULL) const
 Determines whether or not the user defined inactive color will be used for the node, or whether the default inactive color will be used. More...
 
MStatus setObjectColorType (MObjectColorType type)
 Sets whether or not the user defined inactive object color will be used. More...
 
MStatus setObjectColor (const MColor &color)
 Sets the color value for the current user defined inactive color used by the node. More...
 
MColor objectColorRGB (MStatus *ReturnStatus=NULL) const
 Determines the RGB color for the current user defined inactive color used by the node. More...
 
int objectColorIndex (MStatus *ReturnStatus=NULL) const
 Determines the index for the current user defined inactive color used by the node. More...
 
MColor hiliteColor (MStatus *ReturnStatus=NULL) const
 Determines the current hilite color used by the node. More...
 
bool usingHiliteColor (MStatus *ReturnStatus=NULL) const
 Determines whether or not the hilite color will be used for the node. More...
 
MColor dormantColor (MStatus *ReturnStatus=NULL) const
 Determines the dormant color used by this node. More...
 
MColor activeColor (MStatus *ReturnStatus=NULL) const
 Determines the active color used by this node. More...
 
bool drawOverrideEnabled (MStatus *ReturnStatus=NULL) const
 Determines whether or not draw override is turned on for this node. More...
 
bool drawOverrideIsReference (MStatus *ReturnStatus=NULL) const
 Determines whether or not Display Type of the draw override is Reference for this node. More...
 
bool drawOverrideIsTemplate (MStatus *ReturnStatus=NULL) const
 Determines whether or not Display Type of the draw override is Template for this node. More...
 
bool drawOverrideColor (MColor &color, MStatus *ReturnStatus=NULL) const
 Determines the draw override color used by this node. More...
 
MStatus getConnectedSetsAndMembers (unsigned int instanceNumber, MObjectArray &sets, MObjectArray &comps, bool renderableSetsOnly) const
 Returns all the sets connected to the specified instance of this DAG object. More...
 
MBoundingBox boundingBox (MStatus *ReturnStatus=NULL) const
 Returns the bounding box for the dag node in object space. More...
 
MDagPath dagPath (MStatus *ReturnStatus=NULL) const
 Returns the DagPath to which the Function Set is attached. More...
 
virtual MStatus setObject (const MDagPath &path)
 Attaches Function Set to the DAG Node that has the given DAG Path. More...
 
virtual MStatus setObject (MObject &object)
 Attaches Function Set to given DAG Node. More...
 
MObject model (MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
 MFnDagNode (const MObject &object, MStatus *ret=NULL)
 No script support. More...
 
virtual MStatus setObject (const MObject &object)
 No script support. More...
 
- Public Member Functions inherited from MFnDependencyNode
virtual ~MFnDependencyNode ()
 Destructor.
 
 MFnDependencyNode ()
 Default constructor.
 
 MFnDependencyNode (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
MObject create (const MTypeId &typeId, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type tag. More...
 
MObject create (const MTypeId &typeId, const MString &name, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type tag. More...
 
MObject create (const MString &type, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type. More...
 
MObject create (const MString &type, const MString &name, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type. More...
 
MTypeId typeId (MStatus *ReturnStatus=NULL) const
 Returns the type id of this node. More...
 
MString typeName (MStatus *ReturnStatus=NULL) const
 Returns the type name of this node. More...
 
MString name (MStatus *ReturnStatus=NULL) const
 Returns the name of this node. More...
 
MString absoluteName (MStatus *ReturnStatus=NULL) const
 Returns the absolute name of this node. More...
 
MString pluginName (MStatus *ReturnStatus=NULL) const
 Returns the name of the plug-in this MFnDependendencyNode was defined in. More...
 
MString setName (const MString &name, bool createNamespace=false, MStatus *ReturnStatus=NULL)
 Sets the name of this node. More...
 
MUuid uuid (MStatus *ReturnStatus=NULL) const
 Returns the node's UUID. More...
 
void setUuid (const MUuid &uuid, MStatus *ReturnStatus=NULL)
 Sets the node's UUID. More...
 
MStatus getConnections (MPlugArray &array) const
 Get all of the current connections to this node as an array of plugs. More...
 
unsigned int attributeCount (MStatus *ReturnStatus=NULL) const
 Returns the number of attributes that this node has. More...
 
MObject attribute (unsigned int index, MStatus *ReturnStatus=NULL) const
 Finds the attribute of this node at the given index. More...
 
MObject reorderedAttribute (unsigned int index, MStatus *ReturnStatus=NULL) const
 Some nodes, such as the various animCurve nodes, require that their attributes be set in a specific order for proper operation. More...
 
MObject attribute (const MString &attrName, MStatus *ReturnStatus=NULL) const
 Finds the attribute of this node that has the given name. More...
 
MAttrClass attributeClass (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Returns the class (normal, dynamic, extension) of the specified attribute. More...
 
MStatus getAffectedAttributes (const MObject &attr, MObjectArray &affectedAttributes) const
 Returns an array of attributes that are affected by the attribute passed in. More...
 
MStatus getAffectedByAttributes (const MObject &attr, MObjectArray &affectedByAttributes) const
 Returns an array of attributes that affect the attribute passed in, attr. More...
 
MPlug findPlug (const MObject &attr, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const
 Attempt to find a plug for the given attribute. More...
 
MPlug findPlug (const MString &attrName, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const
 Attempt to find a plug for the given attribute. More...
 
MPlug findPlug (const MObject &attr, MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MPlug findPlug (const MString &attrName, MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MStatus addAttribute (const MObject &attr)
 Add a new dynamic attibute to this node. More...
 
MStatus removeAttribute (const MObject &attr)
 Remove a dynamic attribute from a node. More...
 
MPxNodeuserNode (MStatus *ReturnStatus=NULL) const
 If the function set's node is a plug-in node, then this method will extract the MPxNode pointer from it. More...
 
bool isFromReferencedFile (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node came from a referenced file. More...
 
bool isShared (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is shared. More...
 
bool isTrackingEdits (MStatus *ReturnStatus=NULL) const
 Returns whether or not edits on the given node are being tracked by the generalized edit system. More...
 
bool hasUniqueName (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node's name is unique within the scene. More...
 
MString parentNamespace (MStatus *ReturnStatus=NULL) const
 Returns the name of the namespace in which this node resides. More...
 
bool isLocked (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is locked. More...
 
MStatus setLocked (bool locked)
 Locks or unlocks this node. More...
 
bool isNewAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Indicates whether or not the specified attribute was added to this node within the current scene. More...
 
MStatus setFlag (unsigned int flag, bool state)
 Sets the state of the specified flag for the node. More...
 
bool isFlagSet (unsigned int flag, MStatus *ReturnStatus=NULL) const
 Retrieves the current state of the specified flag for a node. More...
 
bool isDefaultNode (MStatus *ReturnStatus=NULL) const
 Returns true if the node is a default node. More...
 
MStatus setDoNotWrite (bool flag)
 Use this method to mark the "do not write" state of this node. More...
 
bool canBeWritten (MStatus *ReturnStatus=NULL) const
 Returns the do not write state of the node. More...
 
bool hasAttribute (const MString &name, MStatus *ReturnStatus=NULL) const
 Returns true if the node already has an attribute with the given name. More...
 
MObject getAliasAttr (bool force, MStatus *ReturnStatus=NULL)
 Returns the node's alias attribute, which is a special attribute used to store information about the node's attribute aliases. More...
 
bool setAlias (const MString &alias, const MString &name, const MPlug &plug, bool add=true, MStatus *ReturnStatus=NULL)
 Sets or removes an alias (i.e. More...
 
bool findAlias (const MString &alias, MObject &attrObj, MStatus *ReturnStatus=NULL) const
 Retrieves the attribute with the given alias. More...
 
bool getAliasList (MStringArray &strArray, MStatus *ReturnStatus=NULL)
 Returns a list of all attribute aliases for this node. More...
 
MString plugsAlias (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Returns the alias for the plug's attribute or the empty string if that attribute has no alias. More...
 
MStatus setIcon (const MString &filename)
 Associates a custom icon with the node for display in the Maya UI. More...
 
MString icon (MStatus *ReturnStatus=NULL) const
 Returns the custom icon filename associated with the node. More...
 
MStatus getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
MStatus addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
MStatus setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table)
 Sets content info in the specified attribute from the table. More...
 
MStatus setExternalContent (const MExternalContentLocationTable &table)
 Changes the location of external content. More...
 
MString setName (const MString &name, MStatus *ReturnStatus)
 OBSOLETE FUNCTION, NO SCRIPT SUPPORT. More...
 
 MFnDependencyNode (const MObject &object, MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT. More...
 
bool getPlugsAlias (const MPlug &plug, MString &aliasName, MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT. More...
 
virtual MStatus deleteMetadata ()
 This method is not available in Python. More...
 
MStatus dgTimerOn ()
 Indicates that this node should collect DG timing data whenever DG timing is enabled. More...
 
MStatus dgTimerOff ()
 Indicates that this node should no longer collect DG timing data when DG timing is enabled. More...
 
MdgTimerState dgTimerQueryState (MStatus *ReturnStatus=NULL)
 The function returns the current on/off state of the node's timer. More...
 
MStatus dgTimerReset ()
 The function resets the dependency graph timers and counters for this node to zero. More...
 
double dgTimer (const MdgTimerMetric timerMetric, const MdgTimerType timerType, MStatus *ReturnStatus=NULL) const
 The function returns the specified timer value for the current node. More...
 
MStatus dgCallbacks (const MdgTimerType type, MStringArray &callbackName, MDoubleArray &value)
 Node callbacks that occur when timing is enabled get logged with the node and can be queried via this method. More...
 
MStatus dgCallbackIds (const MdgTimerType type, const MString &callbackName, MCallbackIdArray &callbackId, MDoubleArray &value)
 This method provides a further breakdown of the per-callback time returned via dgCallbacks() by returning the data on a per-callbackId basis. More...
 
MStatus addAttribute (const MObject &attr, MAttrClass type)
 This method is obsolete. More...
 
MStatus removeAttribute (const MObject &attr, MAttrClass type)
 This method is obsolete. More...
 
- Public Member Functions inherited from MFnBase
virtual ~MFnBase ()
 Class Destructor. More...
 
bool hasObj (MFn::Type) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
bool hasObj (const MObject &) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
MObject object (MStatus *ReturnStatus=NULL) const
 Returns the MObject that is attached to the Function Set. More...
 

Static Public Member Functions

static MMeshIsectAccelParams uniformGridParams (int xDiv, int yDiv, int zDiv)
 Creates a MMeshIsectAccelParams configuration object that can be passed to several of the geometric query methods available on MFnMesh. More...
 
static MMeshIsectAccelParams autoUniformGridParams ()
 Creates a MMeshIsectAccelParams configuration object that can be passed to several of the geometric query methods on MFnMesh to speed up their operation. More...
 
static MString globalIntersectionAcceleratorsInfo ()
 Retrieves a string that describes the systemwide resource usage for cached mesh intersection accelerators. More...
 
static void clearGlobalIntersectionAcceleratorInfo ()
 As described above, clears the "total count", "total build time", and "peak memory" fields from the information string returned by globalIntersectionAcceleratorsInfo(). More...
 
static MString componentTypeName (MFn::Type compType, MStatus &status)
 Get a string representing a particular component type. More...
 
static MFn::Type componentTypeFromName (const MString &assocName)
 Get a component type from its string name. More...
 
static MStatus polyTriangulate (const float *pointsAndHoles, unsigned int pointsCount, unsigned int outerPointsCount, unsigned int holesCount, bool considerNormal, const float *normals, unsigned short *triangles, int &trianglesCount)
 Triangulates a polygon. More...
 
static MStatus polyTriangulate (const MFloatPointArray &points, const MIntArray &holes, unsigned int outerPointsCount, const MFloatVectorArray &normals, MIntArray &triangles)
 Triangulates a polygon. More...
 
- Static Public Member Functions inherited from MFnDependencyNode
static MString classification (const MString &nodeTypeName)
 Retrieves the classification string for a node type. More...
 
static unsigned int allocateFlag (const MString pluginName, MStatus *ReturnStatus=NULL)
 Allocates a node flag for sole use by the caller. More...
 
static MStatus deallocateFlag (const MString pluginName, unsigned int flag)
 Deallocates a node flag which was previously allocated by a call to allocateFlag. More...
 
static MStatus deallocateAllFlags (const MString pluginName)
 Deallocates all of the node flags which are currently allocated to the specified plugin. More...
 
static void enableDGTiming (bool enable)
 Globally enables or disables the DG node timing mechanism. More...
 
- Static Public Member Functions inherited from MFnBase
static const char * className ()
 Returns the name of this class. More...
 

Protected Member Functions

virtual const char * className () const
 Class name. More...
 

Member Enumeration Documentation

Specifies which color components are used by a colorSet.

Enumerator
kAlpha 

Alpha only.

kRGB 

Red, green and blue only.

kRGBA 

Red, green, blue and alpha.

Specifies how a point along split is to be determined.

Enumerator
kOnEdge 

Split at a position along an edge.

kInternalPoint 

Split at a point within a face.

kInvalid 

 

Boolean operators.

Enumerator
kUnion 

Boolean union.

kDifference 

Boolean difference.

kIntersection 

Boolean intersection.

Constructor & Destructor Documentation

~MFnMesh ( )
virtual

Destructor.

Class destructor.

MFnMesh ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
MFnMesh ( const MDagPath object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given constant MDagPath object.

Parameters
[in]objectThe const MDagPath to attach the function set to
[out]ReturnStatusThe return status
Status Codes:
MFnMesh ( const MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:

Member Function Documentation

MFn::Type type ( ) const
virtual

Function set type.

Return the class type : MFn::kMesh.

Reimplemented from MFnDagNode.

const char * className ( ) const
protectedvirtual

Class name.

Return the class name : "MFnMesh".

Reimplemented from MFnDagNode.

MObject create ( int  numVertices,
int  numPolygons,
const MFloatPointArray vertexArray,
const MIntArray polygonCounts,
const MIntArray polygonConnects,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface.

This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

Parameters
[in]numVerticesnumber of vertices
[in]numPolygonsnumber of polygons
[in]vertexArraypoint (vertex) array. This should include all the vertices in the mesh, and no extras. For example, a cube could have the vertices: { (-1,-1,-1), (1,-1,-1), (1,-1,1), (-1,-1,1), (-1,1,-1), (-1,1,1), (1,1,1), (1,1,-1) }
[in]polygonCountsarray of vertex counts for each polygon. For example the cube would have 6 faces, each of which had 4 verts, so the polygonCounts would be {4,4,4,4,4,4}.
[in]polygonConnectsarray of vertex connections for each polygon. For example, in the cube, we have 4 vertices for every face, so we list the vertices for face0, face1, etc consecutively in the array. These are specified by indexes in the vertexArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 6, 5, 0, 3, 5, 4, 0, 4, 7, 1, 1, 7, 6, 2 }
[in]parentOrOwnerparent of the polygon that will be created
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:
+ Examples:
MObject create ( int  numVertices,
int  numPolygons,
const MPointArray vertexArray,
const MIntArray polygonCounts,
const MIntArray polygonConnects,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface.

This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

Parameters
[in]numVerticesnumber of vertices
[in]numPolygonsnumber of polygons
[in]vertexArraypoint (vertex) array. This should include all the vertices in the mesh, and no extras. For example, a cube could have the vertices: { (-1,-1,-1), (1,-1,-1), (1,-1,1), (-1,-1,1), (-1,1,-1), (-1,1,1), (1,1,1), (1,1,-1) }
[in]polygonCountsarray of vertex counts for each polygon. For example the cube would have 6 faces, each of which had 4 verts, so the polygonCounts would be {4,4,4,4,4,4}.
[in]polygonConnectsarray of vertex connections for each polygon. For example, in the cube, we have 4 vertices for every face, so we list the vertices for face0, face1, etc consecutively in the array. These are specified by indexes in the vertexArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 6, 5, 0, 3, 5, 4,0, 4, 7, 1, 1, 7, 6, 2 }
[in]parentOrOwnerparent of the polygon that will be created
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:
MObject create ( int  numVertices,
int  numPolygons,
const MPointArray vertexArray,
const MIntArray polygonCounts,
const MIntArray polygonConnects,
bool  storeDoubles,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface.

This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

Parameters
[in]numVerticesnumber of vertices
[in]numPolygonsnumber of polygons
[in]vertexArraypoint (vertex) array. This should include all the vertices in the mesh, and no extras. For example, a cube could have the vertices: { (-1,-1,-1), (1,-1,-1), (1,-1,1), (-1,-1,1), (-1,1,-1), (-1,1,1), (1,1,1), (1,1,-1) }
[in]polygonCountsarray of vertex counts for each polygon. For example the cube would have 6 faces, each of which had 4 verts, so the polygonCounts would be {4,4,4,4,4,4}.
[in]polygonConnectsarray of vertex connections for each polygon. For example, in the cube, we have 4 vertices for every face, so we list the vertices for face0, face1, etc consecutively in the array. These are specified by indexes in the vertexArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 6, 5, 0, 3, 5, 4,0, 4, 7, 1, 1, 7, 6, 2 }
[in]storeDoublesWhether to store the vertex data at double precision internally.
[in]parentOrOwnerparent of the polygon that will be created
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:
  • Array length does not match given item count
  • parentOrOwner was not valid
  • There was no model present to add the object to
MObject create ( int  numVertices,
int  numPolygons,
const MFloatPointArray vertexArray,
const MIntArray polygonCounts,
const MIntArray polygonConnects,
const MFloatArray uArray,
const MFloatArray vArray,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Creates a new polygonal mesh given an array of vertices, polygon connection information, UV information, and sets this function set to operate on the new surface.

This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

The uv arrays must be of equal size. After using this method to create the mesh and the UV values, you can call assignUVs to assign the corresponding UV ids to the geometry.

Parameters
[in]numVerticesnumber of vertices
[in]numPolygonsnumber of polygons
[in]vertexArraypoint (vertex) array. This should include all the vertices in the mesh, and no extras. For example, a cube could have the vertices: { (-1,-1,-1), (1,-1,-1), (1,-1,1), (-1,-1,1), (-1,1,-1), (-1,1,1), (1,1,1), (1,1,-1) }
[in]polygonCountsarray of vertex counts for each polygon. For example the cube would have 6 faces, each of which had 4 verts, so the polygonCounts would be {4,4,4,4,4,4}.
[in]polygonConnectsarray of vertex connections for each polygon. For example, in the cube, we have 4 vertices for every face, so we list the vertices for face0, face1, etc consecutively in the array. These are specified by indexes in the vertexArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 6, 5, 0, 3, 5, 4,0, 4, 7, 1, 1, 7, 6, 2 }
[in]uArrayThe array of u values to be set
[in]vArrayThe array of v values to be set
[in]parentOrOwnerparent of the polygon that will be created
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:
MObject create ( int  numVertices,
int  numPolygons,
const MPointArray vertexArray,
const MIntArray polygonCounts,
const MIntArray polygonConnects,
const MFloatArray uArray,
const MFloatArray vArray,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Creates a new polygonal mesh given an array of vertices, polygon connection information, UV information, and sets this function set to operate on the new surface.

This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

The uv arrays must be of equal size. After using this method to create the mesh and the UV values, you can call assignUVs to assign the corresponding UV ids to the geometry.

Parameters
[in]numVerticesnumber of vertices
[in]numPolygonsnumber of polygons
[in]vertexArraypoint (vertex) array. This should include all the vertices in the mesh, and no extras. For example, a cube could have the vertices: { (-1,-1,-1), (1,-1,-1), (1,-1,1), (-1,-1,1), (-1,1,-1), (-1,1,1), (1,1,1), (1,1,-1) }
[in]polygonCountsarray of vertex counts for each polygon. For example the cube would have 6 faces, each of which had 4 verts, so the polygonCounts would be {4,4,4,4,4,4}.
[in]polygonConnectsarray of vertex connections for each polygon. For example, in the cube, we have 4 vertices for every face, so we list the vertices for face0, face1, etc consecutively in the array. These are specified by indexes in the vertexArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 6, 5, 0, 3, 5, 4,0, 4, 7, 1, 1, 7, 6, 2 }
[in]uArrayThe array of u values to be set
[in]vArrayThe array of v values to be set
[in]parentOrOwnerparent of the polygon that will be created
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:
MObject generateSmoothMesh ( MObject  parentOrOwner = MObject::kNullObj,
MMeshSmoothOptions options = NULL,
MStatus ReturnStatus = NULL 
)

Creates a new polygonal mesh using either the Smooth Mesh Preview attributes of this mesh or a set of options specified in an MMeshSmoothOptions object.

Unlike the MFnMesh::create functions, this function does not set this function set to operate on the new surface.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

Parameters
[in]parentOrOwnerparent of the polygon that will be created
[in]optionsSet of options to use when generating the smoothed mesh
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:
MStatus getSmoothMeshDisplayOptions ( MMeshSmoothOptions options) const

Retrieve the current display smoothing options for the mesh.

Parameters
[out]optionsstorge for the options
Returns
Status code
Status Codes:
MStatus setSmoothMeshDisplayOptions ( const MMeshSmoothOptions options)

Sets the current display smoothing options for the mesh.

Parameters
[in]optionsOptions to set
Returns
Status code
Status Codes:
MObject addPolygon ( const MPointArray vertexArray,
bool  mergeVertices = true,
double  pointTolerance = kMFnMeshPointTolerance,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Adds a new polygon to this polygonal mesh.

If there is no current geometry then a new polygonal mesh is created and parentOrOwner is used to specify the owner of the new surface. If parentOrOwner is NULL or a DAG parent is specified, then a new transform will be created in the DAG and returned. If the parentOrOwner is kMeshData then the new surface will become its data and the geometry will be returned.

If we are adding to an existing polygonal mesh then parentOrOwner is ignored and the geometry is returned.

Parameters
[in]vertexArrayarray of ordered vertices that make up the polygon
[in]mergeVerticesIf true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
[in]pointTolerancespecifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
[in]parentOrOwnerthe DAG parent or kMeshData the new surface will belong to
[out]ReturnStatusstatus code
Returns
The transform if one is created, otherwise the geometry.
Status Codes:
MObject addPolygon ( const MPointArray vertexArray,
int &  faceIndex,
bool  mergeVertices = true,
double  pointTolerance = kMFnMeshPointTolerance,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Adds a new polygon to this polygonal mesh.

Return an index of the created polygon.

If there is no current geometry then a new polygonal mesh is created and parentOrOwner is used to specify the owner of the new surface. If parentOrOwner is NULL or a DAG parent is specified, then a new transform will be created in the DAG and returned. If the parentOrOwner is kMeshData then the new surface will become its data and the geometry will be returned.

If we are adding to an existing polygonal mesh then parentOrOwner is ignored and the geometry is returned.

Parameters
[in]vertexArrayArray of ordered vertices that make up the polygon.
[out]faceIndexIndex of the newly added polygon.
[in]mergeVerticesIf true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
[in]pointToleranceSpecifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
[in]parentOrOwnerThe DAG parent or kMeshData the new surface will belong to.
[out]ReturnStatusStatus code.
Returns
The transform if one is created, otherwise the geometry.
Status Codes:
MObject addPolygon ( const MPointArray vertexArray,
const MIntArray loopCounts,
int &  faceIndex,
bool  mergeVertices = true,
double  pointTolerance = kMFnMeshPointTolerance,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Adds a new polygon to this polygonal mesh.

Return an index of the created polygon.

This version of addPolygon() allows for the creation of faces with holes. The loopCounts argument is used for this. loopCounts is an array of vertex counts. The first entry gives the count of vertices that make up the exterior of the polygon (using that many entries in vertexArray). The following entries in loopCounts give the count of vertices that make up each hole, using the following entries in vertexArray.

Therefore the sum of the entries of loopCounts should equal the total length of vertexArray.

If loopCounts is an empty array, it is treated as if it had one entry equal to the length of vertexArray i.e. the face has no holes.

Note that holes should normally be specified with the opposite winding order to the exterior polygon.

If there is no current geometry then a new polygonal mesh is created and parentOrOwner is used to specify the owner of the new surface. If parentOrOwner is NULL or a DAG parent is specified, then a new transform will be created in the DAG and returned. If the parentOrOwner is kMeshData then the new surface will become its data and the geometry will be returned.

If we are adding to an existing polygonal mesh then parentOrOwner is ignored and the geometry is returned.

Parameters
[in]vertexArrayArray of ordered vertices that make up the polygon.
[in]loopCountsArray of vertex loop counts.
[out]faceIndexIndex of the newly added polygon.
[in]mergeVerticesIf true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
[in]pointToleranceSpecifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
[in]parentOrOwnerThe DAG parent or kMeshData the new surface will belong to.
[out]ReturnStatusStatus code.
Returns
The transform if one is created, otherwise the geometry.
Status Codes:
MStatus addHoles ( int  faceIndex,
const MPointArray vertexArray,
const MIntArray loopCounts,
bool  mergeVertices = true,
double  pointTolerance = kMFnMeshPointTolerance 
)

Adds holes to a mesh polygon.

loopCounts is an array of vertex counts. The first entry gives the count of vertices that make up the first hole to add to the polygon (using that many entries in vertexArray). The following entries in loopCounts give the count of vertices that make up each remaining hole, using the following entries in vertexArray.

Therefore the sum of the entries of loopCounts should equal the total length of vertexArray.

Note that holes should normally be specified with the opposite winding order to the exterior polygon.

Parameters
[in]faceIndexIndex of the face to which to add holes.
[in]vertexArrayArray of ordered vertices that make up the polygon.
[in]loopCountsArray of vertex loop counts.
[in]mergeVerticesIf true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
[in]pointToleranceSpecifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
Returns
Status code.
Status Codes:
MStatus deleteFace ( int  faceId,
MDGModifier modifier = NULL 
)

Delete this face.

The method will return failure if an attempt is made to delete the last polygonal face in the object.

Parameters
[in]faceIdThe face to delete
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus deleteEdge ( int  edgeId,
MDGModifier modifier = NULL 
)

Delete this edge.

Parameters
[in]edgeIdThe edge to delete
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus deleteVertex ( int  vertexId,
MDGModifier modifier = NULL 
)

Delete this vertex.

Parameters
[in]vertexIdThe object-relative (mehs-relative/global) vertex index to delete
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus split ( MIntArray placements,
MIntArray edgeList,
MFloatArray edgeFactors,
MFloatPointArray internalPoints 
)

This function splits a set of edges and faces in a continuous manner.

The elements of the placements array must be elements of the SplitPlacement enumeration. For each SplitPlacement::kOnEdge element in the placements array, an equivalent edge ID and factor must be included in the edgeList and edgeFactors arrays. Similarly for SplitPlacement::kInternalPoint elements and the internalPoints array. The equivalent elements must be in the same order in all three arrays so that the first SplitPlacement::kOnEdge element in the placements array maps to the first elements in the edgeList and edgeFactors arrays. If one of the vertices cannot be created, the whole algorithm fails. The same edge cannot be split more than once.

The split must also start and end on an edge. This means that the first and last elements in the placements array must be SplitPlacement::kOnEdge values. If the placements array does not start and end on an edge then the code will still succeed but the mesh will not be split.

NOTE: the algorithm used by this method is the same as the polySplit command and has similar limitations.

Parameters
[in]placementsarray that contains elements of the SplitPlacement enumeration. They represent where to place the new vertices for the split.
[in]edgeListarray of edge IDs to be split, in order of their appearance in the split. There must be as many elements in this array as there are SplitPlacement::kOnEdge elements in the placements array.
[in]edgeFactorsarray of factors in the range [0,1] that represent how far along each edge must the split be done. This array must have the same number of elements as the edgeList array.
[in]internalPointsarray of positions for the vertices that will be added inside existing faces. There must be as many elements in this array as there are SplitPlacement::kInternalPoint elements in the placements array. This array can be empty. Internal points should be specified on the face between the previous edge id and the next edge id.
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One or more of the edge IDs are not on the mesh; one or more of the edge factors are not within the [0,1] range; the given placements list is empty; the array sizes are not appropriate; or the split algorithm could not be completed successfully
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
MStatus subdivideFaces ( MIntArray faceList,
int  divisionCount 
)

This function subdivides multiple faces.

This method only accepts faces that are three of four-sided. The operation adds a vertex in the middle of each given face and connects it to the middle of every edge in the given face. This results in three or four new faces for each original face.

Parameters
[in]faceListarray of face IDs to subdivide
[in]divisionCountnumber of subsequent subdivisions to do
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The given subdivision count is less than 1; the given faceIDs are not on the mesh; the given face list is empty; or the given information cannot produce a valid subdivision of the faces
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
MStatus subdivideEdges ( MIntArray edgeList,
int  divisionCount 
)

This function subdivides edges at regular intervals.

The divisionCount argument is the number of subdivisions per edges and represents the number of new vertices created on each edge.

For example, a divisionCount of 2 will add a new vertex on every edge in the edgeList 33% along the edges and a new vertex at 67% along the edges.

Parameters
[in]edgeListarray of edge component IDs to be subdivided
[in]divisionCountnumber of subsequent subdivisions to do
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The given edge IDs are not on the mesh; the given subdivision count is less than 1; the given edge list is empty; or the subdivision could not be completed successfully
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
MStatus extrudeFaces ( MIntArray faceList,
int  extrusionCount,
MFloatVector translation,
bool  extrudeTogether,
float  thickness = 0.0f,
float  offset = 0.0f 
)

This function extrudes a set of faces.

The resulting mesh will have extra parallelograms coming out of the edges of the given polygons going to the new extruded edges. The extrusionCount argument is the number of subsequent extrusions per polygon and represents the number of faces that will be created for each edge of the polygons in the list.

The difference between using thickness or offset instead of providing a vector with the translation variable is that the translation will be applied to each vertex in the extrusion along its local direction. This can result in vertices being moved the same distance, but the angles between the original components are not maintained so the overall shape is not the same. Both the thickness and offset variables will attempt to move the components a distance that will maintain angles between edges at the border of the extrusion.

Parameters
[in]faceListarray of face component IDs to be extruded
[in]extrusionCountnumber of subsequent extrusions to do
[in]translationtranslation vector to apply to the extruded elements. This is a world-space translation. Use NULL if not required.
[in]extrudeTogethersets whether the components should be extruded individually or together, as if one complex component was being extruded.
[in]thicknessFaces are moved outwards this distance from their original position to give the object a consistent thickness.
[in]offsetFaces are moved this distance towards the inside of the face.
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The given face IDs are not on the mesh; the given extrusion count is less than 1; the given face list is empty; or the extrusion could not be completed successfully
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
MStatus extrudeEdges ( MIntArray edgeList,
int  extrusionCount,
MFloatVector translation,
bool  extrudeTogether,
float  thickness = 0.0f,
float  offset = 0.0f 
)

This function extrudes edges.

The resulting mesh will have extra parallelograms coming out of the given edges and going to the new extruded edges. The extrusionCount argument is the number of subsequent extrusions per edges and represents the number of polygons that will be created from each given edge to the extruded edges.

The difference between using thickness or offset instead of providing a vector with the translation variable is that the translation will be applied to each vertex in the extrusion along its local direction. This can result in vertices being moved the same distance, but the angles between the original components are not maintained so the overall shape is not the same. Both the thickness and offset variables will attempt to move the components a distance that will maintain angles between edges at the border of the extrusion.

Parameters
[in]edgeListarray of edge component IDs to be extruded
[in]extrusionCountnumber of subsequent extrusions to do
[in]translationtranslation vector to apply to the extruded elements. This is a world-space translation. Use NULL if not required.
[in]extrudeTogethersets whether the components should be extruded individually or together, as if one complex component was being extruded.
[in]thicknessEdges are moved this distance in the direction of the connected face normals. original position to give the object a consistent thickmess.
[in]offsetEdges are moved this distance in the opposite direction of the edge.
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The given edge IDs are not on the mesh; the given extrusion count is less than 1; the given edge list is empty; or the extrusion could not be completed successfully.
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
MStatus duplicateFaces ( MIntArray faceList,
MFloatVector translation 
)

This function duplicates a set of faces and detaches them from the rest of the mesh.

The resulting mesh will contain one more independant piece of geometry.

Parameters
[in]faceListarray of face component IDs to be duplicated
[in]translationtranslation vector to apply to the duplicated elements. This is a world-space translation. Use NULL if not required.
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The given face IDs are not on the mesh; the given face list is empty; or the duplication could not be completed successfully
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
MStatus extractFaces ( MIntArray faceList,
MFloatVector translation 
)

This function detaches a set of faces from the mesh so that the resulting mesh will contain one more independant piece of geometry and leaves a hole where the faces use to be.

Parameters
[in]faceListarray of face component IDs to be extracted
[in]translationtranslation vector to apply to the extracted elements. This is a world-space translation. Use NULL if not required.
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The given face IDs are not on the mesh; the given face list is empty; or the extraction could not be completed successfully
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
MStatus collapseFaces ( MIntArray faceList)

This function collapse faces into vertices.

Non-adjacent faces will be collapsed individually so that each pieces of adjacent faces turn into one vertex.

Parameters
[in]faceListarray of face component IDs to be collapsed
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The given face IDs are not on the mesh; the given face list is empty; or the collapse could not be completed successfully
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
MStatus collapseEdges ( MIntArray edgeList)

This function collapse edges into vertices.

The two vertices that create each given edge are replaced in turn by one vertex placed at the average of the two initial vertex.

Parameters
[in]edgeListarray of edge component IDs to be collapsed
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The given edge IDs are not on the mesh; the given edge list is empty; or the collapse could not be completed successfully.
  • MS::kFailure An object error has occurred; or the mesh shape has no geometry to work on
+ Examples:
int numVertices ( MStatus ReturnStatus = NULL) const

Returns the number of vertices in the vertex list for this mesh.

This number will be the same as the length of the vertex array returned with the getPoints method.

Parameters
[out]ReturnStatusStatus code
Returns
The number of vertices of the mesh
Status Codes:
+ Examples:
int numEdges ( MStatus ReturnStatus = NULL) const

Returns the number of edges for this mesh.

Parameters
[out]ReturnStatusStatus code
Returns
The number of edges for this mesh
Status Codes:
+ Examples:
int numPolygons ( MStatus ReturnStatus = NULL) const

Returns the number of polygons for this mesh.

Parameters
[out]ReturnStatusStatus code
Returns
The number of polygons for this mesh
Status Codes:
+ Examples:
int numFaceVertices ( MStatus ReturnStatus = NULL) const

Returns the number of face-vertices for this mesh.

Parameters
[out]ReturnStatusStatus code
Returns
The number of face-vertices for this mesh
Status Codes:
+ Examples:
int polygonVertexCount ( int  polygonId,
MStatus ReturnStatus = NULL 
) const

Returns the number of vertices for the specified polygon.

Parameters
[in]polygonIdThe polygon index
[out]ReturnStatusStatus code
Returns
The number of vertices for the specified polygon
Status Codes:
+ Examples:
int numUVs ( MStatus ReturnStatus = NULL) const

Returns the number of texture (uv) coordinates for this mesh.

The uv's are stored in a list which is referenced by polygons requiring textures on a per-polygon per-vertex basis. This method returns the number of elements in this list.

Parameters
[out]ReturnStatusStatus code
Returns
The number of texture coordinates
Status Codes:
+ Examples:
int numUVs ( const MString uvSet,
MStatus ReturnStatus = NULL 
) const

Returns the number of texture (uv) coordinates for this mesh.

The uv's are stored in a list which is referenced by polygons requiring textures on a per-polygon per-vertex basis. This method returns the number of elements in this list.

Parameters
[in]uvSetUV set to work with
[out]ReturnStatusStatus code
Returns
The number of texture coordinates
Status Codes:
int numColors ( MStatus ReturnStatus = NULL) const

Returns the number of (vertex) color for this mesh.

The color are stored in a list which is referenced by polygons requiring color on a per-polygon per-vertex basis. This method returns the number of elements in this list.

Parameters
[out]ReturnStatusStatus code
Returns
The number of colors
Status Codes:
int numColors ( const MString colorSet,
MStatus ReturnStatus = NULL 
) const

Returns the number of colors (vertex data) for this mesh.

The colors are stored in a list which is referenced by polygons requiring textures on a per-polygon per-vertex basis. This method returns the number of elements in this list.

Parameters
[in]colorSetColor set to work with
[out]ReturnStatusStatus code
Returns
The number of colors
Status Codes:
int numNormals ( MStatus ReturnStatus = NULL) const

Returns the number of per-polygon per-vertex normals for this mesh.

This number will correspond to the length of the normal array returned by getNormals( normalArray, space ).

This method is not threadsafe.

Parameters
[out]ReturnStatusStatus code
Returns
The number of per-polygon per-vertex normals
Status Codes:
bool hasColorChannels ( const MString colorSet,
MStatus ReturnStatus = NULL 
) const

This method returns if the color set has RGB components.

Parameters
[in]colorSetColor set to work with
[out]ReturnStatusStatus code
Returns
  • true The color set has RGB components
  • false The color set doesn't have RGB components
Status Codes:
bool hasAlphaChannels ( const MString colorSet,
MStatus ReturnStatus = NULL 
) const

This method returns true if the color set has Alpha component.

Parameters
[in]colorSetColor set to work with
[out]ReturnStatusStatus code
Returns
  • true The color set has Alpha component
  • false The color set doesn't have Alpha component
Status Codes:
MFnMesh::MColorRepresentation getColorRepresentation ( const MString colorSet,
MStatus ReturnStatus = NULL 
) const

This method returns the color representation (RGB/RGBA/A) of a color set.

Parameters
[in]colorSetColor set to work with
[out]ReturnStatusStatus code
Returns
  • kAlpha The color set contains only Alpha component
  • kRGB The color set contains only RGB components
  • kRGBA The color set contains RGBA components
Status Codes:
bool isColorClamped ( const MString colorSet,
MStatus ReturnStatus = NULL 
) const

This method returns if the color set has its R,G,B,and A components clamped in the range from 0 to 1.

Parameters
[in]colorSetColor set to work with
[out]ReturnStatusStatus code
Returns
  • true All components in the color set are clamped
  • false All components in the color set are not clamped
Status Codes:
MStatus setIsColorClamped ( const MString colorSet,
bool  clamped 
)

Set the color set to be clamped.

Parameters
[in]colorSetColor set to work with
[in]clampedIf the color set should be set clamped
Returns
Status Code
Status Codes:
MStatus getTriangles ( MIntArray triangleCounts,
MIntArray triangleVertices 
) const

Returns the number of triangles for every polygon face and the vertex Ids of each triangle vertex.

The triangleVertices array holds each vertex for each triangle in sequence, so it has three times as many elements as there are triangles. (i.e. three times the sum of the elements of the triangleCounts array)

This method is not threadsafe.

Parameters
[out]triangleCountsThe number of triangles for each polygon face
[out]triangleVerticesThe triangle vertex Ids for each triangle
Returns
MStatus getTriangleOffsets ( MIntArray triangleCounts,
MIntArray triangleIndices 
) const

Returns the number of triangles for every polygon face and the offset into the vertex indices array for each triangle vertex (see getVertices()).

The triangleVertices array holds each vertex for each triangle in sequence, so it has three times as many elements as there are triangles. (i.e. three times the sum of the elements of the triangleCounts array)

This method is not threadsafe.

Parameters
[out]triangleCountsThe number of triangles for each polygon face
[out]triangleIndicesThe index array for each triangle in face vertex space
Returns
+ Examples:
MStatus booleanOp ( BoolOperation  op,
MFnMesh mesh1,
MFnMesh mesh2 
)

This method is obsolete.

Deprecated:
This method uses Maya's legacy boolean algorithm. Use MFnMesh::booleanOps instead to choose between Maya's newer boolean algorithm and the legacy algorithm.

Computes the boolean between two meshes. The result is stored in the current MFnMesh instance. The current instance must point to a valid mesh, which can be empty. Such a mesh can result from using MFnMesh::create() for example.

The union operation adds the two meshes together. The difference operation subtracts the second mesh from the first. The intersection operation takes only the parts of the two mesh volumes which overlap.

The operation is performed in object space, so transformations applied by the DAG hierarchy are ignored. If you want transformations to be taken into account then you will have to first bake them onto the geometry, for example by using the makeIdentity command.

Parameters
[in]opOperation to perform (kUnion, kDifference or kIntersection)
[in]mesh1The first mesh in the boolean operation
[in]mesh2The second mesh in the boolean operation
Returns
Status Code
Status Codes:
MStatus booleanOps ( BoolOperation  op,
const MObjectArray meshes,
bool  useLegacy = false 
)

Computes the boolean between multiple meshes.

The result is stored in the current MFnMesh instance. The current instance must point to a valid mesh, which can be empty. Such a mesh can result from using MFnMesh::create() for example.

The union operation adds the meshes in the array together. The difference operation subtracts the proceeding meshes from the first mesh in the array. The intersection operation takes only the parts of the mesh volumes which overlap. The current MFnMesh instance is not used as input to the boolean operation.

The operation is performed in object space, so transformations applied by the DAG hierarchy are ignored. If you want transformations to be taken into account then you will have to first bake them onto the geometry, for example by using the makeIdentity command.

Parameters
[in]opOperation to perform (kUnion, kDifference or kIntersection)
[in]meshesThe meshes for the boolean operation
[in]useLegacyFlag to indicate if Maya's legacy boolean algorithm should be used. The legacy algorithm produces lower quality results, and should only be used when required to match boolean results from versions of Maya prior to 2015.
Returns
Status Code
Status Codes:
  • MS::kFailure Any of the meshes in the array are invalid, this mesh is invalid, meshes contains less than two elements, or the boolean operation failed.
  • MS::kSuccess Operation successful.
  • MS::kInvalidParameter meshes array contains too many or too few items for the boolean operation, an element in the mesh array was invalid, or a MFnMesh function set could not be attached to it.
MMeshIsectAccelParams uniformGridParams ( int  xDiv,
int  yDiv,
int  zDiv 
)
static

Creates a MMeshIsectAccelParams configuration object that can be passed to several of the geometric query methods available on MFnMesh.

For example, the MFnMesh closest point and intersection methods can optionally make use of this object to speed up their operation.

This object specifies the number of voxel cells to be used in the x, y, and z dimensions. The grid acceleration structure will be cached with the mesh, so that if the same MMeshIsectAccelParams configuration is used on the next call, the acceleration structure will not need to be rebuilt.

To see details of the acceleration structure, including build time and memory usage, refer to the cachedIntersectionAcceleratorInfo() method.

Parameters
[in]xDivNumber of voxels in the x direction
[in]yDivNumber of voxels in the y direction
[in]zDivNumber of voxels in the z direction
Returns
Intersection accelerator object.
MMeshIsectAccelParams autoUniformGridParams ( )
static

Creates a MMeshIsectAccelParams configuration object that can be passed to several of the geometric query methods on MFnMesh to speed up their operation.

For example, the MFnMesh closest point and intersection methods can optionally make use of this object.

This object specifies that a uniform voxel grid structure should be used by these routines, and that the system should automatically determine the number of voxel cells to use based on the density of triangles in the mesh. The grid acceleration structure will be cached with the mesh, so that if the same MMeshIsectAccelParams configuration is used on the next call, the acceleration structure will not need to be rebuilt.

To see details of the acceleration structure, including build time and memory usage, refer to the cachedIntersectionAcceleratorInfo() method.

Returns
Intersection accelerator object.
+ Examples:
bool closestIntersection ( const MFloatPoint raySource,
const MFloatVector rayDirection,
const MIntArray faceIds,
const MIntArray triIds,
bool  idsSorted,
MSpace::Space  space,
float  maxParam,
bool  testBothDirections,
MMeshIsectAccelParams accelParams,
MFloatPoint hitPoint,
float *  hitRayParam,
int *  hitFace,
int *  hitTriangle,
float *  hitBary1,
float *  hitBary2,
float  tolerance = 1e-6,
MStatus ReturnStatus = NULL 
)

Finds the closest intersection of a ray starting at raySource and travelling in rayDirection with the mesh.

If faceIds is non-NULL and triIds is NULL, then only the faces specified by faceIds will be considered for intersection. If both faceIds and triIds are non-NULL, then each pair of entries will be taken as a (face,triangle) pair to be considered for intersection, where triangles are numbered on each face starting from 0. Thus, the face-triangle pair (10,0) means the first triangle on face 10. If both faceIds and triIds are NULL, then all face-triangles in the mesh will be considered.

The maxParam and testBothDirections flags can be used to control the radius of the search around the raySource point.

If accelParams is NULL, the search proceeds by testing all applicable face-triangles looking for intersections. If an MMeshIsectAccelParams structure is passed in via this parameter, the mesh builds an intersection acceleration structure based on the description provided by the parameter object. This acceleration structure is used to speed up the intersection operation, sometimes by a factor of several hundred over the non-accelerated case. Once created, the acceleration structure is cached, and will be reused the next time this method (or anyIntersection() or allIntersections()) is called with an identically-configured MMeshIsectAccelParams object. If a different MMeshIsectAccelParams object is used, then the acceleration structure will be deleted and re-created according to the new settings. Once created, the acceleration structure will persist until either the object is destroyed (or rebuilt by a construction history operation), or if the freeCachedIntersectionAccelerator() method is called. The cachedIntersectionAcceleratorInfo() and globalIntersectionAcceleratorsInfo() methods provide useful information about the resource usage of individual acceleration structures, and of all such structures in the system.

If the ray hits the mesh, the details of the closest intersection point to the raySource will be returned via the hitPoint, hitRayParam, hitFace, hitTriangle, hitBary1, and hitBary2 parameters. These parameters completely describe where the hit occurred.

Parameters
[in]raySourceStarting point for the ray
[in]rayDirectionDirection of the ray
[in]faceIds(see above) if non-NULL, describes a subset of faces to consider for intersection.
[in]triIds(see above) if non-NULL, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-NULL, then faceIds must be non-NULL as well, otherwise an error will be generated.
[in]idsSortedshould be true if the faceIds or faceIds/triIds arrays are properly sorted into ascending order. For face-triangle pairs, the arrays must be sorted by ascending face ids, then by ascending triangle ids within each face. The routine sortIntersectionFaceTriIds() can be used to perform this task. It is not important to sort ids unless an acceleration structure is being used. When using an acceleration structure in conjunction with a limited set of faces or face-triangles, it is ESSENTIAL to sort the indices, otherwise performance will be severely degraded.
[in]spacespecifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
[in]maxParamspecifies the maximum radius within which hits will be considered. This radius is specified as a multiple of the length of the rayDirection vector, so any hits beyond raySource+maxParam*rayDirection will not be considered. This value must be positive.
[in]testBothDirectionsspecifies that hits in the negative rayDirection should also be considered. The maxParam value still applies to limit the search radius, which means that if testBothDirections is true, then only hits that lie between raySource-maxParam*rayDirection and raySource+maxParam*rayDirection will be considered.
[in,out]accelParamsoptional acceleration parameters.
[out]hitPointreceives the 3d coordinates of the closest intersection, in the space specified by the space parameter.
[out]hitRayParamif non-NULL, points to a value that will be filled in with the parametric distance along the ray to the hit point, if one was found. That is, hitPoint = raySource+(*hitRayParam)*rayDirection. If no hit was found, the referenced value will not be modified.
[out]hitFaceif non-NULL, points to a value that will be filled in with the face id of the hit point, if one was found. If no hit was found, the referenced value will not be modified.
[out]hitTriangleif non-NULL, points to a value that will be filled in with the 0-based index of the triangle that was hit within the face given by *hitFace. If no hit was found, the referenced value will not be modified,
[out]hitBary1if non-NULL, points to a value that will be filled in with the first barycentric coordinate of the hit point within the triangle defined by hitFace and *hitTriangle. If v1, v2, and v3 are the vertices of that triangle, then the barycentric coordinates are such that hitPoint = (*hitBary1)*v1 + (*hitBary2)*v2 + (1-*hitBary1-*hitBary2)*v3; If no hit was found, the referenced value will not be modified,
[out]hitBary2if non-NULL, points to a value that will be filled in with the second barycentric coordinate of the hit point within the triangle defined by hitFace and *hitTriangle. If no hit was found, the referenced value will not be modified,
[in]tolerancenumerical tolerance for the intersection operation. For numerical reasons, it is wise to allow the intersection routine to consider hits that lie a tiny bit outside mesh triangles. This parameter defines how close a ray has to be to hitting a triangle in order for a hit to register. Obviously, hits within the triangle are always considered, but we also consider hits that are up to a distance of tol*edgeLength away from the triangle, where "edgeLength" is the length of the edge of the triangle that is closest to the ray. This tolerance value is also used to collapse multiple nearly-identical hits that may arise due to numerical imprecision when a ray passes extremely close to a mesh vertex. Any two hits that are less than tol multiplied by the length of rayDirection apart will be considered the same hit, and treated interchangeably.
[out]ReturnStatusStatus code
Returns
  • true The given ray intersects the mesh, and the closest intersection of the ray with the mesh is given by the value returned in hitPoint.
  • false The given ray does not intersect this mesh
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter There was an error with the parameters passed to the method. Either MSpace::kWorld was specified for a mesh with no world-space transformation, or the mesh had no data, or triIds was non-NULL without a corresponding faceIds array.
  • MS::kFailure An object error has occurred.
bool anyIntersection ( const MFloatPoint raySource,
const MFloatVector rayDirection,
const MIntArray faceIds,
const MIntArray triIds,
bool  idsSorted,
MSpace::Space  space,
float  maxParam,
bool  testBothDirections,
MMeshIsectAccelParams accelParams,
MFloatPoint hitPoint,
float *  hitRayParam,
int *  hitFace,
int *  hitTriangle,
float *  hitBary1,
float *  hitBary2,
float  tolerance = 1e-6,
MStatus ReturnStatus = NULL 
)

Finds any intersection of a ray starting at raySource and travelling in rayDirection with the mesh.

If faceIds is non-NULL and triIds is NULL, then only the faces specified by faceIds will be considered for intersection. If both faceIds and triIds are non-NULL, then each pair of entries will be taken as a (face,triangle) pair to be considered for intersection, where triangles are numbered on each face starting from 0. Thus, the face-triangle pair (10,0) means the first triangle on face 10. If both faceIds and triIds are NULL, then all face-triangles in the mesh will be considered.

The maxParam and testBothDirections flags can be used to control the radius of the search around the raySource point.

If accelParams is NULL, the search proceeds by testing all applicable face-triangles looking for intersections. If an MMeshIsectAccelParams structure is passed in via this parameter, the mesh builds an intersection acceleration structure based on the description provided by the parameter object. This acceleration structure is used to speed up the intersection operation, sometimes by a factor of several hundred over the non-accelerated case. Once created, the acceleration structure is cached, and will be reused the next time this method (or closestIntersection() or allIntersections()) is called with an identically-configured MMeshIsectAccelParams object. If a different MMeshIsectAccelParams object is used, then the acceleration structure will be deleted and re-created according to the new settings. Once created, the acceleration structure will persist until either the object is destroyed (or rebuilt by a construction history operation), or if the freeCachedIntersectionAccelerator() method is called. The cachedIntersectionAcceleratorInfo() and globalIntersectionAcceleratorsInfo() methods provide useful information about the resource usage of individual acceleration structures, and of all such structures in the system.

If the ray hits the mesh, the details of the found intersection point to the raySource will be returned via the hitPoint, hitRayParam, hitFace, hitTriangle, hitBary1, and hitBary2 parameters. These parameters completely describe where the hit occurred.

Parameters
[in]raySourceStarting point for the ray
[in]rayDirectionDirection of the ray
[in]faceIds(see above) if non-NULL, describes a subset of faces to consider for intersection.
[in]triIds(see above) if non-NULL, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-NULL, then faceIds must be non-NULL as well, otherwise an error will be generated.
[in]idsSortedshould be true if the faceIds or faceIds/triIds arrays are properly sorted into ascending order. For face-triangle pairs, the arrays must be sorted by ascending face ids, then by ascending triangle ids within each face. The routine sortIntersectionFaceTriIds() can be used to perform this task. It is not important to sort ids unless an acceleration structure is being used. When using an acceleration structure in conjunction with a limited set of faces or face-triangles, it is ESSENTIAL to sort the indices, otherwise performance will be severely degraded.
[in]spacespecifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
[in]maxParamspecifies the maximum radius within which hits will be considered. This radius is specified as a multiple of the length of the rayDirection vector, so any hits beyond raySource+maxParam*rayDirection will not be considered. This value must be positive.
[in]testBothDirectionsspecifies that hits in the negative rayDirection should also be considered. The maxParam value still applies to limit the search radius, which means that if testBothDirections is true, then only hits that lie between raySource-maxParam*rayDirection and raySource+maxParam*rayDirection will be considered.
[in,out]accelParamsoptional acceleration parameters.
[out]hitPointreceives the 3d coordinates of the intersection, in the space specified by the space parameter.
[out]hitRayParamif non-NULL, points to a value that will be filled in with the parametric distance along the ray to the hit point, if one was found. That is, hitPoint = raySource+(*hitRayParam)*rayDirection. If no hit was found, the referenced value will not be modified.
[out]hitFaceif non-NULL, points to a value that will be filled in with the face id of the hit point, if one was found. If no hit was found, the referenced value will not be modified.
[out]hitTriangleif non-NULL, points to a value that will be filled in with the 0-based index of the triangle that was hit within the face given by *hitFace. If no hit was found, the referenced value will not be modified,
[out]hitBary1if non-NULL, points to a value that will be filled in with the first barycentric coordinate of the hit point within the triangle defined by hitFace and *hitTriangle. If v1, v2, and v3 are the vertices of that triangle, then the barycentric coordinates are such that hitPoint = (*hitBary1)*v1 + (*hitBary2)*v2 + (1-*hitBary1-*hitBary2)*v3; If no hit was found, the referenced value will not be modified,
[out]hitBary2if non-NULL, points to a value that will be filled in with the second barycentric coordinate of the hit point within the triangle defined by hitFace and *hitTriangle. If no hit was found, the referenced value will not be modified,
[in]tolerancenumerical tolerance for the intersection operation. For numerical reasons, it is wise to allow the intersection routine to consider hits that lie a tiny bit outside mesh triangles. This parameter defines how close a ray has to be to hitting a triangle in order for a hit to register. Obviously, hits within the triangle are always considered, but we also consider hits that are up to a distance of tol*edgeLength away from the triangle, where "edgeLength" is the length of the edge of the triangle that is closest to the ray. This tolerance value is also used to collapse multiple nearly-identical hits that may arise due to numerical imprecision when a ray passes extremely close to a mesh vertex. Any two hits that are less than tol multiplied by the length of rayDirection apart will be considered the same hit, and treated interchangeably.
[out]ReturnStatusStatus code
Returns
  • true The given ray intersects the mesh, and the found intersection of the ray with the mesh is given by the value returned in hitPoint.
  • false The given ray does not intersect this mesh
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter There was an error with the parameters passed to the method. Either MSpace::kWorld was specified for a mesh with no world-space transformation, or the mesh had no data, or triIds was non-NULL without a corresponding faceIds array.
  • MS::kFailure An object error has occurred.
+ Examples:
bool allIntersections ( const MFloatPoint raySource,
const MFloatVector rayDirection,
const MIntArray faceIds,
const MIntArray triIds,
bool  idsSorted,
MSpace::Space  space,
float  maxParam,
bool  testBothDirections,
MMeshIsectAccelParams accelParams,
bool  sortHits,
MFloatPointArray hitPoints,
MFloatArray hitRayParams,
MIntArray hitFaces,
MIntArray hitTriangles,
MFloatArray hitBary1s,
MFloatArray hitBary2s,
float  tolerance = 1e-6,
MStatus ReturnStatus = NULL 
)

Finds all intersections of a ray starting at raySource and travelling in rayDirection with the mesh.

If faceIds is non-NULL and triIds is NULL, then only the faces specified by faceIds will be considered for intersection. If both faceIds and triIds are non-NULL, then each pair of entries will be taken as a (face,triangle) pair to be considered for intersection, where triangles are numbered on each face starting from 0. Thus, the face-triangle pair (10,0) means the first triangle on face 10. If both faceIds and triIds are NULL, then all face-triangles in the mesh will be considered.

The maxParam and testBothDirections flags can be used to control the radius of the search around the raySource point.

If accelParams is NULL, the search proceeds by testing all applicable face-triangles looking for intersections. If an MMeshIsectAccelParams structure is passed in via this parameter, the mesh builds an intersection acceleration structure based on the description provided by the parameter object. This acceleration structure is used to speed up the intersection operation, sometimes by a factor of several hundred over the non-accelerated case. Once created, the acceleration structure is cached, and will be reused the next time this method (or anyIntersection() or allIntersections()) is called with an identically-configured MMeshIsectAccelParams object. If a different MMeshIsectAccelParams object is used, then the acceleration structure will be deleted and re-created according to the new settings. Once created, the acceleration structure will persist until either the object is destroyed (or rebuilt by a construction history operation), or if the freeCachedIntersectionAccelerator() method is called. The cachedIntersectionAcceleratorInfo() and globalIntersectionAcceleratorsInfo() methods provide useful information about the resource usage of individual acceleration structures, and of all such structures in the system.

If the ray hits the mesh, the details of the intersection points will be returned via the hitPoint, hitRayParam, hitFace, hitTriangle, hitBary1, and hitBary2 parameters. These parameters completely describe where the hit occurred.

Parameters
[in]raySourceStarting point for the ray
[in]rayDirectionDirection of the ray
[in]faceIds(see above) if non-NULL, describes a subset of faces to consider for intersection.
[in]triIds(see above) if non-NULL, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-NULL, then faceIds must be non-NULL as well, otherwise an error will be generated.
[in]idsSortedshould be true if the faceIds or faceIds/triIds arrays are properly sorted into ascending order. For face-triangle pairs, the arrays must be sorted by ascending face ids, then by ascending triangle ids within each face. The routine sortIntersectionFaceTriIds() can be used to perform this task. It is not important to sort ids unless an acceleration structure is being used. When using an acceleration structure in conjunction with a limited set of faces or face-triangles, it is ESSENTIAL to sort the indices, otherwise performance will be severely degraded.
[in]spacespecifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
[in]maxParamspecifies the maximum radius within which hits will be considered. This radius is specified as a multiple of the length of the rayDirection vector, so any hits beyond raySource+maxParam*rayDirection will not be considered. This value must be positive.
[in]testBothDirectionsspecifies that hits in the negative rayDirection should also be considered. The maxParam value still applies to limit the search radius, which means that if testBothDirections is true, then only hits that lie between raySource-maxParam*rayDirection and raySource+maxParam*rayDirection will be considered.
[in,out]accelParamsoptional acceleration parameters.
[in]sortHitsif true, then hits will be sorted in ascending ray-parametric order, so hits behind the raySource will be first (if testBothDirections is true), moving proceeding closer to the raySource, followed by hits in front of the raySource, proceeding by increasing distance from the raySource. If false, hits will be presented in no particular order in the return arrays.
[out]hitPointsan array that receives the 3d coordinates of the intersections, in the space specified by the space parameter.
[out]hitRayParamsif non-NULL, points to an array that will be filled in with the parametric distances along the ray to the hit points, if any were found. That is, for the i'th hit, hitPoints[i] = raySource+(*hitRayParams[i])*rayDirection. If no hit was found, the referenced values will not be modified.
[out]hitFacesif non-NULL, points to an array that will be filled in with the face ids of the hit points, if any were found. If no hits were found, the referenced values will not be modified.
[out]hitTrianglesif non-NULL, points to an array that will be filled in with the 0-based indices of the triangles that were hit within the faces given by *hitFaces. If no hits were found, the referenced values will not be modified,
[out]hitBary1sif non-NULL, points to an array that will be filled in with the first barycentric coordinates of the hit points within the triangles defined by hitFaces and *hitTriangles. For the i'th hit, If v1, v2, and v3 are the vertices of that triangle, then the barycentric coordinates are such that hitPoint[i] = (*hitBary1s)[i]*v1 + (*hitBary2s)[i]*v2 + (1-(*hitBary1s)[i]-(*hitBary2s)[i])*v3; If no hits were found, the referenced value will not be modified,
[out]hitBary2sif non-NULL, points to an array that will be filled in with the second barycentric coordinates of the hit points within the triangles defined by hitFaces and *hitTriangles. If no hits were found, the referenced values will not be modified,
[in]tolerancenumerical tolerance for the intersection operation. For numerical reasons, it is wise to allow the intersection routine to consider hits that lie a tiny bit outside mesh triangles. This parameter defines how close a ray has to be to hitting a triangle in order for a hit to register. Obviously, hits within the triangle are always considered, but we also consider hits that are up to a distance of tol*edgeLength away from the triangle, where "edgeLength" is the length of the edge of the triangle that is closest to the ray. This tolerance value is also used to collapse multiple nearly-identical hits that may arise due to numerical imprecision when a ray passes extremely close to a mesh vertex. Any two hits that are less than tol multiplied by the length of rayDirection apart will be considered the same hit, and treated interchangeably.
[out]ReturnStatusStatus code
Returns
  • true The given ray intersects the mesh, and the intersections of the ray with the mesh are given by the values returned in hitPoints.
  • false The given ray does not intersect this mesh
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter There was an error with the parameters passed to the method. Either MSpace::kWorld was specified for a mesh with no world-space transformation, or the mesh had no data, or triIds was non-NULL without a corresponding faceIds array.
  • MS::kFailure An object error has occurred.
+ Examples:
MStatus sortIntersectionFaceTriIds ( MIntArray faceIds,
MIntArray triIds 
)

Convenience routine for sorting faceIds or face/triangle ids before passing them into the closestIntersection(), allIntersections(), or anyIntersection() methods.

When using an acceleration structure with the intersection operation, it is essential that any faceId or faceId/triId arrays be sorted properly to ensure optimal performance.

Parameters
[in,out]faceIdsFace IDs to be sorted.
[in,out]triIdsTriangle IDs to be sorted.
Status Codes:
MStatus freeCachedIntersectionAccelerator ( )

If the mesh has a cached accelerator structure, then this routine forces it to be deleted.

Ordinarily, these structures are cached so that series of calls to the geometric query methods that make use of it can reuse the same structure. Once the client is finished with a series of method calls, however, they are responsible for freeing the acceleration structure, which is what this method does.

Status Codes:
MString cachedIntersectionAcceleratorInfo ( MStatus ReturnStatus = NULL)

Retrieves a string that describes the intersection acceleration structure for this object, if any.

The string is formatted similar to:

10x10x10 uniform grid, (build time 0.5s), (memory footprint 2000KB)

It describes the configuration of the cached intersection accelerator, as well as how long it took to build it, and how much memory it is currently occupying. If the mesh has no cached intersection accelerator, the empty string is returned.

Parameters
[out]ReturnStatusStatus code.
Status Codes:
Returns
The description string
MString globalIntersectionAcceleratorsInfo ( )
static

Retrieves a string that describes the systemwide resource usage for cached mesh intersection accelerators.

The string will be formatted similar to:

total 10 accelerators created (2 currently active - total current memory = 10000KB), total build time = 10.2s, peak memory = 14567.1KB

This means that:

  • a total of 10 acceleration structures have been created as instructed by calls to geometric query methods (e.g. closest point or intersection) with non-NULL accelParams values. These structures are destroyed and re-created when queries with differing acceleration parameters are made for the same mesh, so it is useful to see this value, which is the total count of how many have been created. In this case, 8 of the 10 created have been destroyed, either automatically or via calls to the freeCachedIntersectionAccelerator() method
  • the total memory footprint for the 2 accelerators currently in existence is 10,000KB
  • the total build time for all 10 structures that have been created is 10.2 seconds
  • the peak of total memory usage for all accelerators in the system was 14567.1KB

Calling clearGlobalIntersectionAcceleratorInfo() will clear the "total count", "total build time", and "peak memory" fields from this information. It will not cause information about currently existing accelerators to be lost.

Returns
The information string
void clearGlobalIntersectionAcceleratorInfo ( )
static

As described above, clears the "total count", "total build time", and "peak memory" fields from the information string returned by globalIntersectionAcceleratorsInfo().

It will not cause information about currently existing accelerators to be lost.

bool intersect ( const MPoint raySource,
const MVector rayDirection,
MPointArray points,
double  tolerance = kMFnMeshPointTolerance,
MSpace::Space  space = MSpace::kObject,
MIntArray polygonIds = NULL,
MStatus ReturnStatus = NULL 
) const

Determines whether the given ray intersects this polygon and if so, returns the points of intersection.

The points of intersection will be in order of closest point to the raySource.

If the polygonIds array is not NULL then it will contain the polygon id's that correspond to the points of intersection.

The tolerance parameter is the epsilon value that will be used in the point-in-polygon calculation.

This method is not threadsafe when invoked by multiple threads on the same object at the same time. It is threadsafe as long as each thread operates on a different mesh object.

Parameters
[in]raySourceStarting point for the ray
[in]rayDirectionDirection of the ray
[out]pointsStorage for any points of intersection
[in]toleranceTolerance used in intersection calculation
[in]spacespecifies the coordinate system for this operation
[out]polygonIdsStorage for the polygon id's that correspond to the points of intersection.
[out]ReturnStatusStatus code
Returns
  • true The given ray intersects this polygon
  • false The given ray does not intersect this polygon
Status Codes:
MStatus getClosestPointAndNormal ( const MPoint toThisPoint,
MPoint theClosestPoint,
MVector theNormal,
MSpace::Space  space = MSpace::kObject,
int *  closestPolygon = NULL,
MMeshIsectAccelParams accelParams = NULL 
) const

Returns the closest point on this surface to the given point.

This method also returns the surface normal at that point.

If world space is specified then the returned point and normal will be in world space. In this case The test point (toThisPoint) is assumed to be in world space.

This method is not threadsafe. For a threadsafe closest point implementation, use the MMeshIntersector class.

Parameters
[in]toThisPointPoint to be compared
[out]theClosestPointStorage for the closest point
[out]theNormalStorage for normal at the closest point
[in]spaceSpecifies the coordinate system for this operation
[out]closestPolygonStorage for the closest polygon id
[in]accelParamsoptional acceleration parameters
Returns
Status code
Status Codes:
MStatus getClosestPoint ( const MPoint toThisPoint,
MPoint theClosestPoint,
MSpace::Space  space = MSpace::kObject,
int *  closestPolygon = NULL,
MMeshIsectAccelParams accelParams = NULL 
) const

Returns the closest point on this surface to the given point.

If world space is specified then the returned point will be in world space. In this case The test point (toThisPoint) is assumed to be in world space.

This method is not threadsafe. For a threadsafe closest point implementation, use the MMeshIntersector class.

Parameters
[in]toThisPointPoint to be compared
[out]theClosestPointStorage for the closest point
[in]spaceSpecifies the coordinate system for this operation
[out]closestPolygonStorage for the closest polygon id
[in]accelParamsoptional acceleration parameters
Returns
Status code
Status Codes:
MStatus getClosestNormal ( const MPoint toThisPoint,
MVector theNormal,
MSpace::Space  space = MSpace::kObject,
int *  closestPolygon = NULL,
MMeshIsectAccelParams accelParams = NULL 
) const

Returns the closest point on this surface to the given point.

This method also returns the surface normal at that point.

If world space is specified then the returned normal will be in world space. In this case The test point (toThisPoint) is assumed to be in world space.

Parameters
[in]toThisPointPoint to be compared
[out]theNormalStorage for normal at the closest point
[in]spaceSpecifies the coordinate system for this operation
[out]closestPolygonStorage for the closest polygon id
[in]accelParamsoptional acceleration parameters
Returns
Status code
Status Codes:
+ Examples:
MStatus getClosestUVs ( const float2 &  toThisUVPoint,
MIntArray uvIds,
const MString uvSet = NULL 
) const

Returns the IDs of the UVs on this surface which are nearest in uv space to the given uv set and coordinate.

All these UVs locate at the same distance to the given coordinate.

Parameters
[in]toThisUVPointUV coordinate to be compared
[out]uvIdsThe list of the closest uvs ids
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
MStatus getConnectedShaders ( unsigned int  instanceNumber,
MObjectArray shaders,
MIntArray indices 
) const

Returns all the shaders (sets) connected to the specified instance of this mesh, as well as an array of polygon/shader assignments.

The indices array will hold, for each polygon in the mesh, an index into the shaders array. If a polygon does not have a shader assigned to it, the value of the index will be -1.

The shader objects can be derived from the sets returned.

Note: This method will only work with a MFnMesh function set which has been initialized with an MFn::kMesh.

See also getConnectedSetsAndMembers.

Parameters
[in]instanceNumberThe instance number of the mesh to query
[out]shadersStorage for set objects (shader objects)
[out]indicesStorage for indices matching faces to shaders. For each face, this array contains the index into the shaders array for the shader assigned to the face.
Returns
Status code
Status Codes:
MObject copy ( const MObject source,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method creates a copy of a given source mesh.

After the copy this function set will operate on the new mesh.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

Parameters
[in]sourcethe mesh to be copied
[in]parentOrOwnerthe DAG parent or kMeshData the new mesh will belong to
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:
+ Examples:
MStatus updateSurface ( )

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

Returns
Status code
Status Codes:
MStatus syncObject ( )

If a non-api operation happens that many have changed the underlying Maya object wrapped by this api object, make sure that the api object references a valid maya object.

In particular this call should be used if you are calling mel commands from your plugin. Note that this only applies for mesh shapes: in a plugin node where the dataMesh is being accessed directly this is not necessary.

Returns
Status code
Status Codes:
+ Examples:
const float * getRawPoints ( MStatus ReturnStatus) const

This method returns a pointer to the internal vertex list for this mesh.

The points are in local space.

The points are stored in a single contiguous array of floats, first by coordinate, then by element (xyzxyz...) There are three coordinate values, so each vertex is stored in 12 bytes of data, and the total array length is 12*numVertices() bytes.

This method is useful where performance is critical or memory resources are limited, as it avoids having to make a copy of the points as is done by getVertices. Care must be taken however as the returned pointer may become invalid if any changes are made to the mesh.

Returns
Pointer to internal vertex list data structure
Status Codes:
const double * getRawDoublePoints ( MStatus ReturnStatus) const

This method returns a pointer to the internal vertex list for this mesh.

The points are in local space.

The points are stored in a single contiguous array of doubles, first by coordinate, then by element (xyzxyz...) There are three coordinate values, so each vertex is stored in 24 bytes of data, and the total array length is 24*numVertices() bytes.

This method is useful where performance is critical or memory resources are limited, as it avoids having to make a copy of the points as is done by getVertices. Care must be taken however as the returned pointer may become invalid if any changes are made to the mesh.

Returns
Pointer to internal vertex list data structure
Status Codes:
const float * getRawNormals ( MStatus ReturnStatus) const

This method returns a pointer to the internal normal list for this mesh.

The normals are in local space and are the per-polygon per-vertex normals. To find the normal for a particular vertex-face, use getFaceNormalIds() or MItMeshPolygon::normalIndex to get the index into the array.

The normals are stored in a single contiguous array of floats, first by coordinate, then by element (xyzxyz...) There are three coordinate values, so each normal is stored in 12 bytes of data, and the total array length is 12*numNormals() bytes.

This method is useful where performance is critical or memory resources are limited, as it avoids having to make a copy of the normals as is done by getNormals. Care must be taken however as the returned pointer may become invalid if any changes are made to the mesh.

This method is not threadsafe.

Returns
Pointer to internal per-polygon per-vertex normal data structure
Status Codes:
MStatus getPoints ( MFloatPointArray vertexArray,
MSpace::Space  space = MSpace::kObject 
) const

This method copies the vertex list for this mesh into the given point array.

Parameters
[out]vertexArrayStorage for the vertex list
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
+ Examples:
MStatus getPoints ( MPointArray vertexArray,
MSpace::Space  space = MSpace::kObject 
) const

This method copies the vertex list for this mesh into the given point array.

Parameters
[out]vertexArrayStorage for the vertex list
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus setPoints ( MFloatPointArray vertexArray,
MSpace::Space  space = MSpace::kObject 
)

This method copies the points in the given point array to the vertices of this polygon.

To keep this method as fast as possible, no checking of the data is performed beyond ensuring that the total number of points passed in is correct. It is up to the caller to ensure that the points provide a valid mesh, for example by ensuring that there are no degenerate faces or non-manifold geometry.

Parameters
[out]vertexArrayStorage for the vertex list
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
+ Examples:
MStatus setPoints ( MPointArray vertexArray,
MSpace::Space  space = MSpace::kObject 
)

This method copies the points in the given point array to the vertices of this mesh.

To keep this method as fast as possible, no checking of the data is performed beyond ensuring that the total number of points passed in is correct. It is up to the caller to ensure that the points provide a valid mesh, for example by ensuring that there are no degenerate faces or non-manifold geometry.

Parameters
[in]vertexArrayStorage for the vertex list
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus getVertices ( MIntArray vertexCount,
MIntArray vertexList 
) const

This method retrieves the object-relative (mesh-relative/global) vertex indices for all polygons.

The indices refer to the elements in the array returned by the 'getPoints' method.

Parameters
[out]vertexCountVertex count per polygon
[out]vertexListStorage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned.
Returns
Status code
Status Codes:
MStatus getPolygonVertices ( int  polygonId,
MIntArray vertexList 
) const

This method retrieves the object-relative (mesh-relative/global) vertex indices for the specified polygon.

The indices refer to the elements in the array returned by the 'getPoints' method.

Parameters
[in]polygonIdThe polygon to examine
[out]vertexListStorage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned.
Returns
Status code
Status Codes:
+ Examples:
MStatus getPolygonTriangleVertices ( int  polygonId,
int  triangleId,
int  vertexList[3] 
) const

This method retrieves the object-relative (mesh-relative/global) vertex indices for the specified triangle in the specified polygon.

The indices refer to the elements in the array returned by the 'getPoints' method.

This method is not threadsafe.

Parameters
[in]polygonIdThe polygon to examine
[in]triangleIdThe triangle within the polygon to examine (numbered from zero)
[out]vertexListStorage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned.
Returns
Status code
Status Codes:
MStatus setPoint ( int  vertexId,
const MPoint pos,
MSpace::Space  space = MSpace::kObject 
)

Sets the position of specified vertex in the vertex list for this mesh.

Note that if you modify the position of a vertex for a shape, a tweak will be created. If you have a shape with no history, the first time that a tweak is created, the underlying pointers under the MFnMesh object may change. You will need to call syncObject() to make sure that the object is valid. Subsequent calls to setPoint() on the same object do not require a syncObject call.

Parameters
[in]vertexIdThe object-relative (mesh-relative/global) index of the vertex to be changed
[in]posThe new value for the vertex
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus getPoint ( int  vertexId,
MPoint pos,
MSpace::Space  space = MSpace::kObject 
) const

Get the position of the specified vertex in this mesh's vertex list.

Parameters
[in]vertexIdThe object-relative (mesh-relative/global) index of the vertex to retrieve
[out]posStorage for the vertex
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus getNormals ( MFloatVectorArray normals,
MSpace::Space  space = MSpace::kObject 
) const

This method copies the normal list for this mesh into the given array.

The normals are the per-polygon per-vertex normals. To find the normal for a particular vertex-face, use getFaceNormalIds() or MItMeshPolygon::normalIndex to get the index into the array.

This method is not threadsafe.

Parameters
[out]normalsStorage for the per-polygon per-vertex normal list
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus setNormals ( MFloatVectorArray normals,
MSpace::Space  space = MSpace::kObject 
)

Set the normal array (user normals)

Parameters
[in]normalsThe normal array to set
[in]spaceWorld space or Object space
Returns
Status code
Status Codes:
MStatus getFaceVertexNormal ( int  faceIndex,
int  vertexIndex,
MVector normal,
MSpace::Space  space = MSpace::kObject 
) const

Return a per-vertex-per-face normal for a given face (polygon) and given vertex.

This method is not threadsafe.

Parameters
[in]faceIndexIndex of the face of interest
[in]vertexIndexThe object-relative (mesh-relative/global) vertex index
[out]normalStorage for the per-polygon-per-vertex normal
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus getFaceVertexNormals ( int  faceIndex,
MFloatVectorArray normals,
MSpace::Space  space = MSpace::kObject 
) const

Return all per-vertex-per-face normals for a given face.

This method is not threadsafe.

Parameters
[in]faceIndexIndex of the face (polygon) for which to retrive the normals
[out]normalsStorage for the face normals
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus getNormalIds ( MIntArray normalCounts,
MIntArray normals 
) const

Return normal indices for all vertices for a all faces.

The normalIds can be used to index into an array returned by MFnMesh::getNormals();

This method is not threadsafe.

Parameters
[out]normalCountsNumber of normals for each face
[out]normalsStorage for the per-polygon normal ids
Returns
Status code
Status Codes:
MStatus getFaceNormalIds ( int  faceIndex,
MIntArray normals 
) const

Return normal indices for all vertices for a given face.

The normalIds can be used to index into an array returned by MFnMesh::getNormals();

This method is not threadsafe.

Parameters
[in]faceIndexIndex of face (polygon) of interest
[out]normalsStorage for the per-polygon normal ids
Returns
Status code
Status Codes:
MStatus setFaceVertexNormal ( MVector normalIn,
int  faceId,
int  vertexId,
MSpace::Space  space = MSpace::kObject,
MDGModifier modifier = NULL 
)

Set Normal for this face/vertex pair.

Parameters
[in]normalInThe normal to set
[in]faceIdThe face to set it for
[in]vertexIdThe object-relative (mesh-relative/global) vertex index to set it for
[in]spaceWorld space or Object space
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus setVertexNormal ( MVector normalIn,
int  vertexId,
MSpace::Space  space = MSpace::kObject,
MDGModifier modifier = NULL 
)

Set Shared Normal for this vertex.

Parameters
[in]normalInThe normal to set
[in]vertexIdThe object-relative (mesh-relative/global) vertex index to set it for
[in]spaceWorld space or Object space
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus setFaceVertexNormals ( MVectorArray normalsIn,
MIntArray faceList,
MIntArray vertexList,
MSpace::Space  space = MSpace::kObject 
)

Set Normals for the given face/vertex pairs.

Note that if there is a vertex-face mismatch anywhere in the list, this method will return an error, and not set any of the normals.

Parameters
[in]normalsInThe normals to set
[in]faceListThe faces to set them for
[in]vertexListThe object-relative (mesh-relative/global) vertex indices to set them for
[in]spaceWorld space or Object space
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid face or vertex id, one of the arrays had a different length from the others, or cannot do world space operation.
  • MS::kFailure An object error has occurred.
+ Examples:
MStatus setVertexNormals ( MVectorArray normalsIn,
MIntArray vertexList,
MSpace::Space  space = MSpace::kObject 
)

Set Shared Normals for these vertices.

The length of the normalsIn array should be same as the length of the vertexList array.

Parameters
[in]normalsInThe normals to set
[in]vertexListThe object-relative (mesh-relative/global) vertex indices to set them for
[in]spaceWorld space or Object space
Returns
Status code
Status Codes:
+ Examples:
MStatus getVertexNormal ( int  vertexId,
MVector normal,
MSpace::Space  space = MSpace::kObject 
) const

This method is obsolete.

Deprecated:
Use getVertexNormal(int, bool, MVector&, MSpace::Space) instead.

Return the normal at the given vertex. The returned normal is a single per-vertex normal, so unshared normals at a vertex will be averaged. See the class description for more information on normals.

This method is not threadsafe.

Parameters
[in]vertexIdThe object-relative (mesh-relative/global) vertex index to get the normal for
[out]normalStorage for the per-vertex normal
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
+ Examples:
MStatus getVertexNormal ( int  vertexId,
bool  angleWeighted,
MVector normal,
MSpace::Space  space = MSpace::kObject 
) const

Return the normal at the given vertex.

The returned normal is a single per-vertex normal, so unshared normals at a vertex will be averaged. See the class description for more information on normals.

If angleWeighted is set to true, the normals are computed by an average of surrounding face normals weighted by the angle subtended by the face at the vertex. If angleWeighted is set to false, a simple average of surround face normals is returned.

The simple average evaluation is significantly faster than the angle-weighted average.

This method is not threadsafe.

Parameters
[in]vertexIdThe object-relative (mesh-relative/global) vertex index to get the normal for
[in]angleWeightedDefines algorithm used to compute normal
[out]normalStorage for the per-vertex normal
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus getVertexNormals ( bool  angleWeighted,
MFloatVectorArray normals,
MSpace::Space  space = MSpace::kObject 
) const

Return all vertex normals.

The returned normals are per-vertex normals, so unshared normals at a vertex will be averaged. See the class description for more information on normals.

If angleWeighted is set to true, the normals are computed by an average of surrounding face normals weighted by the angle subtended by the face at the vertex. If angleWeighted is set to false, a simple average of surround face normals is returned.

The simple average evaluation is significantly faster than the angle-weighted average.

This method is not threadsafe.

Parameters
[in]angleWeightedDefines algorithm used to compute normal
[out]normalsStorage for the per-vertex normals
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
MStatus getPolygonNormal ( int  polygonId,
MVector normal,
MSpace::Space  space = MSpace::kObject 
) const

Return the normal at the given polygon.

The returned normal is a per-polygon normal. See the class description for more information on normals.

This method is not threadsafe.

Parameters
[in]polygonIdThe polygon (face) to get the normal for
[out]normalStorage for the per-polygon normal
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
bool isNormalLocked ( int  normalId,
MStatus ReturnStatus = NULL 
) const

Test if the normal for a face/vertex pairs is locked (user defined).

Parameters
[in]normalIdNormal to test.
[out]ReturnStatusStatus code.
Returns
true if the normal is locked. false if not locked.
Status Codes:
MStatus lockVertexNormals ( MIntArray vertexList)

Lock Shared Normals for these vertices.

Parameters
[in]vertexListThe object-relative (global) verticex ides to lock normals for
Returns
Status code
Status Codes:
MStatus lockFaceVertexNormals ( MIntArray faceList,
MIntArray vertexList 
)

Lock Normals for these face/vertex pairs.

Parameters
[in]faceListThe faces to lock normal in
[in]vertexListThe corresponding object-relative (global) vertex indices to lock them for
Returns
Status code
Status Codes:
MStatus unlockVertexNormals ( MIntArray vertexList)

Unlock Shared Normals for these vertices.

Parameters
[in]vertexListThe vertices to unlock normals for
Returns
Status code
Status Codes:
MStatus unlockFaceVertexNormals ( MIntArray faceList,
MIntArray vertexList 
)

Unlock Normals for these face/vertex pairs.

Parameters
[in]faceListThe faces to unlock normal in
[in]vertexListThe corresponding object-relative (global) vertex indices to unlock them for
Returns
Status code
Status Codes:
int getTangentId ( int  faceIndex,
int  vertexIndex,
MStatus ReturnStatus = NULL 
) const

Return the tangent index for a given face vertex.

Parameters
[in]faceIndexIndex of the face of interest.
[in]vertexIndexThe object-relative (mesh-relative/global) vertex index.
[out]ReturnStatusStatus code
Status Codes:
MStatus getTangents ( MFloatVectorArray tangents,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL 
) const

Return the tangent vectors for all face vertices.

The tangent is defined as the surface tangent of the polygon running in the U direction defined by the uv map.

This method is not threadsafe.

Parameters
[out]tangentsStorage for the tangents.
[in]spaceSpecifies the coordinate system for this operation.
[in]uvSetThe uv map set to calculate the tangents against.
Returns
Status code
Status Codes:
MStatus getFaceVertexTangent ( int  faceIndex,
int  vertexIndex,
MVector tangent,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL 
) const

Return the normalized tangent vector at a given face vertex.

This method is not threadsafe.

Parameters
[in]faceIndexIndex of the face of interest.
[in]vertexIndexThe object-relative (mesh-relative/global) vertex index.
[out]tangentStorage for the tangent.
[in]spaceSpecifies the coordinate system for this operation.
[in]uvSetThe uv map set to calculate the binormals aginst.
Returns
Status code
Status Codes:
MStatus getFaceVertexTangents ( int  faceIndex,
MFloatVectorArray tangents,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL 
) const

Return all per-vertex-per-face tangents for a given face.

This method is not threadsafe.

Parameters
[in]faceIndexIndex of the face (polygon) for which to retrive the tangents
[out]tangentsStorage for the face tangents
[in]spaceSpecifies the coordinate system for this operation
[in]uvSetThe uv map set to calculate the tangents aginst.
Returns
Status code
Status Codes:
MStatus getBinormals ( MFloatVectorArray binormals,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL 
) const

Return the binormal vectors for all face vertices.

This method is not threadsafe.

Parameters
[out]binormalsStorage for the binormals.
[in]spaceSpecifies the coordinate system for this operation.
[in]uvSetThe uv map set to calculate the binormals aginst.
Returns
Status code
Status Codes:
MStatus getFaceVertexBinormal ( int  faceIndex,
int  vertexIndex,
MVector binormal,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL 
) const

Return the binormal vector at a given face vertex.

This method is not threadsafe.

Parameters
[in]faceIndexIndex of the face of interest
[in]vertexIndexThe object-relative (mesh-relative/global) vertex index
[out]binormalStorage for the binormal.
[in]spaceSpecifies the coordinate system for this operation.
[in]uvSetThe uv map set to calculate the binormals aginst.
Returns
Status code
Status Codes:
MStatus getFaceVertexBinormals ( int  faceIndex,
MFloatVectorArray binormals,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL 
) const

Return all per-vertex-per-face binormals for a given face.

This method is not threadsafe.

Parameters
[in]faceIndexIndex of the face (polygon) for which to retrive the binormals
[out]binormalsStorage for the face binormals
[in]spaceSpecifies the coordinate system for this operation
[in]uvSetThe uv map set to calculate the binormals aginst.
Returns
Status code
Status Codes:
bool isRightHandedTangent ( int  tangentId,
const MString uvSetName = NULL,
MStatus ReturnStatus = NULL 
) const

Returns true if the normal, tangent and binormal form a right handed coordinate system.

By default, Maya uses a right-handed system. Mirrored geometry can introduce a left-handed system.

Parameters
[in]tangentIdtangent index for a given face vertex
[in]uvSetNameName of uv set to use
[out]ReturnStatusStatus code
Returns
  • true normal, tangent, and binormal are right handed
  • false normal, tangent, and binormal are left handed
Status Codes:
bool isPolygonConvex ( int  faceIndex,
MStatus ReturnStatus = NULL 
) const

This method determines if the specified polygon is convex.

Parameters
[in]faceIndexThe polygon to be tested
[out]ReturnStatusStatus code
Returns
  • true The polygon is convex
  • false The edge is concave
Status Codes:
MStatus getEdgeVertices ( int  edgeId,
int2 &  vertexList 
) const

This method retrieves the object-relative (mesh-relative/global) vertex indices corresponding to the specified edge.

The indices can be used to refer to the elements in the array returned by the 'getPoints' method.

Parameters
[in]edgeIdThe edge to get the vertices for
[out]vertexListStorage for the 2 object-relative vertex indices
Returns
Status code
Status Codes:
+ Examples:
bool isEdgeSmooth ( int  edgeId,
MStatus ReturnStatus = NULL 
) const

This method determines if the specified edge is smooth (soft).

Parameters
[in]edgeIdThe edge to be tested
[out]ReturnStatusStatus code
Returns
  • true The edge is smooth (soft)
  • false The edge is hard
Status Codes:
MStatus setEdgeSmoothing ( int  edgeId,
bool  smooth = true 
)

This method sets the specified edge to be hard or smooth (soft).

You must use the cleanupEdgeSmoothing method after all the desired edges on your mesh have had setEdgeSmoothing done. Use the updateSurface method to indicate the mesh needs to be redrawn.

Parameters
[in]edgeIdThe edge to set the smoothing information for
[in]smoothIf true the edge will be smooth (soft), otherwise the edge will be hard.
Returns
Status code
Status Codes:
MStatus setEdgeSmoothings ( const MIntArray edgeIds,
const MIntArray smooths 
)

This method sets the specified edges to be hard or smooth (soft).

You must use the cleanupEdgeSmoothing method after all the desired edges on your mesh have had setEdgeSmoothing done. Use the updateSurface method to indicate the mesh needs to be redrawn.

Parameters
[in]edgeIdsThe edges to set the smoothing information for
[in]smoothsIf true the edges will be smooth (soft), otherwise the edges will be hard.
Returns
Status code
Status Codes:
MStatus cleanupEdgeSmoothing ( )

This method updates the mesh after setEdgeSmoothing has been done.

This should be called only once, after all the desired edges have been had their soothing set. If you don't call this method, the normals may not be correct, and the object will look odd in shaded mode.

Returns
Status code
Status Codes:
MStatus getCreaseEdges ( MUintArray edgeIds,
MDoubleArray creaseData 
) const

This method returns the crease edges of the mesh, and also the crease data associated with those edges.

Please note that to make effective use of the creasing variable in software outside of Maya may require a license under patents owned by Pixar(R).

Parameters
[out]edgeIdsThe list of crease edges ids.
[out]creaseDataThe data related to the crease edges.
Returns
Status code
Status Codes:
MStatus setCreaseEdges ( const MUintArray edgeIds,
const MDoubleArray creaseData 
)

This method sets the specified edges of the mesh as crease edges.

Please note that to make effective use of the creasing variable in software outside of Maya may require a license under patents owned by Pixar(R).

Parameters
[in]edgeIdsThe list of crease edges ids.
[in]creaseDataThe data related to the crease edges.
Returns
Status code
Status Codes:
+ Examples:
MUintArray getInvisibleFaces ( MStatus ReturnStatus = NULL) const

This method returns the invisible faces of the mesh.

Invisible faces are like lightweight holes in that they are not rendered but do not require additional geometry the way that holes do. They have the advantage over holes that if the mesh is smoothed then their edges will be smoothed as well, while holes will retain their hard edges.

Invisible faces can be set using the setInvisibleFaces() method or the polyHole command.

Parameters
[out]ReturnStatusstatus code
Returns
The list of invisible face ids.
Status Codes:
MStatus setInvisibleFaces ( const MUintArray faceIds,
bool  makeVisible = false 
)

This method sets the specified faces of the mesh to be visible or invisible.

See the getInvisibleFaces() method for a description of invisible faces.

Parameters
[in]faceIdsThe list of face ids to be made visible/invisible.
[in]makeVisibleIf true the faces will be made visible. The default is false, which will make them invisible.
Returns
Status code
Status Codes:
+ Examples:
MStatus getCreaseVertices ( MUintArray vertexIds,
MDoubleArray creaseData 
) const

This method returns the crease vertices of the mesh, and also the crease data associated with those vertices.

Please note that to make effective use of the creasing variable in software outside of Maya may require a license under patents owned by Pixar(R).

Parameters
[out]vertexIdsThe list of crease vertices ids.
[out]creaseDataThe data related to the crease vertices.
Returns
Status code
Status Codes:
MStatus setCreaseVertices ( const MUintArray vertexIds,
const MDoubleArray creaseData 
)

This method sets the specified vertices of the mesh as crease vertices.

Please note that to make effective use of the creasing variable in software outside of Maya may require a license under patents owned by Pixar(R).

Parameters
[in]vertexIdsThe list of crease vertices ids.
[in]creaseDataThe data related to the crease vertices.
Returns
Status code
Status Codes:
+ Examples:
int numUVSets ( MStatus ReturnStatus = NULL) const

Returns the number of uv sets for an object.

Parameters
[out]ReturnStatusreturn status value
Returns
The number of uv sets for the object
Status Codes:
+ Examples:
MString createUVSetWithName ( const MString uvSetName,
MDGModifier modifier = NULL,
MStatus ReturnStatus = NULL,
const MUintArray instances = NULL 
)

Create a new empty uv set for this mesh.

If the name passed in is empty (zero length), or a uv set with the same name already exists, then a new unique name is generated and used as the new uvset's name.

In the case where the name is empty, the new name will be of the format "uvSet#" where # is a number that makes the name unique for this mesh.

In the case where a uvset already exists with the same name as the name passed in, then the new name will be of the format "userName#", where "userName" was the name specified, and # is a number appended on to "userName" to make the name unique for this mesh.

This operation will only work when the MFnMesh refers to a shape.

Parameters
[in]uvSetNameThe name of the uv set to add. If a new name needed to be generated then the new name will be returned by the function.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[out]ReturnStatusStatus code. See below.
[in]instancesThe instance number(s) for which the set should be added, or NULL if the uv-set should be shared by all instances.
Returns
The name used for the UV set. May be different then the given name if a new name needed to be generated.
Status Codes:
MString copyUVSetWithName ( const MString fromName,
const MString toName,
MDGModifier modifier = NULL,
MStatus ReturnStatus = NULL 
)

Copies a uv set from one to another for this mesh.

The source must exist. The following cases can occur:

1) If the destination name is the same as the source than no copy will be made. 2) If the destination name exists a copy will be made to the destination. 3) If the destination name does not exist, then a new uv set will be created with a unique name, and then the copy will be made. The name generated will be "destinationName>#", where "destinationName" is the original name sent in, and "#" is a ascending number appended to the end of the original name.

This operation will only work when the MFnMesh refers to a shape.

Parameters
[in]fromNameThe name of the uv set to change
[in]toNameThe name to set the uv set to.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[out]ReturnStatusStatus Code. See below.
Returns
The name of the new UV set. May be different then the name passed in if a new name was generated.
Status Codes:
MStatus renameUVSet ( const MString origName,
const MString newName,
MDGModifier modifier = NULL 
)

Renames a uv set from one name to another for this mesh.

The original name must exist, and the new name cannot be the same name as one that already exists. In these cases the uv set will not be renamed.

This operation will only work when the MFnMesh refers to a shape.

Parameters
[in]origNameThe name of the uv set to change
[in]newNameThe name to set the uv set to.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus deleteUVSet ( const MString setName,
MDGModifier modifier = NULL,
MSelectionList currentSelection = NULL 
)

Deletes a named uv set from the object.

If a uv set with the given name cannot be found, then no uv set will be deleted.

This operation only works when the MFnMesh refers to a shape.

Parameters
[in]setNameName of the uv set to delete
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]currentSelectionSince this method may change the selection list, if you wish to undo its effects, you need to keep track of the current active selection. If this selection list is non-null, then the active selection list will be returned in this argument.
Returns
Status code
Status Codes:
MStatus setCurrentUVSetName ( const MString setName,
MDGModifier modifier = NULL,
MSelectionList currentSelection = NULL 
)

Set the "current" uv set for this object.

The "current" uv set is the uv set to use when no uv set name is specified for a uv set operation. If the uv set does not exist then the "current" uv set will not be changed.

This operation only works when the MFnMesh is a shape.

Parameters
[in]setNameName of uv set to make "current"
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]currentSelectionSince this method may change the selection list, if you wish to undo its effects, you need to keep track of the current active selection. If this selection list is non-null, then the active selection list will be returned in this argument.
Returns
Status code
Status Codes:
+ Examples:
MString currentUVSetName ( MStatus ReturnStatus = NULL,
int  instance = kMFnMeshInstanceUnspecified 
) const

Get the name of the "current" uv set.

The "current" uv set is the uv set which is used for uv operations when no uv set is explicitly specified.

On instanced meshes, uv sets may be applied on a per-instance basis or may be shared across all instances. When the uv sets are per-instance, the concept of the current uv set has two levels of granularity. Namely, the current uv set applies to one or more instances, plus there are other uv sets in the same uv set family that apply to different instances. The instance arguement is used to indicate that if this is a per-instance uv set, you are interested in the name of the uv set that applies to the specified instance. When the index is not specified, the current uv set will be returned regardless of which instance it is for.

If there is no current uv set, then a empty string will be returned on the string argument passed in.

Parameters
[out]ReturnStatusStatus code
[in]instanceInstance of the mesh whose set we are interested in, or kMFnMeshInstanceUnspecified for the set which is shared across all instances.
Returns
UV set name.
Status Codes:
+ Examples:
MStatus getUVSetNames ( MStringArray setNames) const

Get the names of all of the uv sets on this object.

Parameters
[out]setNamesArray of uv set names found
Returns
Status code
Status Codes:
+ Examples:
MStatus getUVSetFamilyNames ( MStringArray familyNames) const

Get the names of all of the uv set families on this object.

A uv set family is a set of per-instance sets with the same name with each individual set applying to one or more instances. A set which is shared across all instances will be the sole member of its family.

Given a uv set family name, the method getUVSetsInFamily may be used to determine the names of the associated individual sets.

Parameters
[out]familyNamesArray of uv set names found
Returns
Status code
Status Codes:
MStatus getUVSetsInFamily ( const MString familyName,
MStringArray setNames 
) const

Get the names of the uv sets that belong to this set family.

Per-instance sets will have multiple sets in a family, with each individual set applying to one or more instances. A set which is shared across all instances will be the sole member of its family and will share the same name as its family.

Parameters
[in]familyNameThe uv set family name
[out]setNamesArray of uv set names in the family
Returns
Status code
Status Codes:
bool isUVSetPerInstance ( const MString name,
MStatus ReturnStatus = NULL 
) const

Return true if this set is per-instance, and false if it is shared across all instances.

The name provided may be an individual set name or a set family name.

Parameters
[in]nameThe set name or set family name
[out]ReturnStatusStatus code
Returns
true if the set is per-instance
Status Codes:
MStatus getFaceUVSetNames ( int  polygonId,
MStringArray setNames 
) const

This method returns the list of UV sets mapped to a face.

This method is not threadsafe.

Parameters
[in]polygonIdThe polygon ID of the face of interest
[out]setNamesThe string array to return the UV sets names in
Returns
MStatus getAssociatedUVSetTextures ( const MString  uvSetName,
MObjectArray textures 
) const

Get a list of texture nodes which are using a given uv set.

If the texture has a 2d texture placement, the texture, and not the placement will be returned.

Parameters
[in]uvSetNameName of uv set to use
[out]texturesTexture nodes using the uv set
Returns
Status code
Status Codes:
MStatus getAssociatedUVSetInstances ( const MString uvSetName,
MIntArray instances 
) const

Get a list of the instance numbers associated with this uv map.

If the uv map is shared across all instances, an empty array will be returned.

Note, this method may only be used on an MFnMesh that is initialized using a mesh shape. It will return failure if used on an MFnMesh that has no associated shape.

Parameters
[in]uvSetNameName of uv set to use
[out]instancesInstances associated with this uv set
Returns
Status code
Status Codes:
MStatus setUVs ( const MFloatArray uArray,
const MFloatArray vArray,
const MString uvSet = NULL 
)

Sets all of the texture coordinates (uv's) for this mesh.

The uv arrays must be of equal size and must be at least as large as the current UV set size. You can determine the UV set size by calling numUVs() for the default UV set, or numUVs(uvSet) for a named UV set.

If the arrays are larger than the UV set size, then the uv list for this mesh will be grown to accommodate the new uv values.

After using this method to set the UV values, you must call one of the assignUV methods to assign the corresponding UV ids to the geometry.

In order to shrink the uvs array, do the following:

These steps will let you to create an array of uvs which is smaller than the original one.

Parameters
[in]uArrayThe array of u values to be set
[in]vArrayThe array of v values to be set
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus setSomeUVs ( const MIntArray uvIds,
const MFloatArray uArray,
const MFloatArray vArray,
const MString uvSet = NULL 
)

Sets the specified texture coordinates (UV's) for this mesh.

The uv arrays and uvId array must be of equal size. If the largest uvId in the array is larger than numUVs() then the uv list for this mesh will be grown to accommodate the new uv values. If a named uv set is given, the array will be grown when the largest uvId is larger than numUVs(uvSet).

If you have added new uvIds, you must call one of the assignUV methods to assign the uvIds to the geometry. If you are modifying existing UVs, you do not need to call one of the assignUV methods.

Parameters
[in]uvIdsThe array of uvIds to set values for
[in]uArrayThe array of u values to be set
[in]vArrayThe array of v values to be set
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
MStatus getUVs ( MFloatArray uArray,
MFloatArray vArray,
const MString uvSet = NULL 
) const

This method copies the texture coordinate list for this mesh into the given uv arrays.

Parameters
[out]uArrayStorage for the u texture coordinate list
[out]vArrayStorage for the v texture coordinate list
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus setUV ( int  uvId,
float  u,
float  v,
const MString uvSet = NULL 
)

Sets the specified texture coordinate.

The uvId is the element in the uv list that will be set. If the uvId is greater than or equal to numUVs() then the uv list will be grown to accommodate the specified uv. If a named uv set is given, the largest uvId must be larger than numUVs(uvSet).

If the UV being added is new, then you must call one of the assignUV methods in order to update the geometry.

Parameters
[in]uvIdThe element in the uv list to be set
[in]uThe new u value that is to be set
[in]vThe new v value that is to be set
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus getUV ( int  uvId,
float &  u,
float &  v,
const MString uvSet = NULL 
) const

Get the value of the specified texture coordinate from this mesh's uv list.

The uvId is the element in the uv list that will be retrieved.

Parameters
[in]uvIdThe element in the uv list to examine
[out]uStorage for the u value
[out]vStorage for the v value
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus getPointAtUV ( int  polygonId,
MPoint toThisPoint,
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.

This method is not threadsafe.

Parameters
[in]polygonIdSearch for uv on this face
[out]toThisPointSpace for the point
[in]uvPointThe UV value to try to locate
[in]spaceThe coordinate system to return "toThisPoint" in
[in]uvSetUV set to work with
[in]tolerancetolerance value to compare float data type
Returns
Status code
Status Codes:
MStatus getPointsAtUV ( MIntArray polygonIds,
MPointArray points,
const float2 &  uvPoint,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL,
float  tolerance = 0.0 
) const

Return the positions of the points at the given UV value on the mesh.

Parameters
[out]polygonIdsStorage for polygon ids to the return points.
[out]pointsStorage for the points on this surface to the given uv set and coordinate
[in]uvPointUV coordinate to be compared
[in]spaceThe coordinate system to return "points" in
[in]uvSetUV set to work with
[in]tolerancetolerance value to compare float data type
Returns
Status code
Status Codes:
MStatus getUVAtPoint ( MPoint pt,
float2 &  uvPoint,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL,
int *  closestPolygon = NULL 
)

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

This method is not threadsafe.

Parameters
[in]ptThe point to try to get UV for
[out]uvPointSpace for the UV value
[in]spaceThe coordinate system for this operation
[in]uvSetUV set to work with
[out]closestPolygonpolygon id of the closest polygon
Returns
Status code
Status Codes:
MStatus getAxisAtPoint ( MPoint pt,
MVector normal,
MVector uTangent,
MVector vTangent,
MSpace::Space  space = MSpace::kObject,
const MString uvSet = NULL,
int *  closestPolygon = NULL 
)

Find the point on the mesh which is closest to the given point, and return the axis at that point.

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.

This method is not threadsafe.

Parameters
[in]ptThe point to be queried
[out]normalSpace for the normal
[out]uTangentSpace for the U tangent
[out]vTangentSpace for the V tangent
[in]spaceThe coordinate system for this operation
[in]uvSetUV set to work with
[out]closestPolygonpolygon id of the closest polygon
Returns
Status code
Status Codes:
MStatus getPolygonUV ( int  polygonId,
int  vertexIndex,
float &  u,
float &  v,
const MString uvSet = NULL 
) const

Get the value of the specified texture coordinate for a vertex in a polygon.

Since texture coordinates (uv's) are stored per-polygon per-vertex you must specify both the polygon and the vertex that the u and v values are mapped to.

This method is not threadsafe.

Parameters
[in]polygonIdThe polygon (face) to examine
[in]vertexIndexThe face-relative (local) vertex id to examine
[out]uStorage for the u value
[out]vStorage for the v value
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
MStatus getPolygonUVid ( int  polygonId,
int  vertexIndex,
int &  uvId,
const MString uvSet = NULL 
) const

Get the id of the specified texture coordinate for a vertex in a polygon.

This method is not threadsafe.

Parameters
[in]polygonIdThe polygon (face) to examine
[in]vertexIndexThe face-relative (local) vertex id to examine
[out]uvIdStorage for the uv index
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus assignUV ( int  polygonId,
int  vertexIndex,
int  uvId,
const MString uvSet = NULL 
)

Maps a texture coordinate to a specified vertex of a polygon.

Since texture coordinates (uv's) are stored per-polygon per-vertex you must specify both the polygon and the vertex that the uv entry is mapped to.

The vertexIndex (face-relative/local) is the vertex within the polygon that the uv will be mapped to. This index must be in the range 0 to polygonVertexCount(polygonId).

Parameters
[in]polygonIdThe polygon (face) to map to
[in]vertexIndexThe face-relative (local) vertex id of the polygon to map to
[in]uvIdThe uv entry from the uv list that will be mapped
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus assignUVs ( const MIntArray uvCounts,
const MIntArray uvIds,
const MString uvSet = NULL 
)

This method maps all texture coordinates for the mesh.

The setUV/setUVs method is used to create the texture coordinate table for the mesh. After the table is created, this method is used to map those values to each polygon on a per-vertex basis. The setUV/setUVs method should be called before the assignUVs method.

The uvCounts array should contain the number of uv's per polygon. Since uv's are mapped per-polygon per-vertex, the entries in this array should match the vertex counts for each polygon in the mesh. For example, the array for a cube would be { 4, 4, 4, 4, 4, 4 } since there are 6 polygons each with 4 vertices.

If an entry in this array is '0' then the corresponding polygon will not be mapped. The sum of all the entries in the uvCounts array must be equal to the size of the uvIds array or this method will fail.

The uvIds array should contain the UV indices that will be mapped to each polygon-vertex in the mesh. The entries in this array specify which uv's in the mesh's uv table are mapped to each polygon-vertex. Each entry in the uvIds array must be less than numUVs(), or numUVs(uvSet) for a named uvSet. The size of the uvIds array is equivalent to adding up all of the entries in the uvCounts array, so for a cube with all polygons mapped there would be 24 entries.

Parameters
[in]uvCountsThe uv counts for each polygon (face) in the mesh
[in]uvIdsThe uv indices to be mapped to each polygon-vertex
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus clearUVs ( const MString uvSet = NULL)

This method clears out all texture coordinates for the mesh, and leaves behind an empty UVset.

This method should be used if it is needed to shrink the actual size of the UV table. In this case, the user should call clearUVs, setUVs and then assignUVs to rebuild the mapping info.

When called on a dataMesh, the UVs are removed. When called on a shape with no history, the UVs are removed and the attributes are set on the shape. When called on a shape with history, the polyMapDel command is invoked and a polyMapDel node is created.

Parameters
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus getAssignedUVs ( MIntArray uvCounts,
MIntArray uvIds,
const MString uvSet = NULL 
) const

Get assigned UVs.

This method finds all texture coordinates for the mesh that have been mapped, and returns them in the same format as the assignUVs.

The uvCounts array that is returned will contain the number of uv's per polygon. Since uv's are mapped per-polygon per-vertex, the entries in this array will match the vertex counts for each polygon in the mesh. For example, the array for a cube would be { 4, 4, 4, 4, 4, 4 } since there are 6 polygons each with 4 vertices.

The uvIds array will contain the UV indices that are mapped to each polygon-vertex in the mesh. The entries in this array indicate which uv's in the mesh's uv table are mapped to each polygon-vertex. Each entry in the uvIds array will be less than numUVs(), or numUVs(uvSet) for a named uvSet. The size of the uvIds array is equivalent to adding up all of the entries in the uvCounts array, so for a cube with all polygons mapped there will be 24 entries.

This method is not threadsafe.

Parameters
[out]uvCountsThe container for the uv counts for each polygon in the mesh
[out]uvIdsThe container for the uv indices mapped to each polygon-vertex
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
MStatus getUvShellsIds ( MIntArray uvShellIds,
unsigned int &  nbUvShells,
const MString uvSet = NULL 
) const

Constructs an array of unique integer for each UV shell.

This method let the user identify each connected piece of UV.

The uvShellIds array that is returned will contain a UV shell number for each UV in the given UV set. This number uniquely identifies a connected piece in the UV set. Numbers are positive, starting at 0.

For example, the array { 0, 0, 0, 1, 1, 1, 1, 0} would represent an object where UVs 0, 1, 2 and 7 are connected together (UV shell number 0), and UVs 3 to 6 belong to shell number 1.

Parameters
[out]uvShellIdsThe container for the uv shell Ids
[out]nbUvShellsThe number of UV shells in this UV set.
[in]uvSetUV set to work with
Returns
Status code
Status Codes:
MStatus getPinUVs ( MUintArray uvIds,
MDoubleArray pinData,
const MString uvSet = NULL 
) const

This method returns the pin uvs of the mesh, and also the pin data associated with those uvs.

Parameters
[out]uvIdsThe list of pin uvs ids.
[out]pinDataThe list of pin weights.
[in]uvSetUV set to work with.
Returns
Status code
Status Codes:
MStatus setPinUVs ( const MUintArray uvIds,
const MDoubleArray pinData,
const MString uvSet = NULL 
)

This method sets the specified uvs of the mesh as "pinned" uvs, a "pinned" uv is one which should not be modified.

If pin weight is set to 1.0 then it becomes fully pinned and uv tools should not modify that uv. If the pin weight is set to a value between 0.0 and 1.0 then uv tools should weight their changes to that uv accordingly.

Parameters
[in]uvIdsThe list of pin uvs ids.
[in]pinDataThe list of pin weights.
[in]uvSetUV set to work with.
Returns
Status code
Status Codes:
bool isPolygonUVReversed ( int  polygonId,
const MString uvSet = NULL,
MStatus ReturnStatus = NULL 
) const

This method determines if the winding order of texture coordinates (uv's) for specified polygon are reversed (clockwise)

Parameters
[in]polygonIdThe polygon to be tested
[in]uvSetUV set to work with
[out]ReturnStatusStatus code
Returns
  • true The texture coordinates (uv's) are reversed (clockwise)
  • false The texture coordinates (uv's) are not reversed (counter clockwise)
Status Codes:
int numColorSets ( MStatus ReturnStatus = NULL) const

Returns the number of color sets for an object.

Parameters
[out]ReturnStatusreturn status value
Returns
The number of color sets for the object
Status Codes:
+ Examples:
MString createColorSetWithName ( const MString colorSetName,
MDGModifier modifier = NULL,
const MUintArray instances = NULL,
MStatus ReturnStatus = NULL 
)

Create a new empty color set for this mesh.

If the name passed in is empty (zero length), or a color set with the same name already exists, then a new unique name is generated and used as the new color set's name.

In the case where the name is empty, the new name will be of the format "colorSet#" where # is a number that makes the name unique for this mesh.

In the case where a color set already exists with the same name as the name passed in, then the new name will be of the format "userName#", where "userName" was the name specified, and # is a number appended on to "userName" to make the name unique for this mesh.

This operation will only work when the MFnMesh refers to a shape.

Parameters
[in]colorSetNameThe name of the color set to add.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]instancesThe instance number(s) for which the set should be added, or NULL if the uv-set should be shared by all instances.
[in]ReturnStatusStatus code. See below.
Returns
The resulting name of the color set.
Status Codes:
+ Examples:
MStatus deleteColorSet ( const MString colorSetName,
MDGModifier modifier = NULL,
MSelectionList currentSelection = NULL 
)

Deletes a named color set from the object.

If a color set with the given name cannot be found, then no color set will be deleted.

This operation only works when the MFnMesh refers to a shape.

Parameters
[in]colorSetNameName of the color set to delete
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]currentSelectionSince this method may change the selection list, if you wish to undo its effects, you need to keep track of the current active selection. If this selection list is non-null, then the active selection list will be returned in this argument.
Returns
Status code
Status Codes:
MStatus setCurrentColorSetName ( const MString setName,
MDGModifier modifier = NULL,
MSelectionList currentSelection = NULL 
)

Set the "current" or "working" color set for this object.

The "current" color set is the set to use by functions that do not have a specific color set defined.

This operation only works when the MFnMesh is a shape.

Parameters
[in]setNameName of color set to make "current"
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]currentSelectionSince this method may change the selection list, if you wish to undo its effects, you need to keep track of the current active selection. If this selection list is non-null, then the active selection list will be returned in this argument.
Returns
Status code
Status Codes:
+ Examples:
MString currentColorSetName ( int  instance = kMFnMeshInstanceUnspecified,
MStatus ReturnStatus = NULL 
) const

Get the name of the "current" or "working" color set.

The "current" color set is the color set which is used for color operations when no color set is explcitly specified.

If there is no current color set, then a empty string will be returned on the string argument passed on.

On instanced meshes, color sets may be applied on a per-instance basis or may be shared across all instances. When the color sets are per-instance, the concept of the current color set has two levels of granularity. Namely, the current color set applies to one or more instances, plus there are other color sets in the same color set family that apply to different instances. The instance arguement is used to indicate that if this is a per-instance color set, you are interested in the name of the color set that applies to the specified instance. When the index is not specified, the current color set will be returned regardless of which instance it is for.

Parameters
[in]instanceInstance of the mesh whose set we are interested in, or kMFnMeshInstanceUnspecified for the set which is shared across all instances.
[out]ReturnStatusStatus code. See below.
Returns
  • Name of the "current" color set, if any.
Status Codes:
MStatus getColorSetNames ( MStringArray setNames) const

Get the names of all of the colors sets on this object.

Parameters
[out]setNamesArray of color set names found
Returns
Status code
Status Codes:
+ Examples:
MStatus getColorSetFamilyNames ( MStringArray familyNames) const

Get the names of all of the color set families on this object.

A color set family is a set of per-instance sets with the same name with each individual set applying to one or more instances. A set which is shared across all instances will be the sole member of its family.

Given a color set family name, the method getColorSetsInFamily may be used to determine the names of the associated individual sets.

Parameters
[out]familyNamesArray of color set names found
Returns
Status code
Status Codes:
MStatus getColorSetsInFamily ( const MString familyName,
MStringArray setNames 
) const

Get the names of the color sets that belong to this set family.

Per-instance sets will have multiple sets in a family, with each individual set applying to one or more instances. A set which is shared across all instances will be the sole member of its family and will share the same name as its family.

Parameters
[out]familyNameThe color set family name
[out]setNamesArray of color set names in the family
Returns
Status code
Status Codes:
bool isColorSetPerInstance ( const MString name,
MStatus ReturnStatus = NULL 
) const

Return true if this color set is per-instance, and false if it is shared across all instances.

The name provided may be an individual set name or a set family name.

Parameters
[in]nameThe set name or set family name
[out]ReturnStatusStatus code
Returns
true if the set is per-instance
Status Codes:
MStatus getAssociatedColorSetInstances ( const MString colorSetName,
MIntArray instances 
) const

Get a list of the instance numbers associated with this color map.

If the color map is shared across all instances, an empty array will be returned.

Note, this method may only be used on an MFnMesh that is initialized using a mesh shape. It will return failure if used on an MFnMesh that has no associated shape.

Parameters
[in]colorSetNameName of color set to use
[out]instancesInstances associated with this color set
Returns
Status code
Status Codes:
MStatus setFaceColor ( MColor color,
int  faceIndex 
)

Set vertex-face Color for all vertices on this face.

Parameters
[in]colorThe color to set
[in]faceIndexThe face to set it for
Returns
Status code
Status Codes:
MStatus setFaceColor ( MColor color,
int  faceIndex,
MColorRepresentation  rep 
)

Set vertex-face Color of specified channels for all vertices on this face.

Parameters
[in]colorThe color to set
[in]faceIndexThe face to set it for
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus setVertexColor ( MColor color,
int  vertexIndex,
MDGModifier modifier = NULL 
)

Set color for this vertex.

The color is set for the vertex-face in each face that the vertex belongs to.

NOTE: To change the colors of many vertices, it is more efficient to use the batch updating method setVertexColors() instead.

Parameters
[in]colorThe color to set
[in]vertexIndexThe object-relative (mesh-relative/global) vertex index to set it for
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus setVertexColor ( MColor color,
int  vertexIndex,
MDGModifier modifier,
MColorRepresentation  rep 
)

Set color of specified channels for this vertex.

The color is set for the vertex-face in each face that the vertex belongs to.

NOTE: To change the colors of many vertices, it is more efficient to use the batch updating method setVertexColors() instead.

Parameters
[in]colorThe color to set
[in]vertexIndexThe object-relative (mesh-relative/global) vertex index to set it for
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus setFaceVertexColor ( MColor color,
int  faceIndex,
int  vertexIndex,
MDGModifier modifier = NULL 
)

Set color for this vertex in this face.

Parameters
[in]colorThe color to set
[in]faceIndexThe face to set it for
[in]vertexIndexThe object-relative (mesh_relative/global) vertex index to set it for
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus setFaceVertexColor ( MColor color,
int  faceIndex,
int  vertexIndex,
MDGModifier modifier,
MColorRepresentation  rep 
)

Set color of specified channels for this vertex in this face.

Parameters
[in]colorThe color to set
[in]faceIndexThe face to set it for
[in]vertexIndexThe object-relative (mesh_relative/global) vertex index to set it for
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus setFaceVertexColor ( int  faceIndex,
int  localVertexIndex,
MColor color,
MDGModifier modifier = NULL 
)

Set color for this vertex in this face.

Parameters
[in]faceIndexThe face to set it for
[in]localVertexIndexThe face-relative (local) vertex index to set it for
[in]colorThe color to set
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus setFaceVertexColor ( int  faceIndex,
int  localVertexIndex,
MColor color,
MDGModifier modifier,
MColorRepresentation  rep 
)

Set color of specified channels for this vertex in this face.

Parameters
[in]faceIndexThe face to set it for
[in]localVertexIndexThe face-relative (local) vertex index to set it for
[in]colorThe color to set
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus setFaceColors ( MColorArray colors,
MIntArray faceList 
)

Set color for these faces.

The color will be set for each vertex-face component of a face.

Parameters
[in]colorsThe colors to set
[in]faceListThe faces to set it for
Returns
Status code
Status Codes:
MStatus setFaceColors ( MColorArray colors,
MIntArray faceList,
MColorRepresentation  rep 
)

Set color of specified channels for these faces.

The color will be set for each vertex-face component of a face.

Parameters
[in]colorsThe colors to set
[in]faceListThe faces to set it for
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus setVertexColors ( MColorArray colors,
MIntArray vertexList,
MDGModifier modifier = NULL 
)

Set color for these vertices.

Parameters
[in]colorsThe colors to set
[in]vertexListThe vertices to set it for
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus setVertexColors ( MColorArray colors,
MIntArray vertexList,
MDGModifier modifier,
MColorRepresentation  rep 
)

Set color of specified channels for these vertices.

Parameters
[in]colorsThe colors to set
[in]vertexListThe vertices to set it for
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus setFaceVertexColors ( MColorArray colors,
MIntArray faceList,
MIntArray vertexList,
MDGModifier modifier = NULL 
)

Set colors for these face/vertex pairs.

Parameters
[in]colorsThe colors to set
[in]faceListThe faces to set it for
[in]vertexListThe object-relative (mesh-relative/global) vertex indices to set it for
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter 'faceList' contained an invalid face index, 'vertexList' contained an invalid vertex index, or they did not have the same number of elements as 'colors',
MStatus setFaceVertexColors ( MColorArray colors,
MIntArray faceList,
MIntArray vertexList,
MDGModifier modifier,
MColorRepresentation  rep 
)

Set colors of specified channels for these face/vertex pairs.

Parameters
[in]colorsThe colors to set
[in]faceListThe faces to set it for
[in]vertexListThe object-relative (mesh-relative/global) vertex indices to set it for
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter 'faceList' contained an invalid face index, 'vertexList' contained an invalid vertex index, or they did not have the same number of elements as 'colors'.
  • MS::kFailure An object error has occurred.
MStatus removeFaceColors ( MIntArray faceList)

Remove previously set color these faces.

For each face, the color will be unset for each vertex-face component in the face.

Parameters
[in]faceListThe faces to remove color from
Returns
Status code
Status Codes:
MStatus removeVertexColors ( MIntArray vertexList)

Remove color from these vertices.

Parameters
[in]vertexListThe object-relative (mesh-relative/global) vertex indices to remove color from
Returns
Status code
Status Codes:
MStatus removeFaceVertexColors ( MIntArray faceList,
MIntArray vertexList 
)

Remove colors for these face/vertex pairs.

Parameters
[in]faceListThe faces to remove color for
[in]vertexListThe corresponding object-relative (mesh-relative/global) vertex indices to remove color for
Returns
Status code
Status Codes:
MStatus getVertexColors ( MColorArray colors,
const MString colorSet = NULL,
const MColor defaultUnsetColor = NULL 
)

Get colors for all Vertices of the given colorSet.

If the colorSet is not specified, the default color set will be used. If no vertex/face has color for that vertex, the entry returned will be defaultUnsetColor. If the defaultUnsetColor is not given, then (-1, -1, -1, -1) will be used. If a color was set for some or all the faces for that vertex, an average of those verted/face values where the color has been set will be returned.

Parameters
[out]colorsStorage for the colors to be returned.
[in]colorSetColor set name
[in]defaultUnsetColorDefault Unset color
Returns
Status code
Status Codes:
MStatus getFaceVertexColors ( MColorArray colors,
const MString colorSet = NULL,
const MColor defaultUnsetColor = NULL 
)

Get colors for all vertex/faces of the given color set.

If the color set is not specified, the default color set will be used. If no vertex/face has color for that vertex, the entry returned will be defaultUnsetColor. If defaultUnsetColor is not given, then (-1, -1, -1, -1) will be used. If a color was set for some but not all the faces for that vertex, the ones where the color has not been explicitly set will have (0,0,0). If a vertex has shared color, the same value will be set for all its vertes/faces.

The colors are returned in face order: e.g. F0V0, F0V1.. F0Vn, F1V0, etc... Use the index returned by getFaceVertexColorIndex if you wish to index directly into the returned color array.

This method is not threadsafe.

Parameters
[out]colorsStorage for the colors to be returned.
[in]colorSetColor set name
[in]defaultUnsetColorDefault unset color
Returns
Status code
Status Codes:
MStatus getFaceVertexColorIndex ( int  faceIndex,
int  localVertexIndex,
int &  colorIndex,
const MString colorSet = NULL 
)

Get an index into the array returned by getFaceVertexColors.

So that you can index into the array directly, instead of walking it in face-vertex order.

Parameters
[in]faceIndexThe face to look for
[in]localVertexIndexThe face-relative (local) vertex id to look for
[out]colorIndexStorage for the color index to be returned.
[in]colorSetColor set to work with
Returns
Status code
Status Codes:
MStatus setColors ( const MColorArray colorArray,
const MString colorSet = NULL 
)

Sets all of the colors for this mesh.

The color array must be at least as large as the current color set size. You can determine the color set size by calling numColors() for the default color set, or numColors(colorSet) for a named color set.

If the array is larger than the color set size, then the color list for this mesh will be grown to accommodate the new color values.

After using this method to set the color values, you can call assignColors to assign the corresponding color ids to the geometry.

In order to shrink the color array, do the following:

These steps will let you to create an array of colors which is smaller than the original one.

Parameters
[in]colorArrayThe array of color values to be set
[in]colorSetThe color set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus setColors ( const MColorArray colorArray,
const MString colorSet,
MColorRepresentation  rep 
)

Sets all of the colors of specified channels for this mesh.

The color array must be at least as large as the current color set size. You can determine the color set size by calling numColors() for the default color set, or numColors(colorSet) for a named color set.

If the array is larger than the color set size, then the color list for this mesh will be grown to accommodate the new color values.

After using this method to set the color values, you can call assignColors to assign the corresponding color ids to the geometry.

In order to shrink the color array, do the following:

These steps will let you to create an array of colors which is smaller than the original one.

Parameters
[in]colorArrayThe array of color values to be set
[in]colorSetThe color set to work with
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus setSomeColors ( const MIntArray colorIds,
const MColorArray colorArray,
const MString colorSet = NULL 
)

Sets the specified colors for this mesh.

If the largest colorId in the array is larger than numColors() then the color list for this mesh will be grown to accommodate the new color values.

If you have added new colorIds, you can call assignColors to assign the colorIds to the geometry. If you are modifying existing colors, they will already be referenced by the existing mesh data.

Parameters
[in]colorIdsThe array of colorIds to set values for
[in]colorArrayThe array of color values to be set
[in]colorSetColor set to work with
Returns
Status code
Status Codes:
MStatus setSomeColors ( const MIntArray colorIds,
const MColorArray colorArray,
const MString colorSet,
MColorRepresentation  rep 
)

Sets the specified colors of specified channels for this mesh.

If the largest colorId in the array is larger than numColors() then the color list for this mesh will be grown to accommodate the new color values.

If you have added new colorIds, you can call assignColors to assign the colorIds to the geometry. If you are modifying existing colors, they will already be referenced by the existing mesh data.

Parameters
[in]colorIdsThe array of colorIds to set values for
[in]colorArrayThe array of color values to be set
[in]colorSetColor set to work with
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus getColors ( MColorArray colorArray,
const MString colorSet = NULL,
const MColor defaultUnsetColor = NULL 
) const

This method copies the color array for this mesh into the given color array.

Use the index returned by getColorIndex to access the array. If the color is not set for a vertex, defaultUnsetColor will be return. If defaultUnsetColor is not set, (0,0,0,1) will be return.

Parameters
[out]colorArrayStorage for the color values list
[in]colorSetColor set to work with
[in]defaultUnsetColorDefault unset color
Returns
Status code
Status Codes:
+ Examples:
MStatus getColorIndex ( int  faceIndex,
int  localVertexIndex,
int &  colorIndex,
const MString colorSet = NULL 
)

Get an index into the array returned by getColors.

Parameters
[in]faceIndexThe face to look for
[in]localVertexIndexThe face-relative (local) vertex id to look for
[out]colorIndexStorage for the color index to be returned.
[in]colorSetColor set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus setColor ( int  colorId,
const MColor color,
const MString colorSet = NULL 
)

Sets the specified color values.

The colorId is the element in the color list that will be set. If the colorId is greater than or equal to numColors() then the color list will be grown to accommodate the specified color.

Parameters
[in]colorIdThe element in the color list to be set
[in]colorThe new color value that is to be set
[in]colorSetColor set to work with
Returns
Status code
Status Codes:
MStatus setColor ( int  colorId,
const MColor color,
const MString colorSet,
MColorRepresentation  rep 
)

Sets the specified color values of specified channels.

The colorId is the element in the color list that will be set. If the colorId is greater than or equal to numColors() then the color list will be grown to accommodate the specified color.

Parameters
[in]colorIdThe element in the color list to be set
[in]colorThe new color value that is to be set
[in]colorSetColor set to work with
[in]repThe RGB/RGBA/A channel(s) to set
Returns
Status code
Status Codes:
MStatus getColor ( int  colorId,
MColor color,
const MString colorSet = NULL,
const MColor defaultUnsetColor = NULL 
) const

Get the value of the specified texture coordinate from this mesh's color list.

The colorId is the element in the color list that will be retrieved. If the color is not set, defaultUnsetColor will be return. If defaultUnsetColor is not set, (0,0,0,1) will be return.

Parameters
[in]colorIdThe element in the color list to examine
[out]colorStorage for the color value
[in]colorSetColor set to work with
[in]defaultUnsetColordefault unset color
Returns
Status code
Status Codes:
MStatus assignColor ( int  polygonId,
int  vertexIndex,
int  colorId,
const MString colorSet = NULL 
)

Maps a color value to a specified vertex of a polygon.

Since color (vertex data) are stored per-polygon per-vertex you must specify both the polygon and the vertex that the color entry is mapped to.

The vertexIndex (face-relative/local) is the vertex within the polygon that the color will be mapped to. This index must be in the range 0 to polygonVertexCount(polygonId).

Parameters
[in]polygonIdThe polygon (face) to map to
[in]vertexIndexThe face-relative (local) vertex id of the polygon to map to
[in]colorIdThe color entry from the color list that will be mapped
[in]colorSetColor set to work with
Returns
Status code
Status Codes:
MStatus assignColors ( const MIntArray colorIds,
const MString colorSet = NULL 
)

This method maps all colors for the mesh.

The setColor/setColors method is used to create a color table for the mesh. After the table is created, this method is used to map those values to each polygon on a per-vertex basis. The setColor/setColors method should be called before the assignColors method.

The colorIds array should contain the color indices that will be mapped to each polygon-vertex in the mesh. The entries in this array specify which colors in the mesh's color table are mapped to each polygon-vertex. Each entry in the colorIds array must be less than numColors(), or numColors(colorSet) for a named colorSet. The size of the colorIds array is equivalent to the number of polygon-vertices, so for a cube with all polygons mapped there would be 24 entries.

Parameters
[in]colorIdsThe color indices to be mapped to each polygon-vertex
[in]colorSetColor set to work with
Returns
Status code
Status Codes:
+ Examples:
MStatus clearColors ( const MString colorSet = NULL)

This method clears out all color for the mesh, and leaves behind an empty color set.

This method should be used if it is needed to shrink the actual size of the color table. In this case, the user should call clearColors, setColors and then assignColors to rebuild the color mapping info.

When called on a dataMesh, the colors are removed. When called on a shape with no history, the colors are removed and the attributes are set on the shape. When called on a shape with history, the polyColorDel command is invoked and a polyColorDel node is created.

Parameters
[in]colorSetColor set to work with
Returns
Status code
Status Codes:
bool displayColors ( MStatus ReturnStatus = NULL) const

Determine if the mesh node is set to display vertex colors.

The display of vertex colors is controlled by the mesh node itself. It is not part of the mesh data. Therefore this method is only valid when the function set is operating on a mesh node. It will return a failure status if called when the function set is operating on mesh data.

Parameters
[out]ReturnStatusThe return status of the method
Returns
True if the mesh node is set to display vertex colors. False otherwise.
Status Codes:
MStatus setDisplayColors ( bool  enable)

Set whether the mesh node should display vertex colors.

The display of vertex colors is controlled by the mesh node itself. It is not part of the mesh data. Therefore this method is only valid when the function set is operating on a mesh node. It will return a failure status if called when the function set is operating on mesh data.

Parameters
[in]enableTrue to turn on color display, false to turn it off.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure The function set was not initialized with a node, or the node's displayColors attribute could not be set (e.g. node or attribute is locked).
+ Examples:
int getHoles ( MIntArray holeInfoArray,
MIntArray holeVertexArray,
MStatus ReturnStatus = NULL 
)

Retrieves a list of the holes in the polygon.

Parameters
[out]holeInfoArrayReceives an array of integer triples, one for each hole in the mesh. The first element in each triple represents the index of the holed face. The next two elements represent the number of vertices in the hole and the hole's start index in list of hole vertices in holeVertexArray, respectively. For example, if holeInfoArray = [ 0, 3, 0, 1, 4, 3 ], then this means that face 0 contains a 3-vertex hole whose vertex indices are stored in elements 0, 1, 2 of holeVertexArray, and face 1 contains a 4-vertex hole whose vertex indices are stored in elements 3, 4, 5, 6 of holeVertexArray.
[out]holeVertexArrayReceives an array consisting of the vertex indices of every hole in the mesh. The third element of each triple in holeInfoArray is the index of the start of a particular hole's vertex list in this array.
[out]ReturnStatusStatus code.
Returns
The number of holes in the mesh.
Status Codes:
+ Examples:
bool onBoundary ( int  polygonId,
MStatus ReturnStatus = NULL 
) const

A method to determines whether the specified face in the mesh is a boundary face.

Parameters
[in]polygonIdThe polygon (face) to examine
[out]ReturnStatusThe return status of the method
Returns
  • true If the specified edge is on the border of the object.
  • false If the specified edge is not on the boundary of the object.
Status Codes:
bool isBlindDataTypeUsed ( int  blindDataId,
MStatus ReturnStatus = NULL 
) const

Is this BlindData type id is already in use in this scene?

Parameters
[in]blindDataIdThe blind data id to check for
[out]ReturnStatusStatus Code
Returns
true: Id in use, false: id not in use
Status Codes:
+ Examples:
MStatus createBlindDataType ( int  blindDataId,
MStringArray  longNames,
MStringArray  shortNames,
MStringArray  formatNames 
)

Create a new blind data type.

If the type id is already in use, this method will fail. Format names must be one of "int" "float" "double" "boolean" "string" "binary".

Parameters
[in]blindDataIdThe desired id for the new blind data type
[in]longNamesAttribute long names
[in]shortNamesAttribute short names
[in]formatNamesNames of the data types.
Returns
Status code
Status Codes:
+ Examples:
bool hasBlindDataComponentId ( int  compID,
MFn::Type  compType,
int  blindDataId,
MStatus ReturnStatus = NULL 
) const

Does this component have blind data with the given ID.

Parameters
[in]compIDThe component to check for blind data om When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[out]ReturnStatusStatus Code
Returns
true: has the specified blind data, false: does not
Status Codes:
bool hasBlindData ( MFn::Type  compType,
int  blindDataId,
MStatus ReturnStatus = NULL 
) const

Returns true if any component of the given type on this mesh have blind data with the given ID.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[out]ReturnStatusStatus Code
Returns
true: has the specified blind data, false: does not
Status Codes:
bool hasBlindDataComponentId ( int  compID,
MFn::Type  compType,
MStatus ReturnStatus = NULL 
) const

Does this component have any kind of blind data.

Parameters
[in]compIDThe component to check for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[out]ReturnStatusStatus Code
Returns
true: has the specified blind data, false: does not
Status Codes:
bool hasBlindData ( MFn::Type  compType,
MStatus ReturnStatus = NULL 
) const

Does any component of this type have any blind data.

(.e. is there any vertex blind data on this mesh?)

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[out]ReturnStatusStatus Code
Returns
true: has the specified blind data, false: does not
Status Codes:
MStatus getBlindDataTypes ( MFn::Type  compType,
MIntArray blindDataIds 
) const

Get the list of blind data ID's associated with the given component type on this mesh.

(e.g. all blind data ID's present on vertex compontents)

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[out]blindDataIdsspace for this list of blind data id values.
Returns
Status Code
Status Codes:
MStatus getBlindDataAttrNames ( int  blindDataId,
MStringArray longNames,
MStringArray shortNames,
MStringArray formatNames 
) const

Get the blind data attribute names and types for the specified blind data type id.

Format names will be one of "int" "float" "double" "boolean" "string" "binary".

Parameters
[in]blindDataIdThe blind data id to check for
[out]longNamesSpace for the attribute long names
[out]shortNamesSpace for the attribute short names
[out]formatNamesSpace for the data format names
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred. The specified blind data type does not exist.
MStatus getFaceVertexBlindDataIndex ( int  faceIndex,
int  vertexIndex,
int &  blindDataIndex 
) const

Get the single index to retrieve face-vertex blind data.

Parameters
[in]faceIndexThe face index to look for
[in]vertexIndexThe object-relative (mesh-relative/global) vertex index
[out]blindDataIndexThe component index for face vertex blind data storage to be returned
Returns
Status code
Status Codes:
MStatus getBlindDataFaceVertexIndices ( int  blindDataIndex,
int &  faceIndex,
int &  vertexIndex 
) const

Get the face and vertex indices from the face-vertex blind data index.

Parameters
[in]blindDataIndexThe component index for face vertex blind data storage to decompose
[in]faceIndexThe corresponding face index to be returned
[out]vertexIndexThe object-relative (mesh-relative/global) vertex index to be returned
Returns
Status code
Status Codes:
MStatus getIntBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
int &  data 
) const

Get the blind data value for the specified blind data attribute of the specified component.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compIDThe component to get for blind data on. When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]dataSpace for the data item
Returns
Status Code
Status Codes:
MStatus getIntBlindData ( MFn::Type  compType,
int  blindDataId,
MString  attrName,
MIntArray compIDs,
MIntArray data 
) const

Get the blind data value for the specified blind data attribute of the given type of component.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]compIDsSpace for the component indexes of the items When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[out]dataSpace for the data items
Returns
true: has the specified blind data, false: does not
Status Codes:
MStatus getFloatBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
float &  data 
) const

Get the blind data value for the specified blind data attribute of the specified component.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compIDThe component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]dataSpace for the data item
Returns
Status Code
Status Codes:
MStatus getFloatBlindData ( MFn::Type  compType,
int  blindDataId,
MString  attrName,
MIntArray compIDs,
MFloatArray data 
) const

Get the blind data value for the specified blind data attribute for all components of the given type.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]compIDsSpace for the component indexes of the items When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[out]dataSpace for the data items
Returns
Status Code
Status Codes:
MStatus getDoubleBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
double &  data 
) const

Get the blind data value for the specified blind data attribute of the specified component.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compIDThe component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]dataSpace for the data item
Returns
Status Code
Status Codes:
MStatus getDoubleBlindData ( MFn::Type  compType,
int  blindDataId,
MString  attrName,
MIntArray compIDs,
MDoubleArray data 
) const

Get the blind data value for the specified blind data attribute for all components of the given type.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]compIDsSpace for the component indexes of the items When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[out]dataSpace for the data items
Returns
Status Code
Status Codes:
MStatus getBoolBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
bool &  data 
) const

Get the blind data value for the specified blind data attribute of the specified component.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compIDThe component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]dataSpace for the data item
Returns
Status Code
Status Codes:
MStatus getBoolBlindData ( MFn::Type  compType,
int  blindDataId,
MString  attrName,
MIntArray compIDs,
MIntArray data 
) const

Get the blind data value for the specified blind data attribute for all components of the given type.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]compIDsSpace for the component indexes of the items When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[out]dataSpace for the data items (note that we return the bool data as an MIntArray since we don't have a convenient bool array type
Returns
Status Code
Status Codes:
MString stringBlindDataComponentId ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MStatus ReturnStatus = NULL 
) const

Get the blind data value for the specified blind data attribute of the specified component.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compIDThe component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]ReturnStatusStatus code. See below.
Returns
Blind data.
Status Codes:
MStatus getStringBlindData ( MFn::Type  compType,
int  blindDataId,
MString  attrName,
MIntArray compIDs,
MStringArray data 
) const

Get the blind data value for the specified blind data attribute for all components of the given type.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]compIDsSpace for the component indexes of the items When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[out]dataSpace for the data items (note that we return the bool data as an MIntArray since we don't have a convenient bool array type
Returns
Status Code
Status Codes:
MString binaryBlindDataComponentId ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MStatus ReturnStatus = NULL 
) const

Get the blind data value for the specified blind data attribute of the specified component.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compIDThe component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]ReturnStatusStatus code. See below.
Returns
The data item.
Status Codes:
MStatus getBinaryBlindData ( MFn::Type  compType,
int  blindDataId,
MString  attrName,
MIntArray compIDs,
MStringArray data 
) const

Get the blind data value for the specified blind data attribute for all components of the given type.

If the type of the attribute is not correct, this method will fail.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe blind data id to check for
[in]attrNameThe attribute name
[out]compIDsSpace for the component indexes of the items When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[out]dataSpace for the data items (note that we return the bool data as an MIntArray since we don't have a convenient bool array type
Returns
Status Code
Status Codes:
MStatus setIntBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
int  data 
)

Set a value for an integer blind data attribute.

Parameters
[in]compIDThe component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setIntBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
int  data 
)

Set a value for an integer blind data on an array of components.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setIntBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MIntArray data 
)

Set a values for an integer blind data on an array of components.

The arrays of values and components must be the same size.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataThe attribute values for each component
Returns
Status code
Status Codes:
MStatus setFloatBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
float  data 
)

Set a value for a float blind data attribute.

Parameters
[in]compIDThe component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setFloatBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
float  data 
)

Set a value for float blind data on an array of components.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setFloatBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MFloatArray data 
)

Set a values for a float blind data on an array of components.

The arrays of values and components must be the same size.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataThe attribute values for each component
Returns
Status code
Status Codes:
MStatus setDoubleBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
double  data 
)

Set a value for a double blind data attribute.

Parameters
[in]compIDThe component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
+ Examples:
MStatus setDoubleBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
double  data 
)

Set a value for double blind data on an array of components.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setDoubleBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MDoubleArray data 
)

Set a values for a double blind data on an array of components.

The arrays of values and components must be the same size.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataThe attribute values for each component
Returns
Status code
Status Codes:
MStatus setBoolBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
bool  data 
)

Set a value for a boolean blind data attribute.

Parameters
[in]compIDThe component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setBoolBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
bool  data 
)

Set a value for boolean blind data on an array of components.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setBoolBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MIntArray data 
)

Set a values for a boolean blind data on an array of components.

The arrays of values and components must be the same size.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataThe attribute values for each component
Returns
Status code
Status Codes:
MStatus setStringBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MString  data 
)

Set a value for a string blind data attribute.

Parameters
[in]compIDThe component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setStringBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MString  data 
)

Set a value for string blind data on an array of components.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setStringBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MStringArray data 
)

Set a values for a string blind data on an array of components.

The arrays of values and components must be the same size.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataThe attribute values for each component
Returns
Status code
Status Codes:
MStatus setBinaryBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MString  data 
)

Set a value for a binary blind data attribute.

Parameters
[in]compIDThe component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value as an MString. Note that the physical size must be set explicitly for binary data.
Returns
Status code
Status Codes:
MStatus setBinaryBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MString  data 
)

Set a value for binary blind data on an array of components.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value
Returns
Status code
Status Codes:
MStatus setBinaryBlindData ( MIntArray compIDs,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MStringArray data 
)

Set a values for a binary blind data on an array of components.

The arrays of values and components must be the same size.

Parameters
[in]compIDsThe components to set the blind data for When compType = MFn::kMeshFaceVertComponent then the elements of compIDs must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataThe attribute values for each component
Returns
Status code
Status Codes:
MStatus setBinaryBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
char *  data,
int  length 
)

Set a value for a binary blind data attribute.

Parameters
[in]compIDThe component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe desired id for the new blind data type
[in]attrNameAttribute name
[in]dataAttribute value as a char string
[in]lengthLength of char string to use
Returns
Status code
Status Codes:
MStatus clearBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName 
)

Delete a value for a binary blind data attribute on a particular componenr.

Parameters
[in]compIDThe component to clear the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe id for the blind data to be cleared
[in]attrNameAttribute name
Returns
Status code
Status Codes:
MStatus clearBlindData ( MFn::Type  compType,
int  blindDataId,
MString  attrName 
)

Delete the values for the given attribute on the given binary blind data type from all components of the given type.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe id for the blind data to be cleared
[in]attrNameThe attribute to clear the blind data for
Returns
Status code
Status Codes:
MStatus clearBlindData ( MFn::Type  compType)

Delete all blind data from components of the given type, e.g.

all edges from a particular component.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
Returns
Status code
Status Codes:
MStatus clearBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId 
)

Delete the values for a binary blind data type (all its attributes) from a particular component.

Parameters
[in]compIDThe component to clear the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe id for the blind data to be cleared
Returns
Status code
Status Codes:
MStatus clearBlindData ( MFn::Type  compType,
int  blindDataId 
)

Delete the values for a binary blind data type (all its attributes) from all components of the given type.

Parameters
[in]compTypeThe component type e.g. MFn::kMeshVertComponent
[in]blindDataIdThe id for the blind data to be cleared
Returns
Status code
Status Codes:
MString componentTypeName ( MFn::Type  compType,
MStatus status 
)
static

Get a string representing a particular component type.

Parameters
[in]compTypeThe type of component to fetch
[out]statusStatus Code
Returns
String representing the component type, empty string if invalid
Status Codes:
MFn::Type componentTypeFromName ( const MString assocName)
static

Get a component type from its string name.

Parameters
[in]assocNameString representing the component type
Returns
void setCheckSamePointTwice ( bool  check = true)

This method allows the turning on or off of duplicate point checking when polygons are created or added using this class.

Checking for duplicates, is the default state.

Parameters
[in]checktrue for checking, false otherwise
bool getCheckSamePointTwice ( void  )

Return true if checking for duplicate points is turned on.

Return false otherwise.

MStatus createInPlace ( int  numVertices,
int  numPolygons,
const MFloatPointArray vertexArray,
const MIntArray polygonCounts,
const MIntArray polygonConnects 
)

Replaces the existing polygonal mesh with a new one specified by array of vertices and polygon connection information.

This function will then operate on the replacement surface.

This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.

If the functionset is operating on a mesh node with construction history, this method will fail as the node will continue to get its geometry from its history connection. To use this method you must first break the history connection.

Parameters
[in]numVerticesnumber of vertices
[in]numPolygonsnumber of polygons
[in]vertexArraypoint (vertex) array. This should include all the vertices in the mesh, and no extras. For example, a cube could have the vertices: { (-1,-1,-1), (1,-1,-1), (1,-1,1), (-1,-1,1), (-1,1,-1), (-1,1,1), (1,1,1), (1,1,-1) }
[in]polygonCountsarray of vertex counts for each polygon. For example the cube would have 6 faces, each of which had 4 verts, so the polygonCounts would be {4,4,4,4,4,4}.
[in]polygonConnectsarray of vertex connections for each polygon. For example, in the cube, we have 4 vertices for every face, so we list the vertices for face0, face1, etc consecutively in the array. These are specified by indexes in the vertexArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 6, 5, 0, 3, 5, 4, 0, 4, 7, 1, 1, 7, 6, 2 }
Returns
+ Examples:
MStatus copyInPlace ( const MObject source)

This method creates copies the given source mesh onto the current surface.

After the copy this function set continues operate on the original mesh.

Parameters
[in]sourcethe mesh to be copied
Returns
MStatus polyTriangulate ( const float *  pointsAndHoles,
unsigned int  pointsCount,
unsigned int  outerPointsCount,
unsigned int  holesCount,
bool  considerNormal,
const float *  normals,
unsigned short *  triangles,
int &  trianglesCount 
)
static

Triangulates a polygon.

The polygon consists of 2D positions with optional 3D normals and holes. These 2D positions can be in any coordinate system. 3D positions can be projected to a 2D plane by its face normal. 3D normals are references to help triangulation. This function can work without normals but normals can improve the quality. This function works with pointers and is more efficient than the other variant.

Parameters
[in]pointsAndHolesArray of 2D positions and hole description. The array contains 2D positions (x,y) followed by the hole offsets. For example, if pointsAndHoles = [x1, y1, x2, y2, ..., x9, y9, o1, o1, o2, o2], then this means that (x1, y1) ~ (x9, y9) are positions, o1 is the offset for the first loop and o2 is the offset for the second loop.
[in]pointsCountThe number of 2D positions in pointsAndHoles
[in]outerPointsCountThe number of outer (non-hole) 2D positions in pointsAndHoles
[in]holesCountThe number of holes in pointsAndHoles
[in]considerNormalIf true then normals are considered during triangulation
[in]normalsArray of 3D normals. If considerNormal is false, this array can be NULL. If considerNormal is true, then there must be one normal per point.
[out]trianglesArray of triangle indices into pointsAndHoles array. The size of this array is trianglesCount * 3
[out]trianglesCountThe number of triangles written in triangles array
Returns
Status Code
Status Codes:
+ Examples:
MStatus polyTriangulate ( const MFloatPointArray points,
const MIntArray holes,
unsigned int  outerPointsCount,
const MFloatVectorArray normals,
MIntArray triangles 
)
static

Triangulates a polygon.

The polygon consists of positions with optional normals and holes. Normals are references to help triangulation. This function can work without normals but normals can improve the quality. A simple example:

MFloatPointArray Points; MIntArray Holes; MFloatVectorArray Normals; MIntArray Triangles;

Points.append(MFloatPoint(-1, 0, -1)); Points.append(MFloatPoint(-1, 0, 1)); Points.append(MFloatPoint(1, 0, 1)); Points.append(MFloatPoint(1, 0, -1)); Points.append(MFloatPoint(0.5, 0, -0.5)); Points.append(MFloatPoint(0.5, 0, 0.5)); Points.append(MFloatPoint(-0.5, 0, 0.5)); Points.append(MFloatPoint(-0.5, 0, -0.5)); Holes.append(4) // the 1st hole starts at 4th in Points for (unsigned int i = 0; i < 8; i++) Normals.append(MFloatVector(0, 1, 0));

MFnMesh::polyTriangulate(Points, Holes, 4, Normals, Triangles)

Parameters
[in]pointsArray of 3D points. The poly's outer vertices come first, followed by the vertices for each hole.
[in]holesArray of offsets into the 'points' array indicating where each hole's vertices start.
[in]outerPointsCountThe number of outer (non-hole) positions in points array
[in]normalsArray of normals. This array can be empty. If this array is not empty, then there must be one normal per point.
[out]trianglesArray of triangle indices into points array
Returns
Status Code
Status Codes:
MString createColorSetWithName ( const MString colorSetName,
MDGModifier modifier,
MStatus ReturnStatus 
)

This method is obsolete.

Deprecated:
Use createColorSetWithName(const MString &, MDGModifier *, const MUintArray *, MStatus *)

Create a new empty color set for this mesh. If the name passed in is empty (zero length), or a color set with the same name already exists, then a new unique name is generated and used as the new color set's name.

In the case where the name is empty, the new name will be of the format "colorSet#" where # is a number that makes the name unique for this mesh.

In the case where a color set already exists with the same name as the name passed in, then the new name will be of the format "userName#", where "userName" was the name specified, and # is a number appended on to "userName" to make the name unique for this mesh.

This operation will only work when the MFnMesh refers to a shape.

Parameters
[in]colorSetNameThe name of the color set to add.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]ReturnStatusStatus code. See below.
Returns
The resulting name of the color set.
Status Codes:
MObject generateSmoothMesh ( MObject  parentOrOwner,
MStatus ReturnStatus 
)

This method is obsolete.

Deprecated:
Use generateSmoothMesh(MObject, MMeshSmoothOptions * , MStatus *) instead.

Creates a new polygonal mesh using the Smooth Mesh Preview attributes of this mesh. Unlike the MFnMesh::create functions, this function does not set this function set to operate on the new surface.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

Parameters
[in]parentOrOwnerparent of the polygon that will be created
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:
MString currentColorSetName ( MStatus ReturnStatus) const

This method is obsolete. This method is not available in Python.

Deprecated:
Use MFnMesh::currentColorSetName(int, MStatus*) instead.

Get the name of the "current" or "working" color set. The "current" color set is the color set which is used for color operations when no color set is explcitly specified.

If there is no current color set, then a empty string will be returned on the string argument passed on.

Parameters
[out]ReturnStatusStatus code. See below.
Returns
  • Name of the "current" color set, if any.
Status Codes:
MObject addPolygon ( MPointArray vertexArray,
double  polyTolerance,
bool  mergeVertices = true,
double  pointTolerance = kMFnMeshPointTolerance,
bool  forceGeometry = true,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method is obsolete. This method is not available in Python.

Deprecated:
Use the other MFnMesh::addPolygon method.

Adds a new polygon to this polygonal mesh.

If there is no current geometry then a new polygonal mesh is created and parentOrOwner is used to specify the owner of the new surface. If parentOrOwner is NULL or a DAG parent is specified, then a new transform will be created in the DAG and returned. If the parentOrOwner is kMeshData then the new surface will become its data and the geometry will be returned.

If we are adding to an existing polygonal mesh then parentOrOwner is ignored and the geometry is returned.

Parameters
[in]vertexArrayarray of ordered vertices that make up the polygon
[in]polyTolerancespecifies the planar tolerance for the mesh. If all the verticies of a polygon are within this distance of the best fit computed plane between them, the polygon is considered to be planar.
[in]mergeVerticesIf true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
[in]pointTolerancespecifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
[in]forceGeometryif true handle no-manifold topology regardless of non connectivity
[in]parentOrOwnerthe DAG parent or kMeshData the new surface will belong to
[out]ReturnStatusstatus code
Returns
The transform if one is created, otherwise the geometry.
Status Codes:
bool intersect ( MPoint raySource,
MVector rayDirection,
MPointArray points,
MStatus ReturnStatus = NULL 
) const

This method is obsolete. This method is not available in Python.

Deprecated:
Use the other MFnMesh::intersect method.

Determines whether the given ray intersects this polygon and if so, returns the points of intersection. The points of intersection will be in order of closest point to the raySource.

This method is not threadsafe when invoked by multiple threads on the same object at the same time. It is threadsafe as long as each thread operates on a different mesh object.

Parameters
[in]raySourceStarting point for the ray
[in]rayDirectionDirection of the ray
[out]pointsStorage for any points of intersection
[out]ReturnStatusStatus code
Returns
  • true The given ray intersects this polygon
  • false The given ray does not intersect this polygon
Status Codes:
bool intersect ( const MPoint raySource,
const MVector rayDirection,
MPointArray points,
MStatus ReturnStatus = NULL 
) const

This method is obsolete. This method is not available in Python.

Deprecated:
Use the other MFnMesh::intersect method.

Determines whether the given ray intersects this polygon and if so, returns the points of intersection. The points of intersection will be in order of closest point to the raySource.

This method is not threadsafe when invoked by multiple threads on the same object at the same time. It is threadsafe as long as each thread operates on a different mesh object.

Parameters
[in]raySourceStarting point for the ray
[in]rayDirectionDirection of the ray
[out]pointsStorage for any points of intersection
[out]ReturnStatusStatus code
Returns
  • true The given ray intersects this polygon
  • false The given ray does not intersect this polygon
Status Codes:
MStatus getBlindDataAttrNames ( int  blindDataId,
MStringArray longNames,
MStringArray shortNames 
) const

Get the blind data attribute names for the specified blind data type id.

Parameters
[in]blindDataIdThe blind data id to check for
[out]longNamesSpace for the attribute long names
[out]shortNamesSpace for the attribute short names
Returns
Status Code
Status Codes:
bool hasBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MStatus ReturnStatus = NULL 
) const

This method is obsolete. This method is not available in Python.

Deprecated:
Use MFnMesh::hasBlindDataComponentId instead.
Parameters
[in]compID
[in]compType
[in]blindDataId
[out]ReturnStatus
bool hasBlindData ( int  compID,
MFn::Type  compType,
MStatus ReturnStatus = NULL 
) const

This method is obsolete. This method is not available in Python.

Deprecated:
Use MFnMesh::hasBlindDataComponentId instead.
Parameters
[in]compID
[in]compType
[out]ReturnStatus
MStatus createUVSet ( MString uvSetName,
MDGModifier modifier = NULL,
const MUintArray instances = NULL 
)

This method is not available in Python.

Create a new empty uv set for this mesh. If the name passed in is empty (zero length), or a uv set with the same name already exists, then a new unique name is generated and used as the new uvset's name.

In the case where the name is empty, the new name will be of the format "uvSet#" where # is a number that makes the name unique for this mesh.

In the case where a uvset already exists with the same name as the name passed in, then the new name will be of the format "userName#", where "userName" was the name specified, and # is a number appended on to "userName" to make the name unique for this mesh.

This operation will only work when the MFnMesh refers to a shape.

Python Notes

This method is not supported in Python. Please see createUVSetWithName()

Parameters
[in]uvSetNameThe name of the uv set to add. This name will be overwritten with a different name, if a new name needed to be generated.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]instancesThe instance number(s) for which the set should be added, or NULL if the uv-set should be shared by all instances.
Returns
Status code
Status Codes:
+ Examples:
MStatus copyUVSet ( const MString fromName,
MString toName,
MDGModifier modifier = NULL 
)

This method is not available in Python.

Copies a uv set from one to another for this mesh. The source must exist. The following cases can occur:

1) If the destination name is the same as the source than no copy will be made. 2) If the destination name exists a copy will be made to the destination. 3) If the destination name does not exist, then a new uv set will be created with a unique name, and then the copy will be made. The name generated will be "destinationName>#", where "destinationName" is the original name sent in, and "#" is a ascending number appended to the end of the original name.

This operation will only work when the MFnMesh refers to a shape.

Python Notes

This method is not supported in Python. Please see the one which returns a string

Parameters
[in]fromNameThe name of the uv set to change
[in]toNameThe name to set the uv set to. May be modified to return the final name used in the case where a new name needs to be generated.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
Returns
Status code
Status Codes:
MStatus getCurrentUVSetName ( MString setName,
int  instance = kMFnMeshInstanceUnspecified 
) const

This method is not available in Python.

Get the name of the "current" uv set. The "current" uv set is the uv set which is used for uv operations when no uv set is explcitly specified.

If there is no current uv set, then a empty string will be returned on the string argument passed on.

On instanced meshes, uv sets may be applied on a per-instance basis or may be shared across all instances. When the uv sets are per-instance, the concept of the current uv set has two levels of granularity. Namely, the current uv set applies to one or more instances, plus there are other uv sets in the same uv set family that apply to different instances. The instance arguement is used to indicate that if this is a per-instance uv set, you are interested in the name of the uv set that applies to the specified instance. When the index is not specified, the current uv set will be returned regardless of which instance it is for.

Note, the instance argument is only applicable on an MFnMesh that is initialized using a mesh shape. It will return failure if used on an MFnMesh that has no associated shape.

Python Notes

This method is not supported in Python. Please see the one which returns a string.

Parameters
[out]setNameName of the "current" uv set, if any.
[in]instanceInstance of the mesh whose set we are interested in, or kMFnMeshInstanceUnspecified for the set which is shared across all instances.
Returns
Status code
Status Codes:
+ Examples:
MStatus createColorSet ( MString colorSetName,
MDGModifier modifier = NULL,
const MUintArray instances = NULL 
)

This method is not available in Python.

Create a new empty color set for this mesh. If the name passed in is empty (zero length), or a color set with the same name already exists, then a new unique name is generated and used as the new color set's name.

In the case where the name is empty, the new name will be of the format "colorSet#" where # is a number that makes the name unique for this mesh.

In the case where a color set already exists with the same name as the name passed in, then the new name will be of the format "userName#", where "userName" was the name specified, and # is a number appended on to "userName" to make the name unique for this mesh.

This operation will only work when the MFnMesh refers to a shape.

Python Notes

This method is not supported in Python. Please see createColorSetWithName()

Parameters
[in]colorSetNameThe name of the color set to add. This name will be overwritten with a different name, if a new name needed to be generated.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]instancesThe instance number(s) for which the set should be added, or NULL if the uv-set should be shared by all instances.
Returns
Status code
Status Codes:
MStatus createColorSet ( MString colorSetName,
MDGModifier modifier,
bool  clamped,
MColorRepresentation  rep,
const MUintArray instances = NULL 
)

This method is not available in Python.

Create a new empty color set of specified channels for this mesh. If the name passed in is empty (zero length), or a color set with the same name already exists, then a new unique name is generated and used as the new color set's name.

In the case where the name is empty, the new name will be of the format "colorSet#" where # is a number that makes the name unique for this mesh.

In the case where a color set already exists with the same name as the name passed in, then the new name will be of the format "userName#", where "userName" was the name specified, and # is a number appended on to "userName" to make the name unique for this mesh.

This operation will only work when the MFnMesh refers to a shape.

Python Notes

This method is not supported in Python. Please see createColorSetWithName()

Parameters
[in]colorSetNameThe name of the color set to add. This name will be overwritten with a different name, if a new name needed to be generated.
[in,out]modifierSince this method may modify the DG, if you wish to undo its effects, you need to keep track of what needs to be undone. If the modifier is non-null, and this MFnMesh refers to a shape, then it will add the command to be undone to the modifier. Use MDGModifier::undoIt to undo the effects of this method.
[in]clampedThe color set stores values in 0 to 1 range if true. no range limit if false
[in]repThe color set stores RGB, RGBA, or Alpha
[in]instancesThe instance number(s) for which the set should be added, or NULL if the uv-set should be shared by all instances.
Returns
Status code
Status Codes:
MStatus getCurrentColorSetName ( MString setName,
int  instance = kMFnMeshInstanceUnspecified 
) const

This method is not available in Python.

Get the name of the "current" or "working" color set. The "current" color set is the color set which is used for color operations when no color set is explcitly specified.

If there is no current color set, then a empty string will be returned on the string argument passed on.

On instanced meshes, color sets may be applied on a per-instance basis or may be shared across all instances. When the color sets are per-instance, the concept of the current color set has two levels of granularity. Namely, the current color set applies to one or more instances, plus there are other color sets in the same color set family that apply to different instances. The instance arguement is used to indicate that if this is a per-instance color set, you are interested in the name of the color set that applies to the specified instance. When the index is not specified, the current color set will be returned regardless of which instance it is for.

Note, the instance argument is only applicable on an MFnMesh that is initialized using a mesh shape. It will return failure if used on an MFnMesh that has no associated shape.

Python Notes

This method is not supported in Python. Please see currentColorSetName().

Parameters
[out]setNameName of the "current" color set, if any.
[in]instanceInstance of the mesh whose color set we are interested in, or kMFnMeshInstanceUnspecified for the color set which is shared across all instances.
Returns
Status code
Status Codes:
MStatus getStringBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MString data 
) const

This method is obsolete. This method is not available in Python.

Deprecated:
Use MFnMesh::stringBlindDataComponentId instead.
Parameters
[in]compID
[in]compType
[in]blindDataId
[in]attrName
[out]data
MStatus getBinaryBlindData ( int  compID,
MFn::Type  compType,
int  blindDataId,
MString  attrName,
MString data 
) const

This method is obsolete. This method is not available in Python.

Deprecated:
Use MFnMesh::binaryBlindDataComponentId instead.
Parameters
[in]compID
[in]compType
[in]blindDataId
[in]attrName
[out]data
const adsk::Data::Associations * metadata ( MStatus ReturnStatus = NULL) const
virtual

This method is not available in Python.

Get the current metadata associated with this mesh.

When the MFnMesh is a mesh node then the metadata returned will be that associated with the output mesh attribute. When it is simple mesh data then the metadata returned is that belonging directly to that mesh data.

Metadata is shared and reference counted so the sequence of events for editing metadata inside a node with an input mesh and output mesh is: MFnMesh inMesh = theInputMesh(); MFnMesh outMesh = theOutputMesh(); const adsk::Data::Associations newMetadata( inMesh.metadata() ); doMetadataEditing( newMetadata ); outMesh.setMetadata( &newMetadata ); The "doMetadataEditing" call will take care of copying anything you are changing so that there is a minimum amount of duplication. After this sequence the inMesh and outMesh will contain different metadata.

Parameters
[out]ReturnStatusStatus code. See below.
Returns
Metadata associated with the mesh, NULL if there isn't any
Status Codes:

Reimplemented from MFnDependencyNode.

MStatus setMetadata ( const adsk::Data::Associations newMetadata)
virtual

This method is not available in Python.

Replace the existing metadata with the given values.

Parameters
[in]newMetadataThe new associated metadata for this mesh
Returns
Status code
Status Codes:

Reimplemented from MFnDependencyNode.

MStatus validateMetadata ( MString errors) const
virtual

This method is not available in Python.

Verify consistency in all of the existing metadata channels The intended use of this method is to check that the metadata channels are still internally consistent after operations have been performed on the underlying mesh (right number of vertexes, edges, faces, logical connectivity, sensible index values).

It's not meant to provide data validation (e.g. make sure a certain data in a channel is within it's legal range).

Parameters
[out]errorsString containing information about what went wrong
Returns
Status code
Status Codes:

Reimplemented from MFnDependencyNode.


The documentation for this class was generated from the following files:
  • MFnMesh.h
  • MFnMesh.cpp