Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

MFnMesh Class Reference

This reference page is linked to from the following overview topics: Implementing a hardware shading node plug-in, Threading and Maya.


Search for all occurrences

Detailed Description

Polygonal surface function set.

Note on Terminology: The following terms are used interchangeably:

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:

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

use the appropriate vertices.

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:

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.

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:

animCubeNode.cpp, apiMeshCreator.cpp, blindDataMesh.cpp, blindDataShader.cpp, cleanPerFaceAssignmentCmd.cpp, cvColorShader.cpp, D3DGeometryItem.cpp, D3DViewportRenderer.cpp, findTexturesPerPolygonCmd.cpp, flipUVCmd.cpp, getPointAndNormal.cpp, GLSLShaderNode.cpp, hairCollisionSolver.cpp, hwColorPerVertexShader.cpp, hwManagedTextureShader.cpp, intersectCmd.cpp, listPolyHolesCmd.cpp, meshMapUtils.cpp, meshOpFty.h, meshOpFtyAction.cpp, meshRemapCmd.cpp, meshReorderCmd.cpp, meshReorderCmd.h, objExport.cpp, OpenGLViewportRenderer.cpp, particleAttrNode.cpp, polyPrimitiveCmd.cpp, polyWriter.cpp, polyWriter.h, shellNode.cpp, splitUVCmd.cpp, splitUVFtyAction.cpp, and testNobjectNode.cpp.

#include <MFnMesh.h>

Inheritance diagram for MFnMesh:
Inheritance graph
[legend]

List of all members.

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 { kIntersection = 1, kDifference, kUnion }
 

Boolean operators.

More...

Public Member Functions

virtual MFn::Type  type () const
  Function set type.
virtual  ~MFnMesh ()
  Destructor.
  MFnMesh ()
  Default constructor.
  MFnMesh (MObject &object, MStatus *ReturnStatus=NULL)
  Constructor.
  MFnMesh (const MDagPath &object, MStatus *ret=NULL)
  Constructor.
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.
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.
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.
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.
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.
MStatus  getSmoothMeshDisplayOptions (MMeshSmoothOptions &options) const
  Retrieve the current display smoothing options for the mesh.
MStatus  setSmoothMeshDisplayOptions (const MMeshSmoothOptions &options)
  Sets the current display smoothing options for the mesh.
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.
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.
MStatus  deleteFace (int index, MDGModifier *modifier=NULL)
  Delete this face.
MStatus  deleteEdge (int index, MDGModifier *modifier=NULL)
  Delete this edge.
MStatus  deleteVertex (int index, MDGModifier *modifier=NULL)
  Delete this vertex.
MStatus  split (MIntArray &placements, MIntArray &edgeList, MFloatArray &edgeFactors, MFloatPointArray &internalPoints)
  This function splits a set of edges and faces in a continuous manner.
MStatus  subdivideFaces (MIntArray &faceList, int divisionCount)
  This function subdivides multiple faces.
MStatus  subdivideEdges (MIntArray &edgeList, int divisionCount)
  This function subdivides edges at regular intervals.
MStatus  extrudeFaces (MIntArray &faceList, int extrusionCount, MFloatVector *translation, bool extrudeTogether)
  This function extrudes a set of faces.
MStatus  extrudeEdges (MIntArray &edgeList, int extrusionCount, MFloatVector *translation, bool extrudeTogether)
  This function extrudes edges.
MStatus  duplicateFaces (MIntArray &faceList, MFloatVector *translation)
  This function duplicates a set of faces and detaches them from the rest of the mesh.
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.
MStatus  collapseFaces (MIntArray &faceList)
  This function collapse faces into vertices.
MStatus  collapseEdges (MIntArray &edgeList)
  This function collapse edges into vertices.
int  numVertices (MStatus *ReturnStatus=NULL) const
  Returns the number of vertices in the vertex list for this mesh.
int  numEdges (MStatus *ReturnStatus=NULL) const
  Returns the number of edges for this mesh.
int  numPolygons (MStatus *ReturnStatus=NULL) const
  Returns the number of polygons for this mesh.
int  numFaceVertices (MStatus *ReturnStatus=NULL) const
  Returns the number of face-vertices for this mesh.
int  polygonVertexCount (int polygonId, MStatus *ReturnStatus=NULL) const
  Returns the number of vertices for the specified polygon.
int  numUVs (MStatus *ReturnStatus=NULL) const
  Returns the number of texture (uv) coordinates for this mesh.
int  numUVs (const MString &uvSet, MStatus *ReturnStatus=NULL) const
  Returns the number of texture (uv) coordinates for this mesh.
int  numColors (MStatus *ReturnStatus=NULL) const
  Returns the number of (vertex) color for this mesh.
int  numColors (const MString &colorSet, MStatus *ReturnStatus=NULL) const
  Returns the number of colors (vertex data) for this mesh.
int  numNormals (MStatus *ReturnStatus=NULL) const
  Returns the number of per-polygon per-vertex normals for this mesh.
bool  hasColorChannels (const MString &colorSet, MStatus *ReturnStatus=NULL) const
  This method returns if the color set has RGB components.
bool  hasAlphaChannels (const MString &colorSet, MStatus *ReturnStatus=NULL) const
  This method returns true if the color set has Alpha component.
MColorRepresentation  getColorRepresentation (const MString &colorSet, MStatus *ReturnStatus=NULL) const
  This method returns the color representation (RGB/RGBA/A) of a color set.
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.
MStatus  setIsColorClamped (const MString &colorSet, bool clamped)
  Set the color set to be clamped.
MStatus  getTriangles (MIntArray &triangleCounts, MIntArray &triangleVertices) const
  Returns the number of triangles for every polygon face and the vertex Ids of each triangle vertex.
MStatus  booleanOp (BoolOperation op, MFnMesh &mesh1, MFnMesh &mesh2)
  Computes the boolean between two meshes.
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.
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.
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.
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.
MStatus  freeCachedIntersectionAccelerator ()
  If the mesh has a cached intersection accelerator structure, then this routine forces it to be deleted.
MString  cachedIntersectionAcceleratorInfo (MStatus *ReturnStatus=NULL)
  Retrieves a string that describes the intersection acceleration structure for this object, if any.
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.
MStatus  getClosestPointAndNormal (const MPoint &toThisPoint, MPoint &theClosestPoint, MVector &theNormal, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL) const
  Returns the closest point on this surface to the given point.
MStatus  getClosestPoint (const MPoint &toThisPoint, MPoint &theClosestPoint, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL) const
  Returns the closest point on this surface to the given point.
MStatus  getClosestNormal (const MPoint &toThisPoint, MVector &theNormal, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL) const
  Returns the closest point on this surface to the given point.
MStatus  getConnectedShaders (unsigned int instanceNumber, MObjectArray &shaders, MIntArray &indices) const
  Returns all the shaders (sets) connected to the specified instance of this mesh.
MStatus  getConnectedSetsAndMembers (unsigned int instanceNumber, MObjectArray &sets, MObjectArray &comps, bool renderableSetsOnly) const
  Returns all the sets connected to the specified instance of this mesh.
MObject  copy (const MObject &source, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
  This method creates a copy of a given source mesh.
MStatus  updateSurface ()
  Signal that this polygonal mesh has changed and needs to redraw itself.
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.
const float *  getRawPoints (MStatus *) const
  This method returns a pointer to the internal vertex list for this mesh.
const float *  getRawNormals (MStatus *) const
  This method returns a pointer to the internal normal list for this mesh.
MStatus  getPoints (MFloatPointArray &vertexArray, MSpace::Space space=MSpace::kObject) const
  This method copies the vertex list for this mesh into the given point array.
MStatus  getPoints (MPointArray &vertexArray, MSpace::Space space=MSpace::kObject) const
  This method copies the vertex list for this mesh into the given point array.
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.
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.
MStatus  getVertices (MIntArray &vertexCount, MIntArray &vertexList) const
  This method retrieves the object-relative (mesh-relative/global) vertex indices for all polygons.
MStatus  getPolygonVertices (int polygonId, MIntArray &vertexList) const
  This method retrieves the object-relative (mesh-relative/global) vertex indices for the specified polygon.
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.
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.
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.
MStatus  getNormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const
  This method copies the normal list for this mesh into the given array.
MStatus  setNormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject)
  Set the normal array (user normals)
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.
MStatus  getFaceVertexNormals (int faceIndex, MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const
  Return all per-vertex-per-face normals for a given face.
MStatus  getNormalIds (MIntArray &normalIdCounts, MIntArray &normalIds) const
  Return normal indices for all vertices for a all faces.
MStatus  getFaceNormalIds (int faceIndex, MIntArray &normals) const
  Return normal indices for all vertices for a given face.
MStatus  setFaceVertexNormal (MVector &normal, int faceIndex, int vertexIndex, MSpace::Space space=MSpace::kObject, MDGModifier *modifier=NULL)
  Set Normal for this face/vertex pair.
MStatus  setVertexNormal (MVector &normal, int vertexIndex, MSpace::Space space=MSpace::kObject, MDGModifier *modifier=NULL)
  Set Shared Normal for this vertex.
MStatus  setFaceVertexNormals (MVectorArray &normalArray, MIntArray &faceList, MIntArray &vertexList, MSpace::Space space=MSpace::kObject)
  Set Normals for the given face/vertex pairs.
MStatus  setVertexNormals (MVectorArray &normalArray, MIntArray &vertexList, MSpace::Space space=MSpace::kObject)
  Set Shared Normals for these vertices.
MStatus  getVertexNormal (int vertexId, MVector &normal, MSpace::Space space=MSpace::kObject) const
  This method is obsolete.
MStatus  getVertexNormal (int vertexId, bool angleWeighted, MVector &normal, MSpace::Space space=MSpace::kObject) const
  Return the normal at the given vertex.
MStatus  getVertexNormals (bool angleWeighted, MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const
  Return all vertex normals.
MStatus  getPolygonNormal (int polygonId, MVector &normal, MSpace::Space space=MSpace::kObject) const
  Return the normal at the given polygon.
bool  isNormalLocked (int normalId, MStatus *ReturnStatus=NULL) const
  Test if the normal for a face/vertex pairs is locked (user defined).
MStatus  lockVertexNormals (MIntArray &vertexList)
  Lock Shared Normals for these vertices.
MStatus  lockFaceVertexNormals (MIntArray &faceList, MIntArray &vertexList)
  Lock Normals for these face/vertex pairs.
MStatus  unlockVertexNormals (MIntArray &vertexList)
  Unlock Shared Normals for these vertices.
MStatus  unlockFaceVertexNormals (MIntArray &faceList, MIntArray &vertexList)
  Unlock Normals for these face/vertex pairs.
int  getTangentId (int faceIndex, int vertexIndex, MStatus *ReturnStatus=NULL) const
  Return the tangent index for a given face vertex.
MStatus  getTangents (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const
  Return the tangent vectors for all face vertices.
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.
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.
MStatus  getBinormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const
  Return the binormal vectors for all face vertices.
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.
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.
bool  isPolygonConvex (int faceIndex, MStatus *ReturnStatus=NULL) const
  This method determines if the specified polygon is convex.
MStatus  getEdgeVertices (int edgeId, int2 &vertexList) const
  This method retrieves the object-relative (mesh-relative/global) vertex indices corresponding to the specified edge.
bool  isEdgeSmooth (int edgeId, MStatus *ReturnStatus=NULL) const
  This method determines if the specified edge is smooth (soft).
MStatus  setEdgeSmoothing (int edgeId, bool smooth=true)
  This method sets the specified edge to be hard or smooth (soft).
MStatus  cleanupEdgeSmoothing ()
  This method updates the mesh after setEdgeSmoothing has been done.
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.
MStatus  setCreaseEdges (const MUintArray &edgeIds, const MDoubleArray &creaseData)
  This method sets the specified edges of the mesh as crease edges.
MUintArray  getInvisibleFaces (MStatus *ReturnStatus=NULL) const
  This method returns the invisible faces of the mesh.
MStatus  setInvisibleFaces (const MUintArray &faceIds, bool makeVisible=false)
  This method sets the specified faces of the mesh to be visible or invisible.
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.
MStatus  setCreaseVertices (const MUintArray &vertexIds, const MDoubleArray &creaseData)
  This method sets the specified vertices of the mesh as crease vertices.
int  numUVSets (MStatus *ReturnStatus=NULL) const
  Returns the number of uv sets for an object.
MString  createUVSetWithName (const MString &uvSetName, MDGModifier *modifier=NULL, MStatus *ReturnStatus=NULL, const MUintArray *instances=NULL)
  Create a new empty uv set for this mesh.
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.
MStatus  renameUVSet (const MString &origName, const MString &newName, MDGModifier *modifier=NULL)
  Renames a uv set from one name to another for this mesh.
MStatus  deleteUVSet (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL)
  Deletes a named uv set from the object.
MStatus  setCurrentUVSetName (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL)
  Set the "current" uv set for this object.
MString  currentUVSetName (MStatus *ReturnStatus=NULL, int instance=kMFnMeshInstanceUnspecified) const
  Get the name of the "current" uv set.
MStatus  getUVSetNames (MStringArray &setNames) const
  Get the names of all of the uv sets on this object.
MStatus  getUVSetFamilyNames (MStringArray &familyNames) const
  Get the names of all of the uv set families on this object.
MStatus  getUVSetsInFamily (const MString &familyName, MStringArray &setNames) const
  Get the names of the uv sets that belong to this set family.
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.
MStatus  getFaceUVSetNames (int polygonId, MStringArray &setNames) const
  This method returns the list of UV sets mapped to a face.
MStatus  getAssociatedUVSetTextures (const MString uvSetName, MObjectArray &textures) const
  Get a list of texture nodes which are using a given uv set.
MStatus  getAssociatedUVSetInstances (const MString &uvSetName, MIntArray &instances) const
  Get a list of the instance numbers associated with this uv map.
MStatus  setUVs (const MFloatArray &uArray, const MFloatArray &vArray, const MString *uvSet=NULL)
  Sets all of the texture coordinates (uv's) for this mesh.
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.
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.
MStatus  setUV (int uvId, float u, float v, const MString *uvSet=NULL)
  Sets the specified texture coordinate.
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.
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.
MStatus  getUVAtPoint (MPoint &pt, float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, int *closestPolygon=NULL)
  Find the point closet to the given point, and return the UV value at that point.
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.
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.
MStatus  assignUV (int polygonId, int vertexIndex, int uvId, const MString *uvSet=NULL)
  Maps a texture coordinate to a specified vertex of a polygon.
MStatus  assignUVs (const MIntArray &uvCounts, const MIntArray &uvIds, const MString *uvSet=NULL)
  This method maps all texture coordinates for the mesh.
MStatus  clearUVs (const MString *uvSet=NULL)
  This method clears out all texture coordinates for the mesh, and leaves behind an empty UVset.
MStatus  getAssignedUVs (MIntArray &uvCounts, MIntArray &uvIds, const MString *uvSet=NULL) const
  Get assigned UVs.
MStatus  getUvShellsIds (MIntArray &uvShellIds, unsigned int &nbUvShells, const MString *uvSet=NULL) const
  Constructs an array of unique integer for each UV shell.
int  numColorSets (MStatus *ReturnStatus=NULL) const
  Returns the number of color sets for an object.
MString  createColorSetWithName (const MString &colorSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL, MStatus *ReturnStatus=NULL)
  Create a new empty color set for this mesh.
MStatus  deleteColorSet (const MString &colorSetName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL)
  Deletes a named color set from the object.
MStatus  setCurrentColorSetName (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL)
  Set the "current" or "working" color set for this object.
MString  currentColorSetName (int instance=kMFnMeshInstanceUnspecified, MStatus *ReturnStatus=NULL) const
  Get the name of the "current" or "working" color set.
MStatus  getColorSetNames (MStringArray &setNames) const
  Get the names of all of the colors sets on this object.
MStatus  getColorSetFamilyNames (MStringArray &familyNames) const
  Get the names of all of the color set families on this object.
MStatus  getColorSetsInFamily (const MString &familyName, MStringArray &setNames) const
  Get the names of the color sets that belong to this set family.
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.
MStatus  getAssociatedColorSetInstances (const MString &setName, MIntArray &instances) const
  Get a list of the instance numbers associated with this color map.
MStatus  setFaceColor (MColor &color, int index)
  Set vertex-face Color for all vertices on this face.
MStatus  setFaceColor (MColor &color, int index, MColorRepresentation rep)
  Set vertex-face Color of specified channels for all vertices on this face.
MStatus  setVertexColor (MColor &color, int index, MDGModifier *modifier=NULL)
  Set color for this vertex.
MStatus  setVertexColor (MColor &color, int index, MDGModifier *modifier, MColorRepresentation rep)
  Set color of specified channels for this vertex.
MStatus  setFaceVertexColor (MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier=NULL)
  Set color for this vertex in this face.
MStatus  setFaceVertexColor (MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier, MColorRepresentation rep)
  Set color of specified channels for this vertex in this face.
MStatus  setFaceVertexColor (int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier=NULL)
  Set color for this vertex in this face.
MStatus  setFaceVertexColor (int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier, MColorRepresentation rep)
  Set color of specified channels for this vertex in this face.
MStatus  setFaceColors (MColorArray &colors, MIntArray &faceList)
  Set color for these faces.
MStatus  setFaceColors (MColorArray &colors, MIntArray &faceList, MColorRepresentation rep)
  Set color of specified channels for these faces.
MStatus  setVertexColors (MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier=NULL)
  Set color for these vertices.
MStatus  setVertexColors (MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep)
  Set color of specified channels for these vertices.
MStatus  setFaceVertexColors (MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier=NULL)
  Set colors for these face/vertex pairs.
MStatus  setFaceVertexColors (MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep)
  Set colors of specified channels for these face/vertex pairs.
MStatus  removeFaceColors (MIntArray &faceList)
  Remove previously set color these faces.
MStatus  removeVertexColors (MIntArray &vertexList)
  Remove color from these vertices.
MStatus  removeFaceVertexColors (MIntArray &faceList, MIntArray &vertexList)
  Remove colors for these face/vertex pairs.
MStatus  getVertexColors (MColorArray &colors, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL)
  Get colors for all Vertices of the given colorSet.
MStatus  getFaceVertexColors (MColorArray &colors, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL)
  Get colors for all vertex/faces of the given color set.
MStatus  getFaceVertexColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet=NULL)
  Get an index into the array returned by getFaceVertexColors.
MStatus  setColors (const MColorArray &colors, const MString *colorSet=NULL)
  Sets all of the colors for this mesh.
MStatus  setColors (const MColorArray &colors, const MString *colorSet, MColorRepresentation rep)
  Sets all of the colors of specified channels for this mesh.
MStatus  setSomeColors (const MIntArray &colorIds, const MColorArray &colors, const MString *colorSet=NULL)
  Sets the specified colors for this mesh.
MStatus  setSomeColors (const MIntArray &colorIds, const MColorArray &colors, const MString *colorSet, MColorRepresentation rep)
  Sets the specified colors of specified channels for this mesh.
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.
MStatus  getColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet=NULL)
  Get an index into the array returned by getColors.
MStatus  setColor (int colorId, const MColor &color, const MString *colorSet=NULL)
  Sets the specified color values.
MStatus  setColor (int colorId, const MColor &color, const MString *colorSet, MColorRepresentation rep)
  Sets the specified color values of specified channels.
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.
MStatus  assignColor (int polygonId, int vertexIndex, int colorId, const MString *colorSet=NULL)
  Maps a color value to a specified vertex of a polygon.
MStatus  assignColors (const MIntArray &colorIds, const MString *colorSet=NULL)
  This method maps all colors for the mesh.
MStatus  clearColors (const MString *colorSet=NULL)
  This method clears out all color for the mesh, and leaves behind an empty color set.
bool  displayColors (MStatus *ReturnStatus=NULL) const
  Determine if the mesh node is set to display vertex colors.
MStatus  setDisplayColors (bool enable)
  Set whether the mesh node should display vertex colors.
int  getHoles (MIntArray &holeInfoArray, MIntArray &holeVertexArray, MStatus *ReturnStatus=NULL)
  Retrieves a list of the holes in the polygon.
bool  onBoundary (int polygonId, MStatus *ReturnStatus=NULL) const
  A method to determines whether the specified face in the mesh is a boundary face.
bool  isBlindDataTypeUsed (int blindDataId, MStatus *ReturnStatus=NULL) const
  Is this BlindData type id is already in use in this scene?
MStatus  createBlindDataType (int blindDataId, MStringArray longNames, MStringArray shortNames, MStringArray formatNames)
  Create a new blind data type.
bool  hasBlindDataComponentId (int compID, MFn::Type compType, int blindDataId, MStatus *ReturnStatus=NULL) const
  Does this component have blind data with the given ID.
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.
bool  hasBlindDataComponentId (int compID, MFn::Type compType, MStatus *ReturnStatus=NULL) const
  Does this component have any kind of blind data.
bool  hasBlindData (MFn::Type compType, MStatus *ReturnStatus=NULL) const
  Does any component of this type have any blind data.
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.
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.
MStatus  getFaceVertexBlindDataIndex (int faceIndex, int vertexIndex, int &blindDataIndex) const
  Get the single index to retrieve face-vertex blind data.
MStatus  getBlindDataFaceVertexIndices (int blindDataIndex, int &faceIndex, int &vertexIndex) const
  Get the face and vertex indices from the face-vertex blind data index.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
MStatus  setIntBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, int data)
  Set a value for an integer blind data attribute.
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.
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.
MStatus  setFloatBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, float data)
  Set a value for a float blind data attribute.
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.
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.
MStatus  setDoubleBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, double data)
  Set a value for a double blind data attribute.
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.
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.
MStatus  setBoolBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, bool data)
  Set a value for a boolean blind data attribute.
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.
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.
MStatus  setStringBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString data)
  Set a value for a string blind data attribute.
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.
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.
MStatus  setBinaryBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString data)
  Set a value for a binary blind data attribute.
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.
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.
MStatus  setBinaryBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, char *data, int length)
  Set a value for a binary blind data attribute.
MStatus  clearBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName)
  Delete a value for a binary blind data attribute on a particular componenr.
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.
MStatus  clearBlindData (MFn::Type compType)
  Delete all blind data from components of the given type, e.g.
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.
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.
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.
bool  getCheckSamePointTwice (void)
  Return true if checking for duplicate points is turned on.
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.
MStatus  copyInPlace (const MObject &source)
  This method creates copies the given source mesh onto the current surface.
MString  createColorSetWithName (const MString &colorSetName, MDGModifier *modifier, MStatus *ReturnStatus)
  This method is obsolete.
MString  currentColorSetName (MStatus *ReturnStatus) const
  This method is obsolete. This method is not available in Python.
MObject  generateSmoothMesh (MObject parentOrOwner, MStatus *ReturnStatus)
  This method is obsolete.
  MFnMesh (const MObject &object, MStatus *ret=NULL)
  Constructor.
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.
bool  intersect (MPoint &raySource, MVector &rayDirection, MPointArray &points, MStatus *ReturnStatus=NULL) const
  This method is obsolete. This method is not available in Python.
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.
MStatus  getBlindDataAttrNames (int blindDataId, MStringArray &longNames, MStringArray &shortNames) const
  Get the blind data attribute names for the specified blind data type id.
bool  hasBlindData (int compID, MFn::Type compType, int blindDataId, MStatus *ReturnStatus=NULL) const
  This method is obsolete. This method is not available in Python.
bool  hasBlindData (int compID, MFn::Type compType, MStatus *ReturnStatus=NULL) const
  This method is obsolete. This method is not available in Python.
MStatus  createUVSet (MString &uvSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL)
  This method is not available in Python.
MStatus  copyUVSet (const MString &fromName, MString &toName, MDGModifier *modifier=NULL)
  This method is not available in Python.
MStatus  getCurrentUVSetName (MString &setName, int instance=kMFnMeshInstanceUnspecified) const
  This method is not available in Python.
MStatus  createColorSet (MString &colorSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL)
  This method is not available in Python.
MStatus  createColorSet (MString &colorSetName, MDGModifier *modifier, bool clamped, MColorRepresentation rep, const MUintArray *instances=NULL)
  This method is not available in Python.
MStatus  getCurrentColorSetName (MString &setName, int instance=kMFnMeshInstanceUnspecified) const
  This method is not available in Python.
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.
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.

Static Public Member Functions

static MMeshIsectAccelParams  uniformGridParams (int xDiv, int yDiv, int zDiv)
  Creates a MMeshIsectAccelParams configuration object to pass to the methods MFnMesh::closestIntersection(), MFnMesh::anyIntersection(), or MFnMesh::allIntersections().
static MMeshIsectAccelParams  autoUniformGridParams ()
  Creates a MMeshIsectAccelParams configuration object to pass to the methods MFnMesh::closestIntersection(), MFnMesh::anyIntersection(), or MFnMesh::allIntersections().
static MString  globalIntersectionAcceleratorsInfo ()
  Retrieves a string that describes the systemwide resource usage for cached mesh intersection accelerators.
static void  clearGlobalIntersectionAcceleratorInfo ()
  As described above, clears the "total count", "total build time", and "peak memory" fields from the information string returned by globalIntersectionAcceleratorsInfo().

Protected Member Functions

virtual const char *  className () const
  Class name.

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:
kIntersection 

Boolean interesection.

kDifference 

Boolean difference.

kUnion 

Boolean union.


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] object The MObject to attach the function set to
[out] ReturnStatus the 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] object The const MDagPath to attach the function set to
[out] ReturnStatus The 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] object The MObject to attach the function set to
[out] ReturnStatus the 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 [protected, virtual]

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] numVertices number of vertices
[in] numPolygons number of polygons
[in] vertexArray point (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] polygonCounts array 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] polygonConnects array 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] parentOrOwner parent of the polygon that will be created
[out] ReturnStatus Status 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
Examples:
animCubeNode.cpp, blindDataMesh.cpp, polyPrimitiveCmd.cpp, and shellNode.cpp.
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] numVertices number of vertices
[in] numPolygons number of polygons
[in] vertexArray point (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] polygonCounts array 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] polygonConnects array 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] parentOrOwner parent of the polygon that will be created
[out] ReturnStatus Status 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] numVertices number of vertices
[in] numPolygons number of polygons
[in] vertexArray point (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] polygonCounts array 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] polygonConnects array 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] uArray The array of u values to be set
[in] vArray The array of v values to be set
[in] parentOrOwner parent of the polygon that will be created
[out] ReturnStatus Status 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 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] numVertices number of vertices
[in] numPolygons number of polygons
[in] vertexArray point (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] polygonCounts array 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] polygonConnects array 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] uArray The array of u values to be set
[in] vArray The array of v values to be set
[in] parentOrOwner parent of the polygon that will be created
[out] ReturnStatus Status 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 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] parentOrOwner parent of the polygon that will be created
[in] options Set of options to use when generating the smoothed mesh
[out] ReturnStatus Status 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:
  • parentOrOwner was not valid
  • There was no model present to add the object to
MStatus getSmoothMeshDisplayOptions ( MMeshSmoothOptions options ) const

Retrieve the current display smoothing options for the mesh.

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

Sets the current display smoothing options for the mesh.

Parameters:
[in] options Options 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] vertexArray array of ordered vertices that make up the polygon
[in] mergeVertices If true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
[in] pointTolerance specifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
[in] parentOrOwner the DAG parent or kMeshData the new surface will belong to
[out] ReturnStatus status 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] vertexArray Array of ordered vertices that make up the polygon.
[out] faceIndex Index of the newly added polygon.
[in] mergeVertices If true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
[in] pointTolerance Specifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
[in] parentOrOwner The DAG parent or kMeshData the new surface will belong to.
[out] ReturnStatus Status code.
Returns:
The transform if one is created, otherwise the geometry.
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] faceId The face to delete
[in,out] modifier Since 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] edgeId The edge to delete
[in,out] modifier Since 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] vertexId The object-relative (mehs-relative/global) vertex index to delete
[in,out] modifier Since 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] placements array that contains elements of the SplitPlacement enumeration. They represent where to place the new vertices for the split.
[in] edgeList array 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] edgeFactors array 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] internalPoints array 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::kIndexOutOfRange One or more of the edge IDs are not on the mesh.
  • MS::kValueOutOfRange One or more of the edge factors are not within the [0,1] range
  • MS::kInvalidParameter The split algorithm could not be completed successfully or the array sizes are not appropriate.
  • MS::kNotFound The given placements list is empty.
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
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] faceList array of face IDs to subdivide
[in] divisionCount number of subsequent subdivisions to do
Returns:
Status Code
Status Codes:
  • MS::kValueOutOfRange The given subdivision count is less than 1
  • MS::kIndexOutOfRange The given faceIDs are not on the mesh
  • MS::kInvalidParameter The given information cannot result in the subdivision of the faces.
  • MS::kNotFound The given face list is empty
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
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] edgeList array of edge component IDs to be subdivided
[in] divisionCount number of subsequent subdivisions to do
Returns:
Status Code
Status Codes:
  • MS::kIndexOutOfRange The given edge IDs are not on the mesh
  • MS::kValueOutOfRange The given subdivision count is less than 1
  • MS::kInvalidParameter The subdivisions could not be completed successfully.
  • MS::kNotFound The given edge list is empty
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
MStatus extrudeFaces ( MIntArray faceList,
int  extrusionCount,
MFloatVector translation,
bool  extrudeTogether 
)

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.

Parameters:
[in] faceList array of face component IDs to be extruded
[in] extrusionCount number of subsequent extrusions to do
[in] translation translation vector to apply to the extruded elements. This is a world-space translation. Use NULL if not required.
[in] extrudeTogether sets whether the components should be extruded individually or together, as if one complex component was being extruded.
Returns:
Status Code
Status Codes:
  • MS::kIndexOutOfRange The given face IDs are not on the mesh
  • MS::kValueOutOfRange The given extrusion count is less than 1
  • MS::kInvalidParameter The extrusion could not be completed successfully.
  • MS::kNotFound The given face list is empty
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
MStatus extrudeEdges ( MIntArray edgeList,
int  extrusionCount,
MFloatVector translation,
bool  extrudeTogether 
)

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.

Parameters:
[in] edgeList array of edge component IDs to be extruded
[in] extrusionCount number of subsequent extrusions to do
[in] translation translation vector to apply to the extruded elements. This is a world-space translation. Use NULL if not required.
[in] extrudeTogether sets whether the components should be extruded individually or together, as if one complex component was being extruded.
Returns:
Status Code
Status Codes:
  • MS::kIndexOutOfRange The given edge IDs are not on the mesh
  • MS::kValueOutOfRange The given extrusion count is less than 1
  • MS::kInvalidParameter The extrusion could not be completed successfully.
  • MS::kNotFound The given edge list is empty
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
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] faceList array of face component IDs to be duplicated
[in] translation translation vector to apply to the duplicated elements. This is a world-space translation. Use NULL if not required.
Returns:
Status Code
Status Codes:
  • MS::kIndexOutOfRange The given face IDs are not on the mesh
  • MS::kInvalidParameter The duplication could not be completed successfully.
  • MS::kNotFound The given face list is empty
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
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] faceList array of face component IDs to be extracted
[in] translation translation vector to apply to the extracted elements. This is a world-space translation. Use NULL if not required.
Returns:
Status Code
Status Codes:
  • MS::kIndexOutOfRange The given face IDs are not on the mesh
  • MS::kInvalidParameter The extraction could not be completed successfully.
  • MS::kNotFound The given face list is empty
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
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] faceList array of face component IDs to be collapsed
Returns:
Status Code
Status Codes:
  • MS::kIndexOutOfRange The given face IDs are not on the mesh
  • MS::kInvalidParameter The collapse could not be completed successfully.
  • MS::kNotFound The given face list is empty
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
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] edgeList array of edge component IDs to be collapsed
Returns:
Status Code
Status Codes:
  • MS::kIndexOutOfRange The given edge IDs are not on the mesh
  • MS::kInvalidParameter The collapse could not be completed successfully.
  • MS::kNotFound The given edge list is empty
  • MS::kObjectDoesNotExist The base stucture was not initialized properly
  • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on
Examples:
meshOpFtyAction.cpp.
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] ReturnStatus Status code
Returns:
The number of vertices of the mesh
Status Codes:
int numEdges ( MStatus ReturnStatus = NULL ) const

Returns the number of edges for this mesh.

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

Returns the number of polygons for this mesh.

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

Returns the number of face-vertices for this mesh.

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

Returns the number of vertices for the specified polygon.

Parameters:
[in] polygonId The polygon index
[out] ReturnStatus Status code
Returns:
The number of vertices for the specified polygon
Status Codes:
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] ReturnStatus Status code
Returns:
The number of texture coordinates
Status Codes:
Examples:
splitUVFtyAction.cpp.
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] uvSet UV set to work with
[out] ReturnStatus Status 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] ReturnStatus Status code
Returns:
The number of colors
Status Codes:
Examples:
meshReorderCmd.cpp.
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] colorSet Color set to work with
[out] ReturnStatus Status 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] ReturnStatus Status 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] colorSet Color set to work with
[out] ReturnStatus Status 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] colorSet Color set to work with
[out] ReturnStatus Status 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] colorSet Color set to work with
[out] ReturnStatus Status 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:
Examples:
meshReorderCmd.cpp.
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] colorSet Color set to work with
[out] ReturnStatus Status code
Returns:
  • true All components in the color set are clamped
  • false All components in the color set are not clamped
Status Codes:
Examples:
meshReorderCmd.cpp.
MStatus setIsColorClamped ( const MString colorSet,
bool  clamped 
)

Set the color set to be clamped.

Parameters:
[in] colorSet Color set to work with
[in] clamped If 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 is three times longer than the triangleCounts array

This method is not threadsafe.

Parameters:
[out] triangleCounts The number of triangles for each polygon face
[out] triangleVertices The triangle vertex Ids for each triangle
Returns:
MStatus booleanOp ( BoolOperation  op,
MFnMesh mesh1,
MFnMesh mesh2 
)

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 as mesh can result from using MFnMeshData::create() for example.

Parameters:
[in] op Operation to perform (kIntersection, kDifference or kUnion)
[in] mesh1 The first mesh in the boolean operation
[in] mesh2 The second mesh in the boolean operation
Returns:
Status Code
Status Codes:
MMeshIsectAccelParams uniformGridParams ( int  xDiv,
int  yDiv,
int  zDiv 
) [static]

Creates a MMeshIsectAccelParams configuration object to pass to the methods MFnMesh::closestIntersection(), MFnMesh::anyIntersection(), or MFnMesh::allIntersections().

This object specifies that a uniform voxel grid structure should be used by the intersection routines 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 intersect 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] xDiv Number of voxels in the x direction
[in] yDiv Number of voxels in the y direction
[in] zDiv Number of voxels in the z direction
MMeshIsectAccelParams autoUniformGridParams ( ) [static]

Creates a MMeshIsectAccelParams configuration object to pass to the methods MFnMesh::closestIntersection(), MFnMesh::anyIntersection(), or MFnMesh::allIntersections().

This object specifies that a uniform voxel grid structure should be used by the intersection routines to speed up their operation, 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 intersect 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.

Examples:
intersectCmd.cpp.
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] raySource Starting point for the ray
[in] rayDirection Direction 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] idsSorted should 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] space specifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
[in] maxParam specifies 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] testBothDirections specifies 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] accelParams optional acceleration parameters.
[out] hitPoint receives the 3d coordinates of the closest intersection, in the space specified by the space parameter.
[out] hitRayParam if 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] hitFace if 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] hitTriangle if 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] hitBary1 if 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] hitBary2 if 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] tolerance numerical 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] ReturnStatus Status 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] raySource Starting point for the ray
[in] rayDirection Direction 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] idsSorted should 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] space specifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
[in] maxParam specifies 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] testBothDirections specifies 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] accelParams optional acceleration parameters.
[out] hitPoint receives the 3d coordinates of the intersection, in the space specified by the space parameter.
[out] hitRayParam if 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] hitFace if 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] hitTriangle if 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] hitBary1 if 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] hitBary2 if 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] tolerance numerical 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] ReturnStatus Status 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:
intersectCmd.cpp.
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] raySource Starting point for the ray
[in] rayDirection Direction 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] idsSorted should 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] space specifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
[in] maxParam specifies 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] testBothDirections specifies 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] accelParams optional acceleration parameters.
[in] sortHits if 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] hitPoints an array that receives the 3d coordinates of the intersections, in the space specified by the space parameter.
[out] hitRayParams if 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] hitFaces if 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] hitTriangles if 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] hitBary1s if 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] hitBary2s if 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] tolerance numerical 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] ReturnStatus Status 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:
intersectCmd.cpp.
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] faceIds Face IDs to be sorted.
[in,out] triIds Triangle IDs to be sorted.
Status Codes:
MStatus freeCachedIntersectionAccelerator ( )

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

Ordinarily, these structures are cached so that series of calls to the closestIntersection(), allIntersections(), and anyIntersection() method can reuse the same structure. Once the client is finished with these intersection operations, 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] ReturnStatus Status 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 intersection accelerators have been created as instructed by calls to closestIntersection(), allIntersections(), or anyIntersection() with non-NULL accelParams values. These structures are destroyed and re-created when intersection requests with differing acceleration parameters are passed in 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] raySource Starting point for the ray
[in] rayDirection Direction of the ray
[out] points Storage for any points of intersection
[in] tolerance Tolerance used in intersection calculation
[in] space specifies the coordinate system for this operation
[out] polygonIds Storage for the polygon id's that correspond to the points of intersection.
[out] ReturnStatus Status 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 
) 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] toThisPoint Point to be compared
[out] theClosestPoint Storage for the closest point
[out] theNormal Storage for normal at the closest point
[in] space Specifies the coordinate system for this operation
[out] closestPolygon Storage for the closest polygon id
Returns:
Status code
Status Codes:
MStatus getClosestPoint ( const MPoint toThisPoint,
MPoint theClosestPoint,
MSpace::Space  space = MSpace::kObject,
int *  closestPolygon = 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] toThisPoint Point to be compared
[out] theClosestPoint Storage for the closest point
[in] space Specifies the coordinate system for this operation
[out] closestPolygon Storage for the closest polygon id
Returns:
Status code
Status Codes:
MStatus getClosestNormal ( const MPoint toThisPoint,
MVector theNormal,
MSpace::Space  space = MSpace::kObject,
int *  closestPolygon = 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] toThisPoint Point to be compared
[out] theNormal Storage for normal at the closest point
[in] space Specifies the coordinate system for this operation
[out] closestPolygon Storage for the closest polygon id
Returns:
Status code
Status Codes:
Examples:
getPointAndNormal.cpp.
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] instanceNumber The instance number of the mesh to query
[out] shaders Storage for set objects (shader objects)
[out] indices Storage 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:
MStatus getConnectedSetsAndMembers ( unsigned int  instanceNumber,
MObjectArray sets,
MObjectArray comps,
bool  renderableSetsOnly 
) const

Returns all the sets connected to the specified instance of this mesh.

For each set in the "sets" array there is a corresponding entry in the "comps" array which are all the components in that set. If the entire object is in a set, then the corresponding entry in the comps array will have no elements in it.

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

Parameters:
[in] instanceNumber The instance number of the mesh to query
[out] sets Storage for the sets
[out] comps Storage for the components that are in the corresponding set
[in] renderableSetsOnly If true then this method will only return renderable sets
Returns:
Status code
Status Codes:
Examples:
cleanPerFaceAssignmentCmd.cpp.
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] source the mesh to be copied
[in] parentOrOwner the DAG parent or kMeshData the new mesh will belong to
[out] ReturnStatus Status 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:
  • parentOrOwner was not valid
  • if source object is not one of kMeshGeom, kMeshData, kMesh
  • dataMesh or underlying geometry was null
  • Source object was null
  • There was no model present to add the object to
Examples:
testNobjectNode.cpp.
MStatus updateSurface ( )

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

Returns:
Status code
Status Codes:
Examples:
polyPrimitiveCmd.cpp.
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:
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 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] vertexArray Storage for the vertex list
[in] space Specifies the coordinate system for this operation
Returns:
Status code
Status Codes:
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] vertexArray Storage for the vertex list
[in] space Specifies 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.

Parameters:
[out] vertexArray Storage for the vertex list
[in] space Specifies the coordinate system for this operation
Returns:
Status code
Status Codes:
Examples:
testNobjectNode.cpp.
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.

Parameters:
[in] vertexArray Storage for the vertex list
[in] space Specifies 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] vertexCount Vertex count per polygon
[out] vertexList Storage 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] polygonId The polygon to examine
[out] vertexList Storage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned.
Returns:
Status code
Status Codes:
Examples:
meshOpFtyAction.cpp, and objExport.cpp.
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] polygonId The polygon to examine
[in] triangleId The triangle within the polygon to examine (numbered from zero)
[out] vertexList Storage 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] vertexId The object-relative (mesh-relative/global) index of the vertex to be changed
[in] pos The new value for the vertex
[in] space Specifies 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] vertexId The object-relative (mesh-relative/global) index of the vertex to retrieve
[out] pos Storage for the vertex
[in] space Specifies 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] normals Storage for the per-polygon per-vertex normal list
[in] space Specifies 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] normals The normal array to set
[in] space World 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] faceIndex Index of the face of interest
[in] vertexIndex The object-relative (mesh-relative/global) vertex index
[out] normal Storage for the per-polygon-per-vertex normal
[in] space Specifies 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] faceIndex Index of the face (polygon) for which to retrive the normals
[out] normals Storage for the face normals
[in] space Specifies 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] normalCounts Number of normals for each face
[out] normals Storage 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] faceIndex Index of face (polygon) of interest
[out] normals Storage 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] normalIn The normal to set
[in] faceId The face to set it for
[in] vertexId The object-relative (mesh-relative/global) vertex index to set it for
[in] space World space or Object space
[in,out] modifier Since 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] normalIn The normal to set
[in] vertexId The object-relative (mesh-relative/global) vertex index to set it for
[in] space World space or Object space
[in,out] modifier Since 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] normalsIn The normals to set
[in] faceList The faces to set them for
[in] vertexList The object-relative (mesh-relative/global) vertex indices to set them for
[in] space World 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.
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] normalsIn The normals to set
[in] vertexList The object-relative (mesh-relative/global) vertex indices to set them for
[in] space World space or Object space
Returns:
Status code
Status Codes:
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] vertexId The object-relative (mesh-relative/global) vertex index to get the normal for
[out] normal Storage for the per-vertex normal
[in] space Specifies the coordinate system for this operation
Returns:
Status code
Status Codes:
Examples:
meshOpFtyAction.cpp.
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] vertexId The object-relative (mesh-relative/global) vertex index to get the normal for
[in] angleWeighted Defines algorithm used to compute normal
[out] normal Storage for the per-vertex normal
[in] space Specifies 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] angleWeighted Defines algorithm used to compute normal
[out] normals Storage for the per-vertex normals
[in] space Specifies 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] polygonId The polygon (face) to get the normal for
[out] normal Storage for the per-polygon normal
[in] space Specifies 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] normalId Normal to test.
[out] ReturnStatus Status 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] vertexList The 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] faceList The faces to lock normal in
[in] vertexList The 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] vertexList The 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] faceList The faces to unlock normal in
[in] vertexList The 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] faceIndex Index of the face of interest.
[in] vertexIndex The object-relative (mesh-relative/global) vertex index.
[out] ReturnStatus Status 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] tangents Storage for the tangents.
[in] space Specifies the coordinate system for this operation.
[in] uvSet The 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] faceIndex Index of the face of interest.
[in] vertexIndex The object-relative (mesh-relative/global) vertex index.
[out] tangent Storage for the tangent.
[in] space Specifies the coordinate system for this operation.
[in] uvSet The 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] faceIndex Index of the face (polygon) for which to retrive the tangents
[out] tangents Storage for the face tangents
[in] space Specifies the coordinate system for this operation
[in] uvSet The 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] binormals Storage for the binormals.
[in] space Specifies the coordinate system for this operation.
[in] uvSet The 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] faceIndex Index of the face of interest
[in] vertexIndex The object-relative (mesh-relative/global) vertex index
[out] binormal Storage for the binormal.
[in] space Specifies the coordinate system for this operation.
[in] uvSet The 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] faceIndex Index of the face (polygon) for which to retrive the binormals
[out] binormals Storage for the face binormals
[in] space Specifies the coordinate system for this operation
[in] uvSet The uv map set to calculate the binormals aginst.
Returns:
Status code
Status Codes:
bool isPolygonConvex ( int  faceIndex,
MStatus ReturnStatus = NULL 
) const

This method determines if the specified polygon is convex.

Parameters:
[in] faceIndex The polygon to be tested
[out] ReturnStatus Status 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] edgeId The edge to get the vertices for
[out] vertexList Storage for the 2 object-relative vertex indices
Returns:
Status code
Status Codes:
Examples:
meshOpFtyAction.cpp.
bool isEdgeSmooth ( int  edgeId,
MStatus ReturnStatus = NULL 
) const

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

Parameters:
[in] edgeId The edge to be tested
[out] ReturnStatus Status 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] edgeId The edge to set the smoothing information for
[in] smooth If true the edge will be smooth (soft), otherwise the edge 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] edgeIds The list of crease edges ids.
[out] creaseData The 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] edgeIds The list of crease edges ids.
[in] creaseData The data related to the crease edges.
Returns:
Status code
Status Codes:
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] ReturnStatus status 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] faceIds The list of face ids to be made visible/invisible.
[in] makeVisible If true the faces will be made visible. The default is false, which will make them invisible.
Returns:
Status code
Status Codes:
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] vertexIds The list of crease vertices ids.
[out] creaseData The 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] vertexIds The list of crease vertices ids.
[in] creaseData The data related to the crease vertices.
Returns:
Status code
Status Codes:
int numUVSets ( MStatus ReturnStatus = NULL ) const

Returns the number of uv sets for an object.

Parameters:
[out] ReturnStatus return status value
Returns:
The number of uv sets for the object
Status Codes:
Examples:
hwColorPerVertexShader.cpp.
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] uvSetName The 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] modifier Since 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] ReturnStatus Status code. See below.
[in] instances The 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] fromName The name of the uv set to change
[in] toName The name to set the uv set to.
[in,out] modifier Since 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] ReturnStatus Status 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] origName The name of the uv set to change
[in] newName The name to set the uv set to.
[in,out] modifier Since 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] setName Name of the uv set to delete
[in,out] modifier Since 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] currentSelection Since 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:
meshReorderCmd.cpp.
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] setName Name of uv set to make "current"
[in,out] modifier Since 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] currentSelection Since 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:
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] ReturnStatus Status code
[in] instance Instance 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:
MStatus getUVSetNames ( MStringArray setNames ) const

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

Parameters:
[out] setNames Array of uv set names found
Returns:
Status code
Status Codes:
Examples:
GLSLShaderNode.cpp, and meshReorderCmd.cpp.
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] familyNames Array 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] familyName The uv set family name
[out] setNames Array 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] name The set name or set family name
[out] ReturnStatus Status 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] polygonId The polygon ID of the face of interest
[out] setNames The 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] uvSetName Name of uv set to use
[out] textures Texture 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] uvSetName Name of uv set to use
[out] instances Instances 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] uArray The array of u values to be set
[in] vArray The array of v values to be set
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp.
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] uvIds The array of uvIds to set values for
[in] uArray The array of u values to be set
[in] vArray The array of v values to be set
[in] uvSet UV 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] uArray Storage for the u texture coordinate list
[out] vArray Storage for the v texture coordinate list
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp.
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] uvId The element in the uv list to be set
[in] u The new u value that is to be set
[in] v The new v value that is to be set
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
Examples:
splitUVFtyAction.cpp.
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] uvId The element in the uv list to examine
[out] u Storage for the u value
[out] v Storage for the v value
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
Examples:
splitUVFtyAction.cpp.
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] polygonId Search for uv on this face
[out] toThisPoint Space for the point
[in] uvPoint The UV value to try to locate
[in] space The coordinate system to return "toThisPoint" in
[in] uvSet UV set to work with
[in] tolerance tolerance 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 closet to the given point, and return the UV value at that point.

This method is not threadsafe.

Parameters:
[in] pt The point to try to get UV for
[out] uvPoint Space for the UV value
[in] space The coordinate system for this operation
[in] uvSet UV set to work with
[in] closestPolygon polygon 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] polygonId The polygon (face) to examine
[in] vertexIndex The face-relative (local) vertex id to examine
[out] u Storage for the u value
[out] v Storage for the v value
[in] uvSet UV 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] polygonId The polygon (face) to examine
[in] vertexIndex The face-relative (local) vertex id to examine
[out] uvId Storage for the uv index
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
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] polygonId The polygon (face) to map to
[in] vertexIndex The face-relative (local) vertex id of the polygon to map to
[in] uvId The uv entry from the uv list that will be mapped
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp, and splitUVFtyAction.cpp.
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] uvCounts The uv counts for each polygon (face) in the mesh
[in] uvIds The uv indices to be mapped to each polygon-vertex
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
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] uvSet UV set to work with
Returns:
Status code
Status Codes:
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] uvCounts The container for the uv counts for each polygon in the mesh
[out] uvIds The container for the uv indices mapped to each polygon-vertex
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp.
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] uvShellIds The container for the uv shell Ids
[out] nbUvShells The number of UV shells in this UV set.
[in] uvSet UV set to work with
Returns:
Status code
Status Codes:
int numColorSets ( MStatus ReturnStatus = NULL ) const

Returns the number of color sets for an object.

Parameters:
[out] ReturnStatus return status value
Returns:
The number of color sets for the object
Status Codes:
Examples:
hwColorPerVertexShader.cpp.
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] colorSetName The name of the color set to add.
[in,out] modifier Since 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] instances The instance number(s) for which the set should be added, or NULL if the uv-set should be shared by all instances.
[in] ReturnStatus Status code. See below.
Returns:
The resulting name of the color set.
Status Codes:
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] colorSetName Name of the color set to delete
[in,out] modifier Since 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] currentSelection Since 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:
meshReorderCmd.cpp.
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] setName Name of color set to make "current"
[in,out] modifier Since 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] currentSelection Since 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:
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] instance Instance of the mesh whose set we are interested in, or kMFnMeshInstanceUnspecified for the set which is shared across all instances.
[out] ReturnStatus Status 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] setNames Array of color set names found
Returns:
Status code
Status Codes:
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] familyNames Array 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] familyName The color set family name
[out] setNames Array 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] name The set name or set family name
[out] ReturnStatus Status 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] colorSetName Name of color set to use
[out] instances Instances 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] color The color to set
[in] faceIndex The 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] color The color to set
[in] faceIndex The face to set it for
[in] rep The 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] color The color to set
[in] vertexIndex The object-relative (mesh-relative/global) vertex index to set it for
[in,out] modifier Since 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] color The color to set
[in] vertexIndex The object-relative (mesh-relative/global) vertex index to set it for
[in,out] modifier Since 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] rep The 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] color The color to set
[in] faceIndex The face to set it for
[in] vertexIndex The object-relative (mesh_relative/global) vertex index to set it for
[in,out] modifier Since 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] color The color to set
[in] faceIndex The face to set it for
[in] vertexIndex The object-relative (mesh_relative/global) vertex index to set it for
[in,out] modifier Since 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] rep The 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] faceIndex The face to set it for
[in] localVertexIndex The face-relative (local) vertex index to set it for
[in] color The color to set
[in,out] modifier Since 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] faceIndex The face to set it for
[in] localVertexIndex The face-relative (local) vertex index to set it for
[in] color The color to set
[in,out] modifier Since 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] rep The 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] colors The colors to set
[in] faceList The 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] colors The colors to set
[in] faceList The faces to set it for
[in] rep The 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] colors The colors to set
[in] vertexList The vertices to set it for
[in,out] modifier Since 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:
Examples:
meshReorderCmd.cpp.
MStatus setVertexColors ( MColorArray colors,
MIntArray vertexList,
MDGModifier modifier,
MColorRepresentation  rep 
)

Set color of specified channels for these vertices.

Parameters:
[in] colors The colors to set
[in] vertexList The vertices to set it for
[in,out] modifier Since 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] rep The 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] colors The colors to set
[in] faceList The faces to set it for
[in] vertexList The object-relative (mesh-relative/global) vertex indices to set it for
[in,out] modifier Since 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] colors The colors to set
[in] faceList The faces to set it for
[in] vertexList The object-relative (mesh-relative/global) vertex indices to set it for
[in,out] modifier Since 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] rep The 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] faceList The faces to remove color from
Returns:
Status code
Status Codes:
MStatus removeVertexColors ( MIntArray vertexList )

Remove color from these vertices.

Parameters:
[in] vertexList The 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] faceList The faces to remove color for
[in] vertexList The 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] colors Storage for the colors to be returned.
[in] colorSet Color set name
[in] defaultUnsetColor Default Unset color
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp.
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] colors Storage for the colors to be returned.
[in] colorSet Color set name
[in] defaultUnsetColor Default 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] faceIndex The face to look for
[in] localVertexIndex The face-relative (local) vertex id to look for
[out] colorIndex Storage for the color index to be returned.
[in] colorSet Color 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] colorArray The array of color values to be set
[in] colorSet The color set to work with
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp.
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] colorArray The array of color values to be set
[in] colorSet The color set to work with
[in] rep The 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] colorIds The array of colorIds to set values for
[in] colorArray The array of color values to be set
[in] colorSet Color 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] colorIds The array of colorIds to set values for
[in] colorArray The array of color values to be set
[in] colorSet Color set to work with
[in] rep The 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] colorArray Storage for the color values list
[in] colorSet Color set to work with
[in] defaultUnsetColor Default unset color
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp.
MStatus getColorIndex ( int  faceIndex,
int  localVertexIndex,
int &  colorIndex,
const MString colorSet = NULL 
)

Get an index into the array returned by getColors.

Parameters:
[in] faceIndex The face to look for
[in] localVertexIndex The face-relative (local) vertex id to look for
[out] colorIndex Storage for the color index to be returned.
[in] colorSet Color set to work with
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp.
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] colorId The element in the color list to be set
[in] color The new color value that is to be set
[in] colorSet Color 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] colorId The element in the color list to be set
[in] color The new color value that is to be set
[in] colorSet Color set to work with
[in] rep The 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] colorId The element in the color list to examine
[out] color Storage for the color value
[in] colorSet Color set to work with
[in] defaultUnsetColor default 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] polygonId The polygon (face) to map to
[in] vertexIndex The face-relative (local) vertex id of the polygon to map to
[in] colorId The color entry from the color list that will be mapped
[in] colorSet Color 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] colorIds The color indices to be mapped to each polygon-vertex
[in] colorSet Color set to work with
Returns:
Status code
Status Codes:
Examples:
meshReorderCmd.cpp.
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] colorSet Color 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] ReturnStatus The 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] enable True 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).
int getHoles ( MIntArray holeInfoArray,
MIntArray holeVertexArray,
MStatus ReturnStatus = NULL 
)

Retrieves a list of the holes in the polygon.

Parameters:
[out] holeInfoArray Receives 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] holeVertexArray Receives 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] ReturnStatus Status code.
Returns:
The number of holes in the mesh.
Status Codes:
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] polygonId The polygon (face) to examine
[out] ReturnStatus The 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] blindDataId The blind data id to check for
[out] ReturnStatus Status Code
Returns:
true: Id in use, false: id not in use
Status Codes:
Examples:
blindDataMesh.cpp.
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] blindDataId The desired id for the new blind data type
[in] longNames Attribute long names
[in] shortNames Attribute short names
[in] formatNames Names of the data types.
Returns:
Status code
Status Codes:
Examples:
blindDataMesh.cpp.
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] compID The component to check for blind data om When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[out] ReturnStatus Status 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[out] ReturnStatus Status 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] compID The component to check for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[out] ReturnStatus Status 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] compType The component type e.g. MFn::kMeshVertComponent
[out] ReturnStatus Status 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] compType The component type e.g. MFn::kMeshVertComponent
[out] blindDataIds space 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] blindDataId The blind data id to check for
[out] longNames Space for the attribute long names
[out] shortNames Space for the attribute short names
[out] formatNames Space 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] faceIndex The face index to look for
[in] vertexIndex The object-relative (mesh-relative/global) vertex index
[out] blindDataIndex The 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] blindDataIndex The component index for face vertex blind data storage to decompose
[in] faceIndex The corresponding face index to be returned
[out] vertexIndex The 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] compID The component to get for blind data on. When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] data Space 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] compIDs Space 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] data Space 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] compID The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] data Space 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] compIDs Space 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] data Space 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] compID The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] data Space 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] compIDs Space 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] data Space 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] compID The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] data Space 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] compIDs Space 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] data Space 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] compID The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] ReturnStatus Status 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] compIDs Space 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] data Space 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] compID The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] ReturnStatus Status 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The blind data id to check for
[in] attrName The attribute name
[out] compIDs Space 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] data Space 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] compID The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data The 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] compID The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data The 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] compID The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute value
Returns:
Status code
Status Codes:
Examples:
blindDataMesh.cpp.
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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data The 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] compID The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data The 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] compID The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data The 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] compID The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute 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] compIDs The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data The 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] compID The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The desired id for the new blind data type
[in] attrName Attribute name
[in] data Attribute value as a char string
[in] length Length 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] compID The component to clear the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The id for the blind data to be cleared
[in] attrName Attribute 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The id for the blind data to be cleared
[in] attrName The 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] compType The 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] compID The component to clear the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
[in] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The 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] compType The component type e.g. MFn::kMeshVertComponent
[in] blindDataId The id for the blind data to be cleared
Returns:
Status code
Status Codes:
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] check true 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.

Parameters:
[in] numVertices number of vertices
[in] numPolygons number of polygons
[in] vertexArray point (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] polygonCounts array 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] polygonConnects array 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:
  • Array length does not match given item count
  • parentOrOwner was not valid
  • There was no model present to add the object to
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] source the mesh to be copied
Returns:
  • MS::kInvalidDataType source object must be one of kMeshGeom, kMeshData, kMesh
  • MS::kShapeHasNoGeometry dataMesh or underlying geometry was null
  • MS::kObjectDoesNotExist Source object was null
  • MS::kModelActive There was no model present to add the object to
  • MS::kInsufficientMemory Insufficient memory to complete this method
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] colorSetName The name of the color set to add.
[in,out] modifier Since 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] ReturnStatus Status code. See below.
Returns:
The resulting name of the color set.
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] ReturnStatus Status code. See below.
Returns:
  • Name of the "current" color set, if any.
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] parentOrOwner parent of the polygon that will be created
[out] ReturnStatus Status 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:
  • parentOrOwner was not valid
  • There was no model present to add the object to
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] vertexArray array of ordered vertices that make up the polygon
[in] polyTolerance specifies 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] mergeVertices If true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
[in] pointTolerance specifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
[in] forceGeometry if true handle no-manifold topology regardless of non connectivity
[in] parentOrOwner the DAG parent or kMeshData the new surface will belong to
[out] ReturnStatus status 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] raySource Starting point for the ray
[in] rayDirection Direction of the ray
[out] points Storage for any points of intersection
[out] ReturnStatus Status 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] raySource Starting point for the ray
[in] rayDirection Direction of the ray
[out] points Storage for any points of intersection
[out] ReturnStatus Status 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] blindDataId The blind data id to check for
[out] longNames Space for the attribute long names
[out] shortNames Space 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] uvSetName The 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] modifier Since 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] instances The 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:
meshReorderCmd.cpp.
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] fromName The name of the uv set to change
[in] toName The 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] modifier Since 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] setName Name of the "current" uv set, if any.
[in] instance Instance 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:
meshReorderCmd.cpp, and splitUVFtyAction.cpp.
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] colorSetName The 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] modifier Since 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] instances The 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:
meshReorderCmd.cpp.
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] colorSetName The 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] modifier Since 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] clamped The color set stores values in 0 to 1 range if true. no range limit if false
[in] rep The color set stores RGB, RGBA, or Alpha
[in] instances The 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] setName Name of the "current" color set, if any.
[in] instance Instance 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:
Examples:
meshReorderCmd.cpp.
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

MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh
MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh MFnMesh