C++ API Reference
|
Polygonal surface function set. More...
#include <MFnMesh.h>
Public Member Functions | |
virtual MFn::Type | type () const |
Function set type. More... | |
virtual | ~MFnMesh () |
Destructor. More... | |
MFnMesh () | |
Default constructor. | |
MFnMesh (MObject &object, MStatus *ReturnStatus=NULL) | |
Constructor. More... | |
MFnMesh (const MDagPath &object, MStatus *ret=NULL) | |
Constructor. More... | |
MObject | create (int numVertices, int numPolygons, const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface. More... | |
MObject | create (int numVertices, int numPolygons, const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface. More... | |
MObject | create (int numVertices, int numPolygons, const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, bool storeDoubles, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface. More... | |
MObject | create (int numVertices, int numPolygons, const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray &uArray, const MFloatArray &vArray, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new polygonal mesh given an array of vertices, polygon connection information, UV information, and sets this function set to operate on the new surface. More... | |
MObject | create (int numVertices, int numPolygons, const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray &uArray, const MFloatArray &vArray, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new polygonal mesh given an array of vertices, polygon connection information, UV information, and sets this function set to operate on the new surface. More... | |
MObject | create (const MFloatPointArray &vertexArray, const MIntArray &edges, const MIntArray &edgeConnectsCount, const MIntArray &edgeFaceConnects, const MIntArray &edgeFaceDesc, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new polygonal mesh given an array of vertices, edge information, polygon connection information, UV and sets this function set to operate on the new surface. More... | |
MObject | create (const MPointArray &vertexArray, const MIntArray &edges, const MIntArray &edgeConnectsCount, const MIntArray &edgeFaceConnects, const MIntArray &edgeFaceDesc, bool storeDoubles, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Introduced in 2019.0 More... | |
MObject | generateSmoothMesh (MObject parentOrOwner=MObject::kNullObj, MMeshSmoothOptions *options=NULL, MStatus *ReturnStatus=NULL) |
Creates a new polygonal mesh using either the Smooth Mesh Preview attributes of this mesh or a set of options specified in an MMeshSmoothOptions object. More... | |
MStatus | getSmoothMeshDisplayOptions (MMeshSmoothOptions &options) const |
Retrieve the current display smoothing options for the mesh. More... | |
MStatus | setSmoothMeshDisplayOptions (const MMeshSmoothOptions &options) |
Sets the current display smoothing options for the mesh. More... | |
MObject | addPolygon (const MPointArray &vertexArray, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Adds a new polygon to this polygonal mesh. More... | |
MObject | addPolygon (const MPointArray &vertexArray, int &faceIndex, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Adds a new polygon to this polygonal mesh. More... | |
MObject | addPolygon (const MPointArray &vertexArray, const MIntArray &loopCounts, int &faceIndex, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Adds a new polygon to this polygonal mesh. More... | |
MStatus | addHoles (int faceIndex, const MPointArray &vertexArray, const MIntArray &loopCounts, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance) |
Adds holes to a mesh polygon. More... | |
MStatus | deleteFace (int index, MDGModifier *modifier=NULL) |
Delete this face. More... | |
MStatus | deleteEdge (int index, MDGModifier *modifier=NULL) |
Delete this edge. More... | |
MStatus | deleteVertex (int index, MDGModifier *modifier=NULL) |
Delete this vertex. More... | |
MStatus | split (MIntArray &placements, MIntArray &edgeList, MFloatArray &edgeFactors, MFloatPointArray &internalPoints) |
This function splits a set of edges and faces in a continuous manner. More... | |
MStatus | subdivideFaces (MIntArray &faceList, int divisionCount) |
This function subdivides multiple faces. More... | |
MStatus | subdivideEdges (MIntArray &edgeList, int divisionCount) |
This function subdivides edges at regular intervals. More... | |
MStatus | extrudeFaces (MIntArray &faceList, int extrusionCount, MFloatVector *translation, bool extrudeTogether, float thickness=0.0f, float offset=0.0f) |
This function extrudes a set of faces. More... | |
MStatus | extrudeEdges (MIntArray &edgeList, int extrusionCount, MFloatVector *translation, bool extrudeTogether, float thickness=0.0f, float offset=0.0f) |
This function extrudes edges. More... | |
MStatus | duplicateFaces (MIntArray &faceList, MFloatVector *translation) |
This function duplicates a set of faces and detaches them from the rest of the mesh. More... | |
MStatus | extractFaces (MIntArray &faceList, MFloatVector *translation) |
This function detaches a set of faces from the mesh so that the resulting mesh will contain one more independant piece of geometry and leaves a hole where the faces use to be. More... | |
MStatus | collapseFaces (MIntArray &faceList) |
This function collapse faces into vertices. More... | |
MStatus | collapseEdges (MIntArray &edgeList) |
This function collapse edges into vertices. More... | |
int | numVertices (MStatus *ReturnStatus=NULL) const |
Returns the number of vertices in the vertex list for this mesh. More... | |
int | numEdges (MStatus *ReturnStatus=NULL) const |
Returns the number of edges for this mesh. More... | |
int | numPolygons (MStatus *ReturnStatus=NULL) const |
Returns the number of polygons for this mesh. More... | |
int | numFaceVertices (MStatus *ReturnStatus=NULL) const |
Returns the number of face-vertices for this mesh. More... | |
int | polygonVertexCount (int polygonId, MStatus *ReturnStatus=NULL) const |
Returns the number of vertices for the specified polygon. More... | |
int | numUVs (MStatus *ReturnStatus=NULL) const |
Returns the number of texture (uv) coordinates for this mesh. More... | |
int | numUVs (const MString &uvSet, MStatus *ReturnStatus=NULL) const |
Returns the number of texture (uv) coordinates for this mesh. More... | |
int | numColors (MStatus *ReturnStatus=NULL) const |
Returns the number of (vertex) color for this mesh. More... | |
int | numColors (const MString &colorSet, MStatus *ReturnStatus=NULL) const |
Returns the number of colors (vertex data) for this mesh. More... | |
int | numNormals (MStatus *ReturnStatus=NULL) const |
Returns the number of per-polygon per-vertex normals for this mesh. More... | |
bool | hasColorChannels (const MString &colorSet, MStatus *ReturnStatus=NULL) const |
This method returns if the color set has RGB components. More... | |
bool | hasAlphaChannels (const MString &colorSet, MStatus *ReturnStatus=NULL) const |
This method returns true if the color set has Alpha component. More... | |
MColorRepresentation | getColorRepresentation (const MString &colorSet, MStatus *ReturnStatus=NULL) const |
This method returns the color representation (RGB/RGBA/A) of a color set. More... | |
bool | isColorClamped (const MString &colorSet, MStatus *ReturnStatus=NULL) const |
This method returns if the color set has its R,G,B,and A components clamped in the range from 0 to 1. More... | |
MStatus | setIsColorClamped (const MString &colorSet, bool clamped) |
Set the color set to be clamped. More... | |
MStatus | getTriangles (MIntArray &triangleCounts, MIntArray &triangleVertices) const |
Returns the number of triangles for every polygon face and the vertex Ids of each triangle vertex. More... | |
MStatus | getTriangleOffsets (MIntArray &triangleCounts, MIntArray &triangleIndices) const |
Returns the number of triangles for every polygon face and the offset into the vertex indices array for each triangle vertex (see getVertices()). More... | |
MStatus | booleanOp (BoolOperation op, MFnMesh &mesh1, MFnMesh &mesh2) |
Deprecated in 2019.0 More... | |
MStatus | booleanOps (BoolOperation op, const MObjectArray &meshes, bool useLegacy=false, BoolClassification classification=kNormalClassification) |
Changed in 2023.0 More... | |
bool | closestIntersection (const MFloatPoint &raySource, const MFloatVector &rayDirection, const MIntArray *faceIds, const MIntArray *triIds, bool idsSorted, MSpace::Space space, float maxParam, bool testBothDirections, MMeshIsectAccelParams *accelerator, MFloatPoint &hitPoint, float *hitRayParam, int *hitFace, int *hitTriangle, float *hitBary1, float *hitBary2, float tolerance=1e-6, MStatus *ReturnStatus=NULL) |
Finds the closest intersection of a ray starting at raySource and travelling in rayDirection with the mesh. More... | |
bool | anyIntersection (const MFloatPoint &raySource, const MFloatVector &rayDirection, const MIntArray *faceIds, const MIntArray *triIds, bool idsSorted, MSpace::Space space, float maxParam, bool testBothDirections, MMeshIsectAccelParams *accelerator, MFloatPoint &hitPoint, float *hitRayParam, int *hitFace, int *hitTriangle, float *hitBary1, float *hitBary2, float tolerance=1e-6, MStatus *ReturnStatus=NULL) |
Finds any intersection of a ray starting at raySource and travelling in rayDirection with the mesh. More... | |
bool | allIntersections (const MFloatPoint &raySource, const MFloatVector &rayDirection, const MIntArray *faceIds, const MIntArray *triIds, bool idsSorted, MSpace::Space space, float maxParam, bool testBothDirections, MMeshIsectAccelParams *accelerator, bool sortHits, MFloatPointArray &hitPoints, MFloatArray *hitRayParams, MIntArray *hitFaces, MIntArray *hitTriangles, MFloatArray *hitBary1, MFloatArray *hitBary2, float tolerance=1e-6, MStatus *ReturnStatus=NULL) |
Finds all intersections of a ray starting at raySource and travelling in rayDirection with the mesh. More... | |
MStatus | sortIntersectionFaceTriIds (MIntArray *faceIds, MIntArray *triIds) |
Convenience routine for sorting faceIds or face/triangle ids before passing them into the closestIntersection(), allIntersections(), or anyIntersection() methods. More... | |
MStatus | freeCachedIntersectionAccelerator () |
If the mesh has a cached accelerator structure, then this routine forces it to be deleted. More... | |
MString | cachedIntersectionAcceleratorInfo (MStatus *ReturnStatus=NULL) |
Retrieves a string that describes the intersection acceleration structure for this object, if any. More... | |
bool | intersect (const MPoint &raySource, const MVector &rayDirection, MPointArray &points, double tolerance=kMFnMeshPointTolerance, MSpace::Space space=MSpace::kObject, MIntArray *polygonIds=NULL, MStatus *ReturnStatus=NULL) const |
Determines whether the given ray intersects this polygon and if so, returns the points of intersection. More... | |
MStatus | getClosestPointAndNormal (const MPoint &toThisPoint, MPoint &theClosestPoint, MVector &theNormal, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL, MMeshIsectAccelParams *accelParams=NULL) const |
Returns the closest point on this surface to the given point. More... | |
MStatus | getClosestPoint (const MPoint &toThisPoint, MPoint &theClosestPoint, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL, MMeshIsectAccelParams *accelerator=NULL) const |
Returns the closest point on this surface to the given point. More... | |
MStatus | getClosestNormal (const MPoint &toThisPoint, MVector &theNormal, MSpace::Space space=MSpace::kObject, int *closestPolygon=NULL, MMeshIsectAccelParams *accelerator=NULL) const |
Returns the closest point on this surface to the given point. More... | |
MStatus | getClosestUVs (const float2 &toThisUVPoint, MIntArray &uvIds, const MString *uvSet=NULL) const |
Returns the IDs of the UVs on this surface which are nearest in uv space to the given uv set and coordinate. More... | |
MStatus | intersectFaceAtUV (const float2 &toThisUVPoint, int &faceId, const MString *uvSet=NULL) const |
Returns ID of the intersected face at given uv set and coordinate. More... | |
MStatus | getConnectedShaders (unsigned int instanceNumber, MObjectArray &shaders, MIntArray &indices) const |
Returns all the shaders (sets) connected to the specified instance of this mesh, as well as an array of polygon/shader assignments. More... | |
MObject | copy (const MObject &source, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
This method creates a copy of a given source mesh. More... | |
MStatus | updateSurface () |
Signal that this polygonal mesh has changed and needs to redraw itself. More... | |
MStatus | syncObject () |
If a non-api operation happens that many have changed the underlying Maya object wrapped by this api object, make sure that the api object references a valid maya object. More... | |
const float * | getRawPoints (MStatus *) const |
This method returns a pointer to the internal vertex list for this mesh. More... | |
const double * | getRawDoublePoints (MStatus *) const |
This method returns a pointer to the internal vertex list for this mesh. More... | |
const float * | getRawNormals (MStatus *) const |
This method returns a pointer to the internal normal list for this mesh. More... | |
const float * | getRawUVs (MStatus *, const MString *uvSet=NULL) const |
Introduced in 2023.0 More... | |
MStatus | getPoints (MFloatPointArray &vertexArray, MSpace::Space space=MSpace::kObject) const |
This method copies the vertex list for this mesh into the given point array. More... | |
MStatus | getPoints (MPointArray &vertexArray, MSpace::Space space=MSpace::kObject) const |
This method copies the vertex list for this mesh into the given point array. More... | |
MStatus | setPoints (MFloatPointArray &vertexArray, MSpace::Space space=MSpace::kObject) |
This method copies the points in the given point array to the vertices of this polygon. More... | |
MStatus | setPoints (MPointArray &vertexArray, MSpace::Space space=MSpace::kObject) |
This method copies the points in the given point array to the vertices of this mesh. More... | |
MStatus | getVertices (MIntArray &vertexCount, MIntArray &vertexList) const |
This method retrieves the object-relative (mesh-relative/global) vertex indices for all polygons. More... | |
MStatus | getPolygonVertices (int polygonId, MIntArray &vertexList) const |
This method retrieves the object-relative (mesh-relative/global) vertex indices for the specified polygon. More... | |
MStatus | getPolygonTriangleVertices (int polygonId, int triangleId, int triangleVertices[3]) const |
This method retrieves the object-relative (mesh-relative/global) vertex indices for the specified triangle in the specified polygon. More... | |
MStatus | setPoint (int vertexId, const MPoint &pos, MSpace::Space space=MSpace::kObject) |
Sets the position of specified vertex in the vertex list for this mesh. More... | |
MStatus | getPoint (int vertexId, MPoint &pos, MSpace::Space space=MSpace::kObject) const |
Get the position of the specified vertex in this mesh's vertex list. More... | |
MStatus | getNormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const |
This method copies the normal list for this mesh into the given array. More... | |
MStatus | setNormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) |
Set the normal array (user normals) More... | |
MStatus | getFaceVertexNormal (int faceIndex, int vertexIndex, MVector &normal, MSpace::Space space=MSpace::kObject) const |
Return a per-vertex-per-face normal for a given face (polygon) and given vertex. More... | |
MStatus | getFaceVertexNormals (int faceIndex, MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const |
Return all per-vertex-per-face normals for a given face. More... | |
MStatus | getNormalIds (MIntArray &normalIdCounts, MIntArray &normalIds) const |
Get normal indices for all vertices of all faces. More... | |
MStatus | getFaceNormalIds (int faceIndex, MIntArray &normals) const |
Return normal indices for all vertices for a given face. More... | |
MStatus | setFaceVertexNormal (MVector &normal, int faceIndex, int vertexIndex, MSpace::Space space=MSpace::kObject, MDGModifier *modifier=NULL) |
Set Normal for this face/vertex pair. More... | |
MStatus | setVertexNormal (MVector &normal, int vertexIndex, MSpace::Space space=MSpace::kObject, MDGModifier *modifier=NULL) |
Set Shared Normal for this vertex. More... | |
MStatus | setFaceVertexNormals (MVectorArray &normalArray, MIntArray &faceList, MIntArray &vertexList, MSpace::Space space=MSpace::kObject) |
Set Normals for the given face/vertex pairs. More... | |
MStatus | setVertexNormals (MVectorArray &normalArray, MIntArray &vertexList, MSpace::Space space=MSpace::kObject) |
Set Shared Normals for these vertices. More... | |
MStatus | getVertexNormal (int vertexId, MVector &normal, MSpace::Space space=MSpace::kObject) const |
Deprecated in 2019.0 More... | |
MStatus | getVertexNormal (int vertexId, bool angleWeighted, MVector &normal, MSpace::Space space=MSpace::kObject) const |
Return the normal at the given vertex. More... | |
MStatus | getVertexNormals (bool angleWeighted, MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject) const |
Return all vertex normals. More... | |
MStatus | getPolygonNormal (int polygonId, MVector &normal, MSpace::Space space=MSpace::kObject) const |
Return the normal at the given polygon. More... | |
bool | isNormalLocked (int normalId, MStatus *ReturnStatus=NULL) const |
Test if the normal for a face/vertex pairs is locked (user defined). More... | |
MStatus | lockVertexNormals (MIntArray &vertexList) |
Lock Shared Normals for these vertices. More... | |
MStatus | lockFaceVertexNormals (MIntArray &faceList, MIntArray &vertexList) |
Lock Normals for these face/vertex pairs. More... | |
MStatus | unlockVertexNormals (MIntArray &vertexList) |
Unlock Shared Normals for these vertices. More... | |
MStatus | unlockFaceVertexNormals (MIntArray &faceList, MIntArray &vertexList) |
Unlock Normals for these face/vertex pairs. More... | |
int | getTangentId (int faceIndex, int vertexIndex, MStatus *ReturnStatus=NULL) const |
Return the tangent index for a given face vertex. More... | |
MStatus | getTangents (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const |
Return the tangent vectors for all face vertices. More... | |
MStatus | getFaceVertexTangent (int faceIndex, int vertexIndex, MVector &tangent, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const |
Return the normalized tangent vector at a given face vertex. More... | |
MStatus | getFaceVertexTangents (int faceIndex, MFloatVectorArray &tangents, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const |
Return all per-vertex-per-face tangents for a given face. More... | |
MStatus | getBinormals (MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const |
Return the binormal vectors for all face vertices. More... | |
MStatus | getFaceVertexBinormal (int faceIndex, int vertexIndex, MVector &normal, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const |
Return the binormal vector at a given face vertex. More... | |
MStatus | getFaceVertexBinormals (int faceIndex, MFloatVectorArray &normals, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL) const |
Return all per-vertex-per-face binormals for a given face. More... | |
bool | isRightHandedTangent (int tangentId, const MString *uvSetName=NULL, MStatus *ReturnStatus=NULL) const |
Returns true if the normal, tangent and binormal form a right handed coordinate system. More... | |
bool | isPolygonConvex (int faceIndex, MStatus *ReturnStatus=NULL) const |
This method determines if the specified polygon is convex. More... | |
BorderInfo | edgeBorderInfo (int edgeId, unsigned int setId=-1, MStatus *ReturnStatus=NULL) const |
Introduced in 2023.0 More... | |
MStatus | getUVBorderEdges (unsigned int setId, MIntArray &edgeList) const |
Introduced in 2023.0 More... | |
MStatus | getEdgeVertices (int edgeId, int2 &vertexList) const |
This method retrieves the object-relative (mesh-relative/global) vertex indices corresponding to the specified edge. More... | |
bool | isEdgeSmooth (int edgeId, MStatus *ReturnStatus=NULL) const |
This method determines if the specified edge is smooth (soft). More... | |
MStatus | setEdgeSmoothing (int edgeId, bool smooth=true) |
This method sets the specified edge to be hard or smooth (soft). More... | |
MStatus | setEdgeSmoothings (const MIntArray &edgeIds, const MIntArray &smooths) |
This method sets the specified edges to be hard or smooth (soft). More... | |
MStatus | cleanupEdgeSmoothing () |
This method updates the mesh after setEdgeSmoothing has been done. More... | |
MStatus | getCreaseEdges (MUintArray &edgeIds, MDoubleArray &creaseData) const |
This method returns the crease edges of the mesh, and also the crease data associated with those edges. More... | |
MStatus | setCreaseEdges (const MUintArray &edgeIds, const MDoubleArray &creaseData) |
This method sets the specified edges of the mesh as crease edges. More... | |
MUintArray | getInvisibleFaces (MStatus *ReturnStatus=NULL) const |
This method returns the invisible faces of the mesh. More... | |
MStatus | setInvisibleFaces (const MUintArray &faceIds, bool makeVisible=false) |
This method sets the specified faces of the mesh to be visible or invisible. More... | |
MStatus | getCreaseVertices (MUintArray &vertexIds, MDoubleArray &creaseData) const |
This method returns the crease vertices of the mesh, and also the crease data associated with those vertices. More... | |
MStatus | setCreaseVertices (const MUintArray &vertexIds, const MDoubleArray &creaseData) |
This method sets the specified vertices of the mesh as crease vertices. More... | |
int | numUVSets (MStatus *ReturnStatus=NULL) const |
Returns the number of uv sets for an object. More... | |
MString | createUVSetWithName (const MString &uvSetName, MDGModifier *modifier=NULL, MStatus *ReturnStatus=NULL, const MUintArray *instances=NULL) |
Create a new empty uv set for this mesh. More... | |
MString | copyUVSetWithName (const MString &fromName, const MString &toName, MDGModifier *modifier=NULL, MStatus *ReturnStatus=NULL) |
Copies a uv set from one to another for this mesh. More... | |
MStatus | renameUVSet (const MString &origName, const MString &newName, MDGModifier *modifier=NULL) |
Renames a uv set from one name to another for this mesh. More... | |
MStatus | deleteUVSet (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL) |
Deletes a named uv set from the object. More... | |
MStatus | setCurrentUVSetName (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL) |
Set the "current" uv set for this object. More... | |
MString | currentUVSetName (MStatus *ReturnStatus=NULL, int instance=kMFnMeshInstanceUnspecified) const |
Get the name of the "current" uv set. More... | |
MStatus | getUVSetNames (MStringArray &setNames) const |
Get the names of all of the uv sets on this object. More... | |
MStatus | getUVSetFamilyNames (MStringArray &familyNames) const |
Get the names of all of the uv set families on this object. More... | |
MStatus | getUVSetsInFamily (const MString &familyName, MStringArray &setNames) const |
Get the names of the uv sets that belong to this set family. More... | |
bool | isUVSetPerInstance (const MString &name, MStatus *ReturnStatus=NULL) const |
Return true if this set is per-instance, and false if it is shared across all instances. More... | |
MStatus | getFaceUVSetNames (int polygonId, MStringArray &setNames) const |
This method returns the list of UV sets mapped to a face. More... | |
MStatus | getAssociatedUVSetTextures (const MString uvSetName, MObjectArray &textures) const |
Get a list of texture nodes which are using a given uv set. More... | |
MStatus | getAssociatedUVSetInstances (const MString &uvSetName, MIntArray &instances) const |
Get a list of the instance numbers associated with this uv map. More... | |
MStatus | setUVs (const MFloatArray &uArray, const MFloatArray &vArray, const MString *uvSet=NULL) |
Sets all of the texture coordinates (uv's) for this mesh. More... | |
MStatus | setSomeUVs (const MIntArray &uvIds, const MFloatArray &uArray, const MFloatArray &vArray, const MString *uvSet=NULL) |
Sets the specified texture coordinates (UV's) for this mesh. More... | |
MStatus | getUVs (MFloatArray &uArray, MFloatArray &vArray, const MString *uvSet=NULL) const |
This method copies the texture coordinate list for this mesh into the given uv arrays. More... | |
MStatus | setUV (int uvId, float u, float v, const MString *uvSet=NULL) |
Sets the specified texture coordinate. More... | |
MStatus | getUV (int uvId, float &u, float &v, const MString *uvSet=NULL) const |
Get the value of the specified texture coordinate from this mesh's uv list. More... | |
MStatus | getPointAtUV (int polygonId, MPoint &theClosestPoint, float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, float tolerance=0.0) |
Return the position of the point at the given UV value in the current polygon. More... | |
MStatus | getPointsAtUV (MIntArray &polygonIds, MPointArray &points, const float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, float tolerance=kMFnMeshTolerance) const |
Return the positions of the points at the given UV value on the mesh. More... | |
MStatus | getUVAtPoint (MPoint &pt, float2 &uvPoint, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, int *closestPolygon=NULL) |
Find the point closest to the given point, and return the UV value at that point. More... | |
MStatus | getAxisAtPoint (MPoint &pt, MVector &normal, MVector &uTangent, MVector &vTangent, MSpace::Space space=MSpace::kObject, const MString *uvSet=NULL, int *closestPolygon=NULL) |
Find the point on the mesh which is closest to the given point, and return the axis at that point. More... | |
MStatus | getPolygonUV (int polygonId, int vertexIndex, float &u, float &v, const MString *uvSet=NULL) const |
Get the value of the specified texture coordinate for a vertex in a polygon. More... | |
MStatus | getPolygonUVid (int polygonId, int vertexIndex, int &uvId, const MString *uvSet=NULL) const |
Get the id of the specified texture coordinate for a vertex in a polygon. More... | |
MStatus | assignUV (int polygonId, int vertexIndex, int uvId, const MString *uvSet=NULL) |
Maps a texture coordinate to a specified vertex of a polygon. More... | |
MStatus | assignUVs (const MIntArray &uvCounts, const MIntArray &uvIds, const MString *uvSet=NULL) |
This method maps all texture coordinates for the mesh. More... | |
MStatus | clearUVs (const MString *uvSet=NULL) |
This method clears out all texture coordinates for the mesh, and leaves behind an empty UVset. More... | |
MStatus | getAssignedUVs (MIntArray &uvCounts, MIntArray &uvIds, const MString *uvSet=NULL) const |
Get assigned UVs. More... | |
MStatus | getUvShellsIds (MIntArray &uvShellIds, unsigned int &nbUvShells, const MString *uvSet=NULL) const |
Constructs an array of unique integer for each UV shell. More... | |
MStatus | getMeshShellsIds (MFn::Type compType, MIntArray &meshShellIds, unsigned int &nbMeshShells) const |
Introduced in 2023.0 More... | |
MStatus | getPinUVs (MUintArray &pinIds, MDoubleArray &pinData, const MString *uvSet=NULL) const |
This method returns the pin uvs of the mesh, and also the pin data associated with those uvs. More... | |
MStatus | setPinUVs (const MUintArray &pinIds, const MDoubleArray &pinData, const MString *uvSet=NULL) |
This method sets the specified uvs of the mesh as "pinned" uvs, a "pinned" uv is one which should not be modified. More... | |
bool | isPolygonUVReversed (int polygonId, const MString *uvSet=NULL, MStatus *ReturnStatus=NULL) const |
This method determines if the winding order of texture coordinates (uv's) for specified polygon are reversed (clockwise) More... | |
int | numColorSets (MStatus *ReturnStatus=NULL) const |
Returns the number of color sets for an object. More... | |
MString | createColorSetWithName (const MString &colorSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL, MStatus *ReturnStatus=NULL) |
Create a new empty color set for this mesh. More... | |
MStatus | deleteColorSet (const MString &colorSetName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL) |
Deletes a named color set from the object. More... | |
MStatus | setCurrentColorSetName (const MString &setName, MDGModifier *modifier=NULL, MSelectionList *currentSelection=NULL) |
Set the "current" or "working" color set for this object. More... | |
MString | currentColorSetName (int instance=kMFnMeshInstanceUnspecified, MStatus *ReturnStatus=NULL) const |
Get the name of the "current" or "working" color set. More... | |
MStatus | getColorSetNames (MStringArray &setNames) const |
Get the names of all of the colors sets on this object. More... | |
MStatus | getColorSetFamilyNames (MStringArray &familyNames) const |
Get the names of all of the color set families on this object. More... | |
MStatus | getColorSetsInFamily (const MString &familyName, MStringArray &setNames) const |
Get the names of the color sets that belong to this set family. More... | |
bool | isColorSetPerInstance (const MString &name, MStatus *ReturnStatus=NULL) const |
Return true if this color set is per-instance, and false if it is shared across all instances. More... | |
MStatus | getAssociatedColorSetInstances (const MString &setName, MIntArray &instances) const |
Get a list of the instance numbers associated with this color map. More... | |
MStatus | setFaceColor (MColor &color, int index) |
Set vertex-face Color for all vertices on this face. More... | |
MStatus | setFaceColor (MColor &color, int index, MColorRepresentation rep) |
Set vertex-face Color of specified channels for all vertices on this face. More... | |
MStatus | setVertexColor (MColor &color, int index, MDGModifier *modifier=NULL) |
Set color for this vertex. More... | |
MStatus | setVertexColor (MColor &color, int index, MDGModifier *modifier, MColorRepresentation rep) |
Set color of specified channels for this vertex. More... | |
MStatus | setFaceVertexColor (MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier=NULL) |
Set color for this vertex in this face. More... | |
MStatus | setFaceVertexColor (MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier, MColorRepresentation rep) |
Set color of specified channels for this vertex in this face. More... | |
MStatus | setFaceVertexColor (int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier=NULL) |
Set color for this vertex in this face. More... | |
MStatus | setFaceVertexColor (int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier, MColorRepresentation rep) |
Set color of specified channels for this vertex in this face. More... | |
MStatus | setFaceColors (MColorArray &colors, MIntArray &faceList) |
Set color for these faces. More... | |
MStatus | setFaceColors (MColorArray &colors, MIntArray &faceList, MColorRepresentation rep) |
Set color of specified channels for these faces. More... | |
MStatus | setVertexColors (MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier=NULL) |
Set color for these vertices. More... | |
MStatus | setVertexColors (MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep) |
Set color of specified channels for these vertices. More... | |
MStatus | setFaceVertexColors (MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier=NULL) |
Set colors for these face/vertex pairs. More... | |
MStatus | setFaceVertexColors (MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep) |
Set colors of specified channels for these face/vertex pairs. More... | |
MStatus | removeFaceColors (MIntArray &faceList) |
Remove previously set color these faces. More... | |
MStatus | removeVertexColors (MIntArray &vertexList) |
Remove color from these vertices. More... | |
MStatus | removeFaceVertexColors (MIntArray &faceList, MIntArray &vertexList) |
Remove colors for these face/vertex pairs. More... | |
MStatus | getVertexColors (MColorArray &colors, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL) |
Get colors for all Vertices of the given colorSet. More... | |
MStatus | getFaceVertexColors (MColorArray &colors, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL) |
Get colors for all vertex/faces of the given color set. More... | |
MStatus | getFaceVertexColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet=NULL) |
Get an index into the array returned by getFaceVertexColors. More... | |
MStatus | setColors (const MColorArray &colors, const MString *colorSet=NULL) |
Sets all of the colors for this mesh. More... | |
MStatus | setColors (const MColorArray &colors, const MString *colorSet, MColorRepresentation rep) |
Sets all of the colors of specified channels for this mesh. More... | |
MStatus | setSomeColors (const MIntArray &colorIds, const MColorArray &colors, const MString *colorSet=NULL) |
Sets the specified colors for this mesh. More... | |
MStatus | setSomeColors (const MIntArray &colorIds, const MColorArray &colors, const MString *colorSet, MColorRepresentation rep) |
Sets the specified colors of specified channels for this mesh. More... | |
MStatus | getColors (MColorArray &colors, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL) const |
This method copies the color array for this mesh into the given color array. More... | |
MStatus | getColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet=NULL) |
Get an index into the array returned by getColors. More... | |
MStatus | setColor (int colorId, const MColor &color, const MString *colorSet=NULL) |
Sets the specified color values. More... | |
MStatus | setColor (int colorId, const MColor &color, const MString *colorSet, MColorRepresentation rep) |
Sets the specified color values of specified channels. More... | |
MStatus | getColor (int colorId, MColor &color, const MString *colorSet=NULL, const MColor *defaultUnsetColor=NULL) const |
Get the value of the specified texture coordinate from this mesh's color list. More... | |
MStatus | assignColor (int polygonId, int vertexIndex, int colorId, const MString *colorSet=NULL) |
Maps a color value to a specified vertex of a polygon. More... | |
MStatus | assignColors (const MIntArray &colorIds, const MString *colorSet=NULL) |
This method maps all colors for the mesh. More... | |
MStatus | clearColors (const MString *colorSet=NULL) |
This method clears out all color for the mesh, and leaves behind an empty color set. More... | |
bool | displayColors (MStatus *ReturnStatus=NULL) const |
Determine if the mesh node is set to display vertex colors. More... | |
MStatus | setDisplayColors (bool enable) |
Set whether the mesh node should display vertex colors. More... | |
int | getHoles (MIntArray &holeInfoArray, MIntArray &holeVertexArray, MStatus *ReturnStatus=NULL) |
Retrieves a list of the holes in the polygon. More... | |
bool | onBoundary (int polygonId, MStatus *ReturnStatus=NULL) const |
A method to determines whether the specified face in the mesh is a boundary face. More... | |
bool | isBlindDataTypeUsed (int blindDataId, MStatus *ReturnStatus=NULL) const |
Is this BlindData type id is already in use in this scene? More... | |
MStatus | createBlindDataType (int blindDataId, MStringArray longNames, MStringArray shortNames, MStringArray formatNames) |
Create a new blind data type. More... | |
bool | hasBlindDataComponentId (int compID, MFn::Type compType, int blindDataId, MStatus *ReturnStatus=NULL) const |
Does this component have blind data with the given ID. More... | |
bool | hasBlindData (MFn::Type compType, int blindDataId, MStatus *ReturnStatus=NULL) const |
Returns true if any component of the given type on this mesh have blind data with the given ID. More... | |
bool | hasBlindDataComponentId (int compID, MFn::Type compType, MStatus *ReturnStatus=NULL) const |
Does this component have any kind of blind data. More... | |
bool | hasBlindData (MFn::Type compType, MStatus *ReturnStatus=NULL) const |
Does any component of this type have any blind data. More... | |
MStatus | getBlindDataTypes (MFn::Type compType, MIntArray &blindDataIds) const |
Get the list of blind data ID's associated with the given component type on this mesh. More... | |
MStatus | getBlindDataAttrNames (int blindDataId, MStringArray &longNames, MStringArray &shortNames, MStringArray &formatNames) const |
Get the blind data attribute names and types for the specified blind data type id. More... | |
MStatus | getFaceVertexBlindDataIndex (int faceIndex, int vertexIndex, int &blindDataIndex) const |
Get the single index to retrieve face-vertex blind data. More... | |
MStatus | getBlindDataFaceVertexIndices (int blindDataIndex, int &faceIndex, int &vertexIndex) const |
Get the face and vertex indices from the face-vertex blind data index. More... | |
MStatus | getIntBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, int &data) const |
Get the blind data value for the specified blind data attribute of the specified component. More... | |
MStatus | getIntBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MIntArray &data) const |
Get the blind data value for the specified blind data attribute of the given type of component. More... | |
MStatus | getFloatBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, float &data) const |
Get the blind data value for the specified blind data attribute of the specified component. More... | |
MStatus | getFloatBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MFloatArray &data) const |
Get the blind data value for the specified blind data attribute for all components of the given type. More... | |
MStatus | getDoubleBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, double &data) const |
Get the blind data value for the specified blind data attribute of the specified component. More... | |
MStatus | getDoubleBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MDoubleArray &data) const |
Get the blind data value for the specified blind data attribute for all components of the given type. More... | |
MStatus | getBoolBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, bool &data) const |
Get the blind data value for the specified blind data attribute of the specified component. More... | |
MStatus | getBoolBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MIntArray &data) const |
Get the blind data value for the specified blind data attribute for all components of the given type. More... | |
MString | stringBlindDataComponentId (int compID, MFn::Type compType, int blindDataId, MString attrName, MStatus *ReturnStatus=NULL) const |
Get the blind data value for the specified blind data attribute of the specified component. More... | |
MStatus | getStringBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MStringArray &data) const |
Get the blind data value for the specified blind data attribute for all components of the given type. More... | |
MString | binaryBlindDataComponentId (int compID, MFn::Type compType, int blindDataId, MString attrName, MStatus *ReturnStatus=NULL) const |
Get the blind data value for the specified blind data attribute of the specified component. More... | |
MStatus | getBinaryBlindData (MFn::Type compType, int blindDataId, MString attrName, MIntArray &compIDs, MStringArray &data) const |
Get the blind data value for the specified blind data attribute for all components of the given type. More... | |
MStatus | setIntBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, int data) |
Set a value for an integer blind data attribute. More... | |
MStatus | setIntBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, int data) |
Set a value for an integer blind data on an array of components. More... | |
MStatus | setIntBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MIntArray &data) |
Set a values for an integer blind data on an array of components. More... | |
MStatus | setFloatBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, float data) |
Set a value for a float blind data attribute. More... | |
MStatus | setFloatBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, float data) |
Set a value for float blind data on an array of components. More... | |
MStatus | setFloatBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MFloatArray &data) |
Set a values for a float blind data on an array of components. More... | |
MStatus | setDoubleBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, double data) |
Set a value for a double blind data attribute. More... | |
MStatus | setDoubleBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, double data) |
Set a value for double blind data on an array of components. More... | |
MStatus | setDoubleBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MDoubleArray &data) |
Set a values for a double blind data on an array of components. More... | |
MStatus | setBoolBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, bool data) |
Set a value for a boolean blind data attribute. More... | |
MStatus | setBoolBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, bool data) |
Set a value for boolean blind data on an array of components. More... | |
MStatus | setBoolBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MIntArray &data) |
Set a values for a boolean blind data on an array of components. More... | |
MStatus | setStringBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString data) |
Set a value for a string blind data attribute. More... | |
MStatus | setStringBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MString data) |
Set a value for string blind data on an array of components. More... | |
MStatus | setStringBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MStringArray &data) |
Set a values for a string blind data on an array of components. More... | |
MStatus | setBinaryBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString data) |
Set a value for a binary blind data attribute. More... | |
MStatus | setBinaryBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MString data) |
Set a value for binary blind data on an array of components. More... | |
MStatus | setBinaryBlindData (MIntArray &compIDs, MFn::Type compType, int blindDataId, MString attrName, MStringArray &data) |
Set a values for a binary blind data on an array of components. More... | |
MStatus | setBinaryBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, char *data, int length) |
Set a value for a binary blind data attribute. More... | |
MStatus | clearBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName) |
Delete a value for a binary blind data attribute on a particular componenr. More... | |
MStatus | clearBlindData (MFn::Type compType, int blindDataId, MString attrName) |
Delete the values for the given attribute on the given binary blind data type from all components of the given type. More... | |
MStatus | clearBlindData (MFn::Type compType) |
Delete all blind data from components of the given type, e.g. More... | |
MStatus | clearBlindData (int compID, MFn::Type compType, int blindDataId) |
Delete the values for a binary blind data type (all its attributes) from a particular component. More... | |
MStatus | clearBlindData (MFn::Type compType, int blindDataId) |
Delete the values for a binary blind data type (all its attributes) from all components of the given type. More... | |
void | setCheckSamePointTwice (bool check=true) |
This method allows the turning on or off of duplicate point checking when polygons are created or added using this class. More... | |
bool | getCheckSamePointTwice (void) |
Return true if checking for duplicate points is turned on. More... | |
MStatus | createInPlace (int numVertices, int numPolygons, const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects) |
Replaces the existing polygonal mesh with a new one specified by array of vertices and polygon connection information. More... | |
MStatus | copyInPlace (const MObject &source) |
This method creates copies the given source mesh onto the current surface. More... | |
MString | createColorSetWithName (const MString &colorSetName, MDGModifier *modifier, MStatus *ReturnStatus) |
Deprecated in 2019.0 More... | |
MObject | generateSmoothMesh (MObject parentOrOwner, MStatus *ReturnStatus) |
Deprecated in 2019.0 More... | |
MFnMesh (const MObject &object, MStatus *ret=NULL) | |
Constructor. More... | |
MString | currentColorSetName (MStatus *ReturnStatus) const |
Deprecated in 2019.0 More... | |
MObject | addPolygon (MPointArray &vertexArray, double polyTolerance, bool mergeVertices=true, double pointTolerance=kMFnMeshPointTolerance, bool forceGeometry=true, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Deprecated in 2019.0 More... | |
bool | intersect (MPoint &raySource, MVector &rayDirection, MPointArray &points, MStatus *ReturnStatus=NULL) const |
Deprecated in 2019.0 More... | |
bool | intersect (const MPoint &raySource, const MVector &rayDirection, MPointArray &points, MStatus *ReturnStatus=NULL) const |
Deprecated in 2019.0 More... | |
MStatus | getBlindDataAttrNames (int blindDataId, MStringArray &longNames, MStringArray &shortNames) const |
Not available in Python. More... | |
bool | hasBlindData (int compID, MFn::Type compType, int blindDataId, MStatus *ReturnStatus=NULL) const |
Deprecated in 2019.0 More... | |
bool | hasBlindData (int compID, MFn::Type compType, MStatus *ReturnStatus=NULL) const |
Deprecated in 2019.0 More... | |
MStatus | createUVSet (MString &uvSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL) |
Not available in Python. More... | |
MStatus | createUVSetDataMesh (MString &uvSetName) |
Not available in Python. | |
MStatus | copyUVSet (const MString &fromName, MString &toName, MDGModifier *modifier=NULL) |
Not available in Python. More... | |
MStatus | getCurrentUVSetName (MString &setName, int instance=kMFnMeshInstanceUnspecified) const |
Not available in Python. More... | |
MStatus | createColorSet (MString &colorSetName, MDGModifier *modifier=NULL, const MUintArray *instances=NULL) |
Not available in Python. More... | |
MStatus | createColorSet (MString &colorSetName, MDGModifier *modifier, bool clamped, MColorRepresentation rep, const MUintArray *instances=NULL) |
Not available in Python. More... | |
MStatus | getCurrentColorSetName (MString &setName, int instance=kMFnMeshInstanceUnspecified) const |
Not available in Python. More... | |
MStatus | getStringBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString &data) const |
Deprecated in 2019.0 More... | |
MStatus | getBinaryBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName, MString &data) const |
Deprecated in 2019.0 More... | |
const adsk::Data::Associations * | metadata (MStatus *ReturnStatus=NULL) const override |
Not available in Python. More... | |
MStatus | setMetadata (const adsk::Data::Associations &) override |
Not available in Python. More... | |
MStatus | validateMetadata (MString &errors) const override |
Not available in Python. More... | |
MObject | create (const MPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Introduced in 2023.0 More... | |
MObject | create (const MFloatPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Introduced in 2023.0 More... | |
MObject | create (const MPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray &uArray, const MFloatArray &vArray, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Introduced in 2023.0 More... | |
MObject | create (const MFloatPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray &uArray, const MFloatArray &vArray, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Introduced in 2023.0 More... | |
MStatus | createInPlace (const MPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects) |
Introduced in 2023.0 More... | |
MStatus | createInPlace (const MFloatPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects) |
Introduced in 2023.0 More... | |
template<class A > | |
MObject | commonCreate (const A &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray &uArray, const MFloatArray &vArray, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Template (private) version of create. More... | |
template<class A > | |
MStatus | commonCreateInPlace (const A &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects) |
Template (private) version of createInPlace. More... | |
template<class A > | |
MObject | commonCreate (const A &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner, MStatus *ReturnStatus) |
Template (private) version of create. More... | |
Public Member Functions inherited from MFnDagNode | |
virtual | ~MFnDagNode () |
Destructor. More... | |
MFnDagNode () | |
Class Constructor. More... | |
MFnDagNode (MObject &object, MStatus *ret=NULL) | |
Not available in Python. More... | |
MFnDagNode (const MDagPath &object, MStatus *ret=NULL) | |
Class Constructor. More... | |
MObject | create (const MTypeId &typeId, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new DAG node with the given type tag. More... | |
MObject | create (const MTypeId &typeId, const MString &name, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new DAG node with the given type tag. More... | |
MObject | create (const MString &type, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new DAG node with the given type tag. More... | |
MObject | create (const MString &type, const MString &name, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL) |
Creates a new DAG node with the given type tag. More... | |
unsigned int | parentCount (MStatus *ReturnStatus=NULL) const |
Determines the number of parent Nodes of the Node. More... | |
MObject | parent (unsigned int i, MStatus *ReturnStatus=NULL) const |
Queries the DAG Node attached to the Function Set for the parent Node corresponding to the given index. More... | |
MStatus | addChild (MObject &child, unsigned int index=kNextPos, bool keepExistingParents=false) |
Makes the given DAG Node a child of the DAG Node to which this instance of the Function Set is attached. More... | |
MStatus | removeChild (MObject &child) |
Removes the given DAG Node from the parent. More... | |
MStatus | removeChildAt (unsigned int index) |
Removes the child at the given index from the parent. More... | |
unsigned int | childCount (MStatus *ReturnStatus=NULL) const |
Determines the number of child Nodes of the Node. More... | |
MObject | child (unsigned int i, MStatus *ReturnStatus=NULL) const |
Queries the DAG Node attached to the Function Set for the child Node corresponding to the given index. More... | |
MObject | dagRoot (MStatus *ReturnStatus=NULL) |
Determines the root of the first DAG Path to the DAG Node attached to the Function Set. More... | |
bool | hasParent (const MObject &node, MStatus *ReturnStatus=NULL) const |
Determines whether or not the given Node is a parent of the DAG Node attached to the Function Set. More... | |
bool | hasChild (const MObject &node, MStatus *ReturnStatus=NULL) const |
Determines whether or not the given Node is a child of the DAG Node attached to the Function Set. More... | |
bool | isChildOf (const MObject &node, MStatus *ReturnStatus=NULL) const |
Determines whether or not the DAG Node attached to the Function Set is a child of the given node. More... | |
bool | isParentOf (const MObject &node, MStatus *ReturnStatus=NULL) const |
Determines whether or not the DAG Node attached to the Function Set is a parent of the given node. More... | |
bool | inUnderWorld (MStatus *ReturnStatus=NULL) const |
Determines whether or not the DAG Node is an underworld node. More... | |
bool | inModel (MStatus *ReturnStatus=NULL) const |
Determines whether or not the DAG Node is in the model. More... | |
bool | isInstanceable (MStatus *ReturnStatus=NULL) const |
Returns true if the DAG node can be instanced, and false otherwise. More... | |
MStatus | setInstanceable (const bool how) |
Sets whether or not the DAG node is instanceable. More... | |
bool | isInstanced (bool indirect=true, MStatus *ReturnStatus=NULL) const |
Determines whether the DAG Node attached to the Function Set is directly or indirectly instanced. More... | |
bool | isInstancedAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const |
Returns true if the specified attribute is instanced. More... | |
unsigned int | instanceCount (bool total, MStatus *ReturnStatus=NULL) const |
Determines the number of times the Node attached to the Function Set is instanced. More... | |
MObject | duplicate (bool instance=false, bool instanceLeaf=false, MStatus *ReturnStatus=NULL) const |
This method duplicates the DAG hierarchy rooted at the current node. More... | |
MStatus | getPath (MDagPath &path) const |
Returns a DAG Path to the DAG Node attached to the Function Set. More... | |
MStatus | getAllPaths (MDagPathArray &paths) const |
Determines all DAG Paths to the DAG Node attached to the Function Set. More... | |
MString | fullPathName (MStatus *ReturnStatus=NULL) const |
Return a string representing the full path from the root of the dag to this object. More... | |
MString | partialPathName (MStatus *ReturnStatus=NULL) const |
Return a string representing the partial path from the root of the dag to this object. More... | |
MMatrix | transformationMatrix (MStatus *ReturnStatus=NULL) const |
Returns the object space transformation matrix for this DAG node. More... | |
bool | isIntermediateObject (MStatus *ReturnStatus=NULL) const |
Returns true if this object is an intermediate in a geometry calculation. More... | |
MStatus | setIntermediateObject (bool isIntermediate) |
Sets whether this object is an intermediate in a geometry calculation. More... | |
int | objectColor (MStatus *ReturnStatus=NULL) const |
Deprecated in 2016.0 More... | |
MStatus | setObjectColor (int color) |
Sets the index for the current user defined inactive color used by the node. More... | |
bool | usingObjectColor (MStatus *ReturnStatus=NULL) const |
Deprecated in 2016.0 More... | |
MStatus | setUseObjectColor (bool useObjectColor) |
Deprecated in 2016.0 More... | |
MObjectColorType | objectColorType (MStatus *ReturnStatus=NULL) const |
Determines whether or not the user defined inactive color will be used for the node, or whether the default inactive color will be used. More... | |
MStatus | setObjectColorType (MObjectColorType type) |
Sets whether or not the user defined inactive object color will be used. More... | |
MStatus | setObjectColor (const MColor &color) |
Sets the color value for the current user defined inactive color used by the node. More... | |
MColor | objectColorRGB (MStatus *ReturnStatus=NULL) const |
Determines the RGB color for the current user defined inactive color used by the node. More... | |
int | objectColorIndex (MStatus *ReturnStatus=NULL) const |
Determines the index for the current user defined inactive color used by the node. More... | |
MColor | hiliteColor (MStatus *ReturnStatus=NULL) const |
Determines the current hilite color used by the node. More... | |
bool | usingHiliteColor (MStatus *ReturnStatus=NULL) const |
Determines whether or not the hilite color will be used for the node. More... | |
MColor | dormantColor (MStatus *ReturnStatus=NULL) const |
Determines the dormant color used by this node. More... | |
MColor | activeColor (MStatus *ReturnStatus=NULL) const |
Determines the active color used by this node. More... | |
bool | drawOverrideEnabled (MStatus *ReturnStatus=NULL) const |
Determines whether or not draw override is turned on for this node. More... | |
bool | drawOverrideIsReference (MStatus *ReturnStatus=NULL) const |
Determines whether or not Display Type of the draw override is Reference for this node. More... | |
bool | drawOverrideIsTemplate (MStatus *ReturnStatus=NULL) const |
Determines whether or not Display Type of the draw override is Template for this node. More... | |
bool | drawOverrideColor (MColor &color, MStatus *ReturnStatus=NULL) const |
Determines the draw override color used by this node. More... | |
MStatus | getConnectedSetsAndMembers (unsigned int instanceNumber, MObjectArray &sets, MObjectArray &comps, bool renderableSetsOnly) const |
Returns all the sets connected to the specified instance of this DAG object. More... | |
MBoundingBox | boundingBox (MStatus *ReturnStatus=NULL) const |
Returns the bounding box for the dag node in object space. More... | |
MDagPath | dagPath (MStatus *ReturnStatus=NULL) const |
Returns the DagPath to which the Function Set is attached. More... | |
virtual MStatus | setObject (const MDagPath &path) |
Attaches Function Set to the DAG Node that has the given DAG Path. More... | |
MStatus | setObject (MObject &object) override |
Attaches Function Set to given DAG Node. More... | |
MObject | model (MStatus *ReturnStatus=NULL) const |
Deprecated in 2016.0 More... | |
MFnDagNode (const MObject &object, MStatus *ret=NULL) | |
No script support. More... | |
MStatus | setObject (const MObject &object) override |
No script support. More... | |
Public Member Functions inherited from MFnDependencyNode | |
virtual | ~MFnDependencyNode () |
Destructor. | |
MFnDependencyNode () | |
Default constructor. | |
MFnDependencyNode (MObject &object, MStatus *ReturnStatus=NULL) | |
Constructor. More... | |
MObject | create (const MTypeId &typeId, MStatus *ReturnStatus=NULL) |
Creates a new dependency node with the given type tag. More... | |
MObject | create (const MTypeId &typeId, const MString &name, MStatus *ReturnStatus=NULL) |
Creates a new dependency node with the given type tag. More... | |
MObject | create (const MString &type, MStatus *ReturnStatus=NULL) |
Creates a new dependency node with the given type. More... | |
MObject | create (const MString &type, const MString &name, MStatus *ReturnStatus=NULL) |
Creates a new dependency node with the given type. More... | |
MTypeId | typeId (MStatus *ReturnStatus=NULL) const |
Returns the type id of this node. More... | |
MString | typeName (MStatus *ReturnStatus=NULL) const |
Returns the type name of this node. More... | |
MString | name (MStatus *ReturnStatus=NULL) const |
Returns the name of this node. More... | |
MString | absoluteName (MStatus *ReturnStatus=NULL) const |
Returns the absolute name of this node. More... | |
MString | uniqueName (MStatus *ReturnStatus=NULL) const |
Introduced in 2023.0 More... | |
MString | pluginName (MStatus *ReturnStatus=NULL) const |
Returns the name of the plug-in this MFnDependendencyNode was defined in. More... | |
MString | setName (const MString &name, bool createNamespace=false, MStatus *ReturnStatus=NULL) |
Sets the name of this node. More... | |
MUuid | uuid (MStatus *ReturnStatus=NULL) const |
Returns the node's UUID. More... | |
void | setUuid (const MUuid &uuid, MStatus *ReturnStatus=NULL) |
Sets the node's UUID. More... | |
MStatus | getConnections (MPlugArray &array) const |
Get all of the current connections to this node as an array of plugs. More... | |
unsigned int | attributeCount (MStatus *ReturnStatus=NULL) const |
Returns the number of attributes that this node has. More... | |
MObject | attribute (unsigned int index, MStatus *ReturnStatus=NULL) const |
Finds the attribute of this node at the given index. More... | |
MObject | reorderedAttribute (unsigned int index, MStatus *ReturnStatus=NULL) const |
Some nodes, such as the various animCurve nodes, require that their attributes be set in a specific order for proper operation. More... | |
MObject | attribute (const MString &attrName, MStatus *ReturnStatus=NULL) const |
Finds the attribute of this node that has the given name. More... | |
MAttrClass | attributeClass (const MObject &attr, MStatus *ReturnStatus=NULL) const |
Returns the class (normal, dynamic, extension) of the specified attribute. More... | |
MStatus | getAffectedAttributes (const MObject &attr, MObjectArray &affectedAttributes) const |
Returns an array of attributes that are affected by the attribute passed in. More... | |
MStatus | getAffectedByAttributes (const MObject &attr, MObjectArray &affectedByAttributes) const |
Returns an array of attributes that affect the attribute passed in, attr. More... | |
MPlug | findPlug (const MObject &attr, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const |
Attempt to find a plug for the given attribute. More... | |
MPlug | findPlug (const MString &attrName, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const |
Attempt to find a plug for the given attribute. More... | |
MPlug | findPlug (const MObject &attr, MStatus *ReturnStatus=NULL) const |
Deprecated in 2019.0 More... | |
MPlug | findPlug (const MString &attrName, MStatus *ReturnStatus=NULL) const |
Deprecated in 2019.0 More... | |
MStatus | addAttribute (const MObject &attr) |
Add a new dynamic attibute to this node. More... | |
MStatus | removeAttribute (const MObject &attr) |
Remove a dynamic attribute from a node. More... | |
MPxNode * | userNode (MStatus *ReturnStatus=NULL) const |
If the function set's node is a plug-in node, then this method will extract the MPxNode pointer from it. More... | |
bool | isFromReferencedFile (MStatus *ReturnStatus=NULL) const |
Indicates whether or not this node came from a referenced file. More... | |
bool | isShared (MStatus *ReturnStatus=NULL) const |
Indicates whether or not this node is shared. More... | |
bool | isTrackingEdits (MStatus *ReturnStatus=NULL) const |
Returns whether or not edits on the given node are being tracked by the generalized edit system. More... | |
bool | hasUniqueName (MStatus *ReturnStatus=NULL) const |
Indicates whether or not this node's name is unique within the scene. More... | |
MString | parentNamespace (MStatus *ReturnStatus=NULL) const |
Returns the name of the namespace in which this node resides. More... | |
bool | isLocked (MStatus *ReturnStatus=NULL) const |
Indicates whether or not this node is locked. More... | |
MStatus | setLocked (bool locked) |
Locks or unlocks this node. More... | |
bool | isNewAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const |
Indicates whether or not the specified attribute was added to this node within the current scene. More... | |
MStatus | setFlag (unsigned int flag, bool state) |
Sets the state of the specified flag for the node. More... | |
bool | isFlagSet (unsigned int flag, MStatus *ReturnStatus=NULL) const |
Retrieves the current state of the specified flag for a node. More... | |
bool | isDefaultNode (MStatus *ReturnStatus=NULL) const |
Returns true if the node is a default node. More... | |
MStatus | setDoNotWrite (bool flag) |
Use this method to mark the "do not write" state of this node. More... | |
bool | canBeWritten (MStatus *ReturnStatus=NULL) const |
Returns the do not write state of the node. More... | |
bool | hasAttribute (const MString &name, MStatus *ReturnStatus=NULL) const |
Returns true if the node already has an attribute with the given name. More... | |
MObject | getAliasAttr (bool force, MStatus *ReturnStatus=NULL) |
Returns the node's alias attribute, which is a special attribute used to store information about the node's attribute aliases. More... | |
bool | setAlias (const MString &alias, const MString &name, const MPlug &plug, bool add=true, MStatus *ReturnStatus=NULL) |
Sets or removes an alias (i.e. More... | |
bool | findAlias (const MString &alias, MObject &attrObj, MStatus *ReturnStatus=NULL) const |
Retrieves the attribute with the given alias. More... | |
bool | getAliasList (MStringArray &strArray, MStatus *ReturnStatus=NULL) |
Returns a list of all attribute aliases for this node. More... | |
MString | plugsAlias (const MPlug &plug, MStatus *ReturnStatus=NULL) |
Returns the alias for the plug's attribute or the empty string if that attribute has no alias. More... | |
MStatus | setIcon (const MString &filename) |
Associates a custom icon with the node for display in the Maya UI. More... | |
MString | icon (MStatus *ReturnStatus=NULL) const |
Returns the custom icon filename associated with the node. More... | |
MStatus | getExternalContent (MExternalContentInfoTable &table) const |
Returns the external content (files) that this node depends on. More... | |
MStatus | addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const |
Adds content info to the specified table from a file path attribute. More... | |
MStatus | setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table) |
Sets content info in the specified attribute from the table. More... | |
MStatus | setExternalContent (const MExternalContentLocationTable &table) |
Changes the location of external content. More... | |
bool | affectsAnimation (MStatus *ReturnStatus=NULL) const |
Introduced in 2019.0 More... | |
MStatus | setAffectsAnimation () |
Introduced in 2019.0 More... | |
MString | setName (const MString &name, MStatus *ReturnStatus) |
Deprecated in 2019.0 More... | |
MFnDependencyNode (const MObject &object, MStatus *ReturnStatus=NULL) | |
Not available in Python. More... | |
bool | getPlugsAlias (const MPlug &plug, MString &aliasName, MStatus *ReturnStatus=NULL) |
Not available in Python. More... | |
virtual MStatus | deleteMetadata () |
Not available in Python. More... | |
MStatus | dgTimerOn () |
Indicates that this node should collect DG timing data whenever DG timing is enabled. More... | |
MStatus | dgTimerOff () |
Indicates that this node should no longer collect DG timing data when DG timing is enabled. More... | |
MdgTimerState | dgTimerQueryState (MStatus *ReturnStatus=NULL) |
The function returns the current on/off state of the node's timer. More... | |
MStatus | dgTimerReset () |
The function resets the dependency graph timers and counters for this node to zero. More... | |
double | dgTimer (const MdgTimerMetric timerMetric, const MdgTimerType timerType, MStatus *ReturnStatus=NULL) const |
The function returns the specified timer value for the current node. More... | |
MStatus | dgCallbacks (const MdgTimerType type, MStringArray &callbackName, MDoubleArray &value) |
Node callbacks that occur when timing is enabled get logged with the node and can be queried via this method. More... | |
MStatus | dgCallbackIds (const MdgTimerType type, const MString &callbackName, MCallbackIdArray &callbackId, MDoubleArray &value) |
This method provides a further breakdown of the per-callback time returned via dgCallbacks() by returning the data on a per-callbackId basis. More... | |
MStatus | addAttribute (const MObject &attr, MAttrClass type) |
Deprecated in 2019.0 More... | |
MStatus | removeAttribute (const MObject &attr, MAttrClass type) |
Deprecated in 2019.0 More... | |
Public Member Functions inherited from MFnBase | |
virtual | ~MFnBase () |
Class Destructor. More... | |
bool | hasObj (MFn::Type) const |
Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More... | |
bool | hasObj (const MObject &) const |
Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More... | |
MObject | object (MStatus *ReturnStatus=nullptr) const |
Returns the MObject that is attached to the Function Set. More... | |
Static Public Member Functions | |
static const char * | className () |
Returns the name of this class. More... | |
static MMeshIsectAccelParams | uniformGridParams (int xDiv, int yDiv, int zDiv) |
Creates a MMeshIsectAccelParams configuration object that can be passed to several of the geometric query methods available on MFnMesh. More... | |
static MMeshIsectAccelParams | autoUniformGridParams () |
Creates a MMeshIsectAccelParams configuration object that can be passed to several of the geometric query methods on MFnMesh to speed up their operation. More... | |
static MString | globalIntersectionAcceleratorsInfo () |
Retrieves a string that describes the systemwide resource usage for cached mesh intersection accelerators. More... | |
static void | clearGlobalIntersectionAcceleratorInfo () |
As described above, clears the "total count", "total build time", and "peak memory" fields from the information string returned by globalIntersectionAcceleratorsInfo(). More... | |
static MString | componentTypeName (MFn::Type compType, MStatus &status) |
Get a string representing a particular component type. More... | |
static MFn::Type | componentTypeFromName (const MString &assocName) |
Get a component type from its string name. More... | |
static MStatus | polyTriangulate (const float *pointsAndHoles, unsigned int pointsCount, unsigned int outerPointsCount, unsigned int holesCount, bool considerNormal, const float *normals, unsigned short *triangles, int &trianglesCount) |
Triangulates a polygon. More... | |
static MStatus | polyTriangulate (const MFloatPointArray &points, const MIntArray &holes, unsigned int outerPointsCount, const MFloatVectorArray &normals, MIntArray &triangles) |
Triangulates a polygon. More... | |
Static Public Member Functions inherited from MFnDagNode | |
static const char * | className () |
Returns the name of this class. More... | |
Static Public Member Functions inherited from MFnDependencyNode | |
static const char * | className () |
Returns the name of this class. More... | |
static MString | classification (const MString &nodeTypeName) |
Retrieves the classification string for a node type. More... | |
static unsigned int | allocateFlag (const MString pluginName, MStatus *ReturnStatus=NULL) |
Allocates a node flag for sole use by the caller. More... | |
static MStatus | deallocateFlag (const MString pluginName, unsigned int flag) |
Deallocates a node flag which was previously allocated by a call to allocateFlag. More... | |
static MStatus | deallocateAllFlags (const MString pluginName) |
Deallocates all of the node flags which are currently allocated to the specified plugin. More... | |
static void | enableDGTiming (bool enable) |
Globally enables or disables the DG node timing mechanism. More... | |
Static Public Member Functions inherited from MFnBase | |
static const char * | className () |
Returns the name of this class. More... | |
static const char * | typeString (MFn::Type) |
Introduced in 2020.0 More... | |
static bool | isValid (MFn::Type) |
Introduced in 2020.0 More... | |
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.
enum MColorRepresentation |
enum SplitPlacement |
enum BoolOperation |
enum BoolClassification |
Introduced in 2023.0
Boolean classification
Enumerator | |
---|---|
kEdgeClassification |
Edge Classification. |
kNormalClassification |
Normal Classification. |
enum BorderInfo |
Introduced in 2023.0
Holds information about edges on geom/UV shell border or having shared/unshared UVs
|
virtual |
Destructor.
Class destructor.
|
virtual |
Function set type.
Return the class type : MFn::kMesh.
Reimplemented from MFnDagNode.
|
static |
Returns the name of this class.
Return the class name : "MFnMesh".
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 nullptr 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.
[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 |
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 nullptr 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.
[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 |
MObject create | ( | int | numVertices, |
int | numPolygons, | ||
const MPointArray & | vertexArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects, | ||
bool | storeDoubles, | ||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Creates a new polygonal mesh given an array of vertices and polygon connection information and sets this function set to operate on the new surface.
This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.
The parentOrOwner argument is used to specify the owner of the new surface.
If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.
If parentOrOwner is nullptr 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.
[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] | storeDoubles | Whether to store the vertex data at double precision internally. |
[in] | parentOrOwner | parent of the polygon that will be created |
[out] | ReturnStatus | Status code |
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 nullptr 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.
[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 |
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 nullptr 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.
[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 |
MObject create | ( | const MFloatPointArray & | vertexArray, |
const MIntArray & | edges, | ||
const MIntArray & | edgeConnectsCount, | ||
const MIntArray & | edgeFaceConnects, | ||
const MIntArray & | edgeFaceDesc, | ||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Creates a new polygonal mesh given an array of vertices, edge information, polygon connection information, UV 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 nullptr 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.
[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] | edges | array of vertex indices that define the edges of the geometry. For example, the cube { (0,1), (1,2), (2,3), (3,0), (4,7), (7,6), (6,5), (5,4), (0,4), (1,7), (2,6), (3,5) } |
[in] | edgeConnectsCount | array of edge counts for each polygon. For example the cube would have 6 faces, each of which had 4 edges, so the edgeConnectsCount would be {4,4,4,4,4,4}. |
[in] | edgeFaceConnects | array of edge connections for each polygon. For example, in the cube, we have 4 edges for every face, so we list the edges for face0, face1, etc consecutively in the array. These are specified by indexes in the edges array: e.g for the cube: { 0, 1, 2, 3, 1, 10, 5, 9, 2, 11, 6, 10, 3, 8, 7, 11, 0, 9, 4, 8, 4, 5, 6, 7 } |
[in] | edgeFaceDesc | array of edge direction populated by members of MFnMesh::MEdgeDirection defining if a given edge for a polygon is intended to be in its normal direction, or in the reverse direction. Example, for the cube: { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0} |
[in] | parentOrOwner | parent of the polygon that will be created |
[out] | ReturnStatus | Status code |
MObject create | ( | const MPointArray & | vertexArray, |
const MIntArray & | edges, | ||
const MIntArray & | edgeConnectsCount, | ||
const MIntArray & | edgeFaceConnects, | ||
const MIntArray & | edgeFaceDesc, | ||
bool | storeDoubles, | ||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Introduced in 2019.0
Creates a new polygonal mesh given an array of vertices, edge information, polygon connection information, UV 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 nullptr 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.
[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] | edges | array of vertex indices that define the edges of the geometry. For example, the cube { (0,1), (1,2), (2,3), (3,0), (4,7), (7,6), (6,5), (5,4), (0,4), (1,7), (2,6), (3,5) } |
[in] | edgeConnectsCount | array of edge counts for each polygon. For example the cube would have 6 faces, each of which had 4 edges, so the edgeConnectsCount would be {4,4,4,4,4,4}. |
[in] | edgeFaceConnects | array of edge connections for each polygon. For example, in the cube, we have 4 edges for every face, so we list the edges for face0, face1, etc consecutively in the array. These are specified by indexes in the edges array: e.g for the cube: { 0, 1, 2, 3, 1, 10, 5, 9, 2, 11, 6, 10, 3, 8, 7, 11, 0, 9, 4, 8, 4, 5, 6, 7 } |
[in] | edgeFaceDesc | array of edge direction populated by members of MFnMesh::MEdgeDirection defining if a given edge for a polygon is intended to be in its normal direction, or in the reverse direction. Example, for the cube: { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0} |
[in] | storeDoubles | Whether to store the vertex data at double precision internally. |
[in] | parentOrOwner | parent of the polygon that will be created |
[out] | ReturnStatus | Status code |
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 nullptr 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.
[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 |
MStatus getSmoothMeshDisplayOptions | ( | MMeshSmoothOptions & | options | ) | const |
Retrieve the current display smoothing options for the mesh.
[out] | options | storge for the options |
MStatus setSmoothMeshDisplayOptions | ( | const MMeshSmoothOptions & | options | ) |
Sets the current display smoothing options for the mesh.
[in] | options | Options to set |
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 nullptr 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.
[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 |
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 nullptr 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.
[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. |
MObject addPolygon | ( | const MPointArray & | vertexArray, |
const MIntArray & | loopCounts, | ||
int & | faceIndex, | ||
bool | mergeVertices = true , |
||
double | pointTolerance = kMFnMeshPointTolerance , |
||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Adds a new polygon to this polygonal mesh.
Return an index of the created polygon.
This version of addPolygon() allows for the creation of faces with holes. The loopCounts argument is used for this. loopCounts is an array of vertex counts. The first entry gives the count of vertices that make up the exterior of the polygon (using that many entries in vertexArray). The following entries in loopCounts give the count of vertices that make up each hole, using the following entries in vertexArray.
Therefore the sum of the entries of loopCounts should equal the total length of vertexArray.
If loopCounts is an empty array, it is treated as if it had one entry equal to the length of vertexArray i.e. the face has no holes.
Note that holes should normally be specified with the opposite winding order to the exterior polygon.
If there is no current geometry then a new polygonal mesh is created and parentOrOwner is used to specify the owner of the new surface. If parentOrOwner is nullptr 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.
[in] | vertexArray | Array of ordered vertices that make up the polygon. |
[in] | loopCounts | Array of vertex loop counts. |
[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. |
MStatus addHoles | ( | int | faceIndex, |
const MPointArray & | vertexArray, | ||
const MIntArray & | loopCounts, | ||
bool | mergeVertices = true , |
||
double | pointTolerance = kMFnMeshPointTolerance |
||
) |
Adds holes to a mesh polygon.
loopCounts is an array of vertex counts. The first entry gives the count of vertices that make up the first hole to add to the polygon (using that many entries in vertexArray). The following entries in loopCounts give the count of vertices that make up each remaining hole, using the following entries in vertexArray.
Therefore the sum of the entries of loopCounts should equal the total length of vertexArray.
Note that holes should normally be specified with the opposite winding order to the exterior polygon.
[in] | faceIndex | Index of the face to which to add holes. |
[in] | vertexArray | Array of ordered vertices that make up the polygon. |
[in] | loopCounts | Array of vertex loop counts. |
[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. |
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.
[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. |
MStatus deleteEdge | ( | int | edgeId, |
MDGModifier * | modifier = NULL |
||
) |
Delete this edge.
[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. |
MStatus deleteVertex | ( | int | vertexId, |
MDGModifier * | modifier = NULL |
||
) |
Delete this vertex.
[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. |
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.
[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. |
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.
[in] | faceList | array of face IDs to subdivide |
[in] | divisionCount | number of subsequent subdivisions to do |
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.
[in] | edgeList | array of edge component IDs to be subdivided |
[in] | divisionCount | number of subsequent subdivisions to do |
MStatus extrudeFaces | ( | MIntArray & | faceList, |
int | extrusionCount, | ||
MFloatVector * | translation, | ||
bool | extrudeTogether, | ||
float | thickness = 0.0f , |
||
float | offset = 0.0f |
||
) |
This function extrudes a set of faces.
The resulting mesh will have extra parallelograms coming out of the edges of the given polygons going to the new extruded edges. The extrusionCount argument is the number of subsequent extrusions per polygon and represents the number of faces that will be created for each edge of the polygons in the list.
The difference between using thickness or offset instead of providing a vector with the translation variable is that the translation will be applied to each vertex in the extrusion along its local direction. This can result in vertices being moved the same distance, but the angles between the original components are not maintained so the overall shape is not the same. Both the thickness and offset variables will attempt to move the components a distance that will maintain angles between edges at the border of the extrusion.
[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 nullptr if not required. |
[in] | extrudeTogether | sets whether the components should be extruded individually or together, as if one complex component was being extruded. |
[in] | thickness | Faces are moved outwards this distance from their original position to give the object a consistent thickness. |
[in] | offset | Faces are moved this distance towards the inside of the face. |
MStatus extrudeEdges | ( | MIntArray & | edgeList, |
int | extrusionCount, | ||
MFloatVector * | translation, | ||
bool | extrudeTogether, | ||
float | thickness = 0.0f , |
||
float | offset = 0.0f |
||
) |
This function extrudes edges.
The resulting mesh will have extra parallelograms coming out of the given edges and going to the new extruded edges. The extrusionCount argument is the number of subsequent extrusions per edges and represents the number of polygons that will be created from each given edge to the extruded edges.
The difference between using thickness or offset instead of providing a vector with the translation variable is that the translation will be applied to each vertex in the extrusion along its local direction. This can result in vertices being moved the same distance, but the angles between the original components are not maintained so the overall shape is not the same. Both the thickness and offset variables will attempt to move the components a distance that will maintain angles between edges at the border of the extrusion.
[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 nullptr if not required. |
[in] | extrudeTogether | sets whether the components should be extruded individually or together, as if one complex component was being extruded. |
[in] | thickness | Edges are moved this distance in the direction of the connected face normals. original position to give the object a consistent thickmess. |
[in] | offset | Edges are moved this distance in the opposite direction of the edge. |
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.
[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 nullptr if not required. |
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.
[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 nullptr if not required. |
This function collapse faces into vertices.
Non-adjacent faces will be collapsed individually so that each pieces of adjacent faces turn into one vertex.
[in] | faceList | array of face component IDs to be collapsed |
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.
[in] | edgeList | array of edge component IDs to be collapsed |
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.
[out] | ReturnStatus | Status code |
int numEdges | ( | MStatus * | ReturnStatus = NULL | ) | const |
Returns the number of edges for this mesh.
[out] | ReturnStatus | Status code |
int numPolygons | ( | MStatus * | ReturnStatus = NULL | ) | const |
Returns the number of polygons for this mesh.
[out] | ReturnStatus | Status code |
int numFaceVertices | ( | MStatus * | ReturnStatus = NULL | ) | const |
Returns the number of face-vertices for this mesh.
[out] | ReturnStatus | Status code |
int polygonVertexCount | ( | int | polygonId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Returns the number of vertices for the specified polygon.
[in] | polygonId | The polygon index |
[out] | ReturnStatus | Status code |
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.
[out] | ReturnStatus | Status code |
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.
[in] | uvSet | UV set to work with |
[out] | ReturnStatus | Status code |
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.
[out] | ReturnStatus | Status code |
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.
[in] | colorSet | Color set to work with |
[out] | ReturnStatus | Status code |
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.
[out] | ReturnStatus | Status code |
This method returns if the color set has RGB components.
[in] | colorSet | Color set to work with |
[out] | ReturnStatus | Status code |
This method returns true if the color set has Alpha component.
[in] | colorSet | Color set to work with |
[out] | ReturnStatus | Status code |
MFnMesh::MColorRepresentation getColorRepresentation | ( | const MString & | colorSet, |
MStatus * | ReturnStatus = NULL |
||
) | const |
This method returns the color representation (RGB/RGBA/A) of a color set.
[in] | colorSet | Color set to work with |
[out] | ReturnStatus | Status code |
This method returns if the color set has its R,G,B,and A components clamped in the range from 0 to 1.
[in] | colorSet | Color set to work with |
[out] | ReturnStatus | Status code |
Set the color set to be clamped.
[in] | colorSet | Color set to work with |
[in] | clamped | If the color set should be set clamped |
Returns the number of triangles for every polygon face and the vertex Ids of each triangle vertex.
The triangleVertices array holds each vertex for each triangle in sequence, so it has three times as many elements as there are triangles. (i.e. three times the sum of the elements of the triangleCounts array)
This method is not threadsafe.
[out] | triangleCounts | The number of triangles for each polygon face |
[out] | triangleVertices | The triangle vertex Ids for each triangle |
Returns the number of triangles for every polygon face and the offset into the vertex indices array for each triangle vertex (see getVertices()).
The triangleVertices array holds each vertex for each triangle in sequence, so it has three times as many elements as there are triangles. (i.e. three times the sum of the elements of the triangleCounts array)
This method is not threadsafe.
[out] | triangleCounts | The number of triangles for each polygon face |
[out] | triangleIndices | The index array for each triangle in face vertex space |
MStatus booleanOp | ( | BoolOperation | op, |
MFnMesh & | mesh1, | ||
MFnMesh & | mesh2 | ||
) |
Deprecated in 2019.0
Computes the boolean between two meshes.
The result is stored in the current MFnMesh instance. The current instance must point to a valid mesh, which can be empty. Such a mesh can result from using MFnMesh::create() for example.
The union operation adds the two meshes together. The difference operation subtracts the second mesh from the first. The intersection operation takes only the parts of the two mesh volumes which overlap.
The operation is performed in object space, so transformations applied by the DAG hierarchy are ignored. If you want transformations to be taken into account then you will have to first bake them onto the geometry, for example by using the makeIdentity command.
[in] | op | Operation to perform (kUnion, kDifference or kIntersection) |
[in] | mesh1 | The first mesh in the boolean operation |
[in] | mesh2 | The second mesh in the boolean operation |
MStatus booleanOps | ( | BoolOperation | op, |
const MObjectArray & | meshes, | ||
bool | useLegacy = false , |
||
BoolClassification | classification = kNormalClassification |
||
) |
Changed in 2023.0
Computes the boolean between multiple meshes.
The result is stored in the current MFnMesh instance. The current instance must point to a valid mesh, which can be empty. Such a mesh can result from using MFnMesh::create() for example.
The union operation adds the meshes in the array together. The difference operation subtracts the proceeding meshes from the first mesh in the array. The intersection operation takes only the parts of the mesh volumes which overlap. The current MFnMesh instance is not used as input to the boolean operation.
The operation is performed in object space, so transformations applied by the DAG hierarchy are ignored. If you want transformations to be taken into account then you will have to first bake them onto the geometry, for example by using the makeIdentity command.
[in] | op | Operation to perform (kUnion, kDifference or kIntersection) |
[in] | meshes | The meshes for the boolean operation |
[in] | useLegacy | Flag to indicate if Maya's legacy boolean algorithm should be used. The legacy algorithm produces lower quality results, and should only be used when required to match boolean results from versions of Maya prior to 2015. |
[in] | classification | Flag to indicate how intersections of open and closed manifolds are treated. This flag does not apply to the legacy algorithm and will be ignored when useLegacy is true. |
|
static |
Creates a MMeshIsectAccelParams configuration object that can be passed to several of the geometric query methods available on MFnMesh.
For example, the MFnMesh closest point and intersection methods can optionally make use of this object to speed up their operation.
This object specifies the number of voxel cells to be used in the x, y, and z dimensions. The grid acceleration structure will be cached with the mesh, so that if the same MMeshIsectAccelParams configuration is used on the next call, the acceleration structure will not need to be rebuilt.
To see details of the acceleration structure, including build time and memory usage, refer to the cachedIntersectionAcceleratorInfo() method.
[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 |
Note that the cached data can become invalid and need to be explicitely freed when the mesh is modified. For example, if a mesh is skinned, then when the skin is deformed, the cached intersection data must be freed. It will be recalculated the next time the MMeshIsectAccelParams is used. Call MFnMesh::freeCachedIntersectionAccelerator() to free the cached information and force a recalculation.
|
static |
Creates a MMeshIsectAccelParams configuration object that can be passed to several of the geometric query methods on MFnMesh to speed up their operation.
For example, the MFnMesh closest point and intersection methods can optionally make use of this object.
This object specifies that a uniform voxel grid structure should be used by these routines, and that the system should automatically determine the number of voxel cells to use based on the density of triangles in the mesh. The grid acceleration structure will be cached with the mesh, so that if the same MMeshIsectAccelParams configuration is used on the next call, the acceleration structure will not need to be rebuilt.
To see details of the acceleration structure, including build time and memory usage, refer to the cachedIntersectionAcceleratorInfo() method.
Note that the cached data can become invalid and need to be explicitely freed when the mesh is modified. For example, if a mesh is skinned, then when the skin is deformed, the cached intersection data must be freed. It will be recalculated the next time the MMeshIsectAccelParams is used. Call MFnMesh::freeCachedIntersectionAccelerator() to free the cached information and force a recalculation.
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-nullptr and triIds is nullptr, then only the faces specified by faceIds will be considered for intersection. If both faceIds and triIds are non-nullptr, 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 nullptr, 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 nullptr, 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.
[in] | raySource | Starting point for the ray |
[in] | rayDirection | Direction of the ray |
[in] | faceIds | (see above) if non-nullptr, describes a subset of faces to consider for intersection. |
[in] | triIds | (see above) if non-nullptr, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-nullptr, then faceIds must be non-nullptr 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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 |
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-nullptr and triIds is nullptr, then only the faces specified by faceIds will be considered for intersection. If both faceIds and triIds are non-nullptr, 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 nullptr, 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 nullptr, 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.
[in] | raySource | Starting point for the ray |
[in] | rayDirection | Direction of the ray |
[in] | faceIds | (see above) if non-nullptr, describes a subset of faces to consider for intersection. |
[in] | triIds | (see above) if non-nullptr, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-nullptr, then faceIds must be non-nullptr 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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 |
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-nullptr and triIds is nullptr, then only the faces specified by faceIds will be considered for intersection. If both faceIds and triIds are non-nullptr, 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 nullptr, 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 nullptr, 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.
[in] | raySource | Starting point for the ray |
[in] | rayDirection | Direction of the ray |
[in] | faceIds | (see above) if non-nullptr, describes a subset of faces to consider for intersection. |
[in] | triIds | (see above) if non-nullptr, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-nullptr, then faceIds must be non-nullptr 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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 |
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.
[in,out] | faceIds | Face IDs to be sorted. |
[in,out] | triIds | Triangle IDs to be sorted. |
MStatus freeCachedIntersectionAccelerator | ( | ) |
If the mesh has a cached accelerator structure, then this routine forces it to be deleted.
Ordinarily, these structures are cached so that series of calls to the geometric query methods that make use of it can reuse the same structure. Once the client is finished with a series of method calls, however, they are responsible for freeing the acceleration structure, which is what this method does.
In particular, if the mesh is modified, then the cached accelerator structure must be freed. Otherwise, the intersection functions will return incorrect results.
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.
[out] | ReturnStatus | Status code. |
|
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:
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.
|
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 nullptr 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.
[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 |
MStatus getClosestPointAndNormal | ( | const MPoint & | toThisPoint, |
MPoint & | theClosestPoint, | ||
MVector & | theNormal, | ||
MSpace::Space | space = MSpace::kObject , |
||
int * | closestPolygon = NULL , |
||
MMeshIsectAccelParams * | accelParams = NULL |
||
) | const |
Returns the closest point on this surface to the given point.
This method also returns the surface normal at that point.
If world space is specified then the returned point and normal will be in world space. In this case The test point (toThisPoint) is assumed to be in world space.
This method is not threadsafe. For a threadsafe closest point implementation, use the MMeshIntersector class.
[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 |
[in] | accelParams | optional acceleration parameters |
MStatus getClosestPoint | ( | const MPoint & | toThisPoint, |
MPoint & | theClosestPoint, | ||
MSpace::Space | space = MSpace::kObject , |
||
int * | closestPolygon = NULL , |
||
MMeshIsectAccelParams * | accelParams = NULL |
||
) | const |
Returns the closest point on this surface to the given point.
If world space is specified then the returned point will be in world space. In this case The test point (toThisPoint) is assumed to be in world space.
This method is not threadsafe. For a threadsafe closest point implementation, use the MMeshIntersector class.
[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 |
[in] | accelParams | optional acceleration parameters |
MStatus getClosestNormal | ( | const MPoint & | toThisPoint, |
MVector & | theNormal, | ||
MSpace::Space | space = MSpace::kObject , |
||
int * | closestPolygon = NULL , |
||
MMeshIsectAccelParams * | accelParams = NULL |
||
) | const |
Returns the closest point on this surface to the given point.
This method also returns the surface normal at that point.
If world space is specified then the returned normal will be in world space. In this case The test point (toThisPoint) is assumed to be in world space.
[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 |
[in] | accelParams | optional acceleration parameters |
MStatus getClosestUVs | ( | const float2 & | toThisUVPoint, |
MIntArray & | uvIds, | ||
const MString * | uvSet = NULL |
||
) | const |
Returns the IDs of the UVs on this surface which are nearest in uv space to the given uv set and coordinate.
All these UVs locate at the same distance to the given coordinate.
[in] | toThisUVPoint | UV coordinate to be compared |
[out] | uvIds | The list of the closest uvs ids |
[in] | uvSet | UV set to work with |
MStatus intersectFaceAtUV | ( | const float2 & | toThisUVPoint, |
int & | faceId, | ||
const MString * | uvSet = NULL |
||
) | const |
Returns ID of the intersected face at given uv set and coordinate.
If multiple faces are intersected, the first intersected one would be returned.
This method is not threadsafe.
[in] | toThisUVPoint | UV coordinate to be compared |
[out] | faceId | Intersected face ID |
[in] | uvSet | UV set to work with |
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.
[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. |
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 nullptr 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.
[in] | source | the mesh to be copied |
[in] | parentOrOwner | the DAG parent or kMeshData the new mesh will belong to |
[out] | ReturnStatus | Status code |
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.
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.
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.
const double * getRawDoublePoints | ( | MStatus * | ReturnStatus | ) | const |
This method returns a pointer to the internal vertex list for this mesh.
The points are in local space.
The points are stored in a single contiguous array of doubles, first by coordinate, then by element (xyzxyz...) There are three coordinate values, so each vertex is stored in 24 bytes of data, and the total array length is 24*numVertices() bytes.
This method is useful where performance is critical or memory resources are limited, as it avoids having to make a copy of the points as is done by getVertices. Care must be taken however as the returned pointer may become invalid if any changes are made to the mesh.
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.
Introduced in 2023.0
This method returns a pointer to the internal texture coordinates for this mesh.
[in] | uvSet | UV set to work with |
This method is not threadsafe.
MStatus getPoints | ( | MFloatPointArray & | vertexArray, |
MSpace::Space | space = MSpace::kObject |
||
) | const |
This method copies the vertex list for this mesh into the given point array.
[out] | vertexArray | Storage for the vertex list |
[in] | space | Specifies the coordinate system for this operation |
MStatus getPoints | ( | MPointArray & | vertexArray, |
MSpace::Space | space = MSpace::kObject |
||
) | const |
This method copies the vertex list for this mesh into the given point array.
[out] | vertexArray | Storage for the vertex list |
[in] | space | Specifies the coordinate system for this operation |
MStatus setPoints | ( | MFloatPointArray & | vertexArray, |
MSpace::Space | space = MSpace::kObject |
||
) |
This method copies the points in the given point array to the vertices of this polygon.
To keep this method as fast as possible, no checking of the data is performed beyond ensuring that the total number of points passed in is correct. It is up to the caller to ensure that the points provide a valid mesh, for example by ensuring that there are no degenerate faces or non-manifold geometry.
[out] | vertexArray | Storage for the vertex list |
[in] | space | Specifies the coordinate system for this operation |
MStatus setPoints | ( | MPointArray & | vertexArray, |
MSpace::Space | space = MSpace::kObject |
||
) |
This method copies the points in the given point array to the vertices of this mesh.
To keep this method as fast as possible, no checking of the data is performed beyond ensuring that the total number of points passed in is correct. It is up to the caller to ensure that the points provide a valid mesh, for example by ensuring that there are no degenerate faces or non-manifold geometry.
[in] | vertexArray | Storage for the vertex list |
[in] | space | Specifies the coordinate system for this operation |
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.
[out] | vertexCount | Vertex count per polygon |
[out] | vertexList | Storage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned. |
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.
[in] | polygonId | The polygon to examine |
[out] | vertexList | Storage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned. |
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.
[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. |
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.
[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 |
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.
[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 |
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.
[out] | normals | Storage for the per-polygon per-vertex normal list |
[in] | space | Specifies the coordinate system for this operation |
MStatus setNormals | ( | MFloatVectorArray & | normals, |
MSpace::Space | space = MSpace::kObject |
||
) |
Set the normal array (user normals)
[in] | normals | The normal array to set |
[in] | space | World space or Object space |
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.
[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 |
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.
[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 |
Get normal indices for all vertices of all faces.
The normalIds can be used to index into an array returned by MFnMesh::getNormals();
This method is not threadsafe.
[out] | normalCounts | Number of normals for each face |
[out] | normals | Storage for the per-polygon normal ids |
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.
[in] | faceIndex | Index of face (polygon) of interest |
[out] | normals | Storage for the per-polygon normal ids |
MStatus setFaceVertexNormal | ( | MVector & | normalIn, |
int | faceId, | ||
int | vertexId, | ||
MSpace::Space | space = MSpace::kObject , |
||
MDGModifier * | modifier = NULL |
||
) |
Set Normal for this face/vertex pair.
[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. |
MStatus setVertexNormal | ( | MVector & | normalIn, |
int | vertexId, | ||
MSpace::Space | space = MSpace::kObject , |
||
MDGModifier * | modifier = NULL |
||
) |
Set Shared Normal for this vertex.
[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. |
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.
[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 |
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.
[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 |
MStatus getVertexNormal | ( | int | vertexId, |
MVector & | normal, | ||
MSpace::Space | space = MSpace::kObject |
||
) | const |
Deprecated in 2019.0
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
bool isNormalLocked | ( | int | normalId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Test if the normal for a face/vertex pairs is locked (user defined).
[in] | normalId | Normal to test. |
[out] | ReturnStatus | Status code. |
Lock Shared Normals for these vertices.
[in] | vertexList | The object-relative (global) verticex ides to lock normals for |
Lock Normals for these face/vertex pairs.
[in] | faceList | The faces to lock normal in |
[in] | vertexList | The corresponding object-relative (global) vertex indices to lock them for |
Unlock Shared Normals for these vertices.
[in] | vertexList | The vertices to unlock normals for |
Unlock Normals for these face/vertex pairs.
[in] | faceList | The faces to unlock normal in |
[in] | vertexList | The corresponding object-relative (global) vertex indices to unlock them for |
int getTangentId | ( | int | faceIndex, |
int | vertexIndex, | ||
MStatus * | ReturnStatus = NULL |
||
) | const |
Return the tangent index for a given face vertex.
[in] | faceIndex | Index of the face of interest. |
[in] | vertexIndex | The object-relative (mesh-relative/global) vertex index. |
[out] | ReturnStatus | Status code |
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.
[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. |
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.
[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. |
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.
[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. |
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.
[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. |
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.
[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. |
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.
[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. |
bool isRightHandedTangent | ( | int | tangentId, |
const MString * | uvSetName = NULL , |
||
MStatus * | ReturnStatus = NULL |
||
) | const |
Returns true if the normal, tangent and binormal form a right handed coordinate system.
By default, Maya uses a right-handed system. Mirrored geometry can introduce a left-handed system.
[in] | tangentId | tangent index for a given face vertex |
[in] | uvSetName | Name of uv set to use |
[out] | ReturnStatus | Status code |
bool isPolygonConvex | ( | int | faceIndex, |
MStatus * | ReturnStatus = NULL |
||
) | const |
This method determines if the specified polygon is convex.
[in] | faceIndex | The polygon to be tested |
[out] | ReturnStatus | Status code |
MFnMesh::BorderInfo edgeBorderInfo | ( | int | edgeId, |
unsigned int | setId = -1 , |
||
MStatus * | ReturnStatus = NULL |
||
) | const |
Introduced in 2023.0
This method tells if the specified edge is on geom/UV shell border or has shared/unshared UVs.
[in] | edgeId | The edge to be tested |
[out] | ReturnStatus | Status code |
Introduced in 2023.0
This method retrieves the edge indices for edges lying on a UV border.
[in] | setId | The UV set ID |
[out] | edgeList | Storage for the edge indices |
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.
[in] | edgeId | The edge to get the vertices for |
[out] | vertexList | Storage for the 2 object-relative vertex indices |
bool isEdgeSmooth | ( | int | edgeId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
This method determines if the specified edge is smooth (soft).
[in] | edgeId | The edge to be tested |
[out] | ReturnStatus | Status code |
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.
[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. |
This method sets the specified edges to be hard or smooth (soft).
You must use the cleanupEdgeSmoothing method after all the desired edges on your mesh have had setEdgeSmoothing done. Use the updateSurface method to indicate the mesh needs to be redrawn.
[in] | edgeIds | The edges to set the smoothing information for |
[in] | smooths | If true the edges will be smooth (soft), otherwise the edges will be hard. |
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.
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).
[out] | edgeIds | The list of crease edges ids. |
[out] | creaseData | The data related to the crease edges. |
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).
[in] | edgeIds | The list of crease edges ids. |
[in] | creaseData | The data related to the crease edges. |
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.
[out] | ReturnStatus | status code |
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.
[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. |
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).
[out] | vertexIds | The list of crease vertices ids. |
[out] | creaseData | The data related to the crease vertices. |
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).
[in] | vertexIds | The list of crease vertices ids. |
[in] | creaseData | The data related to the crease vertices. |
int numUVSets | ( | MStatus * | ReturnStatus = NULL | ) | const |
Returns the number of uv sets for an object.
[out] | ReturnStatus | return status value |
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.
[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 nullptr if the uv-set should be shared by all instances. |
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.
[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. |
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.
[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. |
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.
[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. |
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.
[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. |
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.
[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. |
MStatus getUVSetNames | ( | MStringArray & | setNames | ) | const |
Get the names of all of the uv sets on this object.
[out] | setNames | Array of uv set names found |
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.
[out] | familyNames | Array of uv set names found |
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.
[in] | familyName | The uv set family name |
[out] | setNames | Array of uv set names in the family |
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.
[in] | name | The set name or set family name |
[out] | ReturnStatus | Status code |
MStatus getFaceUVSetNames | ( | int | polygonId, |
MStringArray & | setNames | ||
) | const |
This method returns the list of UV sets mapped to a face.
This method is not threadsafe.
[in] | polygonId | The polygon ID of the face of interest |
[out] | setNames | The string array to return the UV sets names in |
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.
[in] | uvSetName | Name of uv set to use |
[out] | textures | Texture nodes using the uv set |
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.
[in] | uvSetName | Name of uv set to use |
[out] | instances | Instances associated with this uv set |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 | barycentric tolerance |
MStatus getPointsAtUV | ( | MIntArray & | polygonIds, |
MPointArray & | points, | ||
const float2 & | uvPoint, | ||
MSpace::Space | space = MSpace::kObject , |
||
const MString * | uvSet = NULL , |
||
float | tolerance = kMFnMeshTolerance |
||
) | const |
Return the positions of the points at the given UV value on the mesh.
[out] | polygonIds | Storage for polygon ids to the return points. |
[out] | points | Storage for the points on this surface to the given uv set and coordinate |
[in] | uvPoint | UV coordinate to be compared |
[in] | space | The coordinate system to return "points" in |
[in] | uvSet | UV set to work with |
[in] | tolerance | tolerance value to compare float data type |
MStatus getUVAtPoint | ( | MPoint & | pt, |
float2 & | uvPoint, | ||
MSpace::Space | space = MSpace::kObject , |
||
const MString * | uvSet = NULL , |
||
int * | closestPolygon = NULL |
||
) |
Find the point closest to the given point, and return the UV value at that point.
This method is not threadsafe.
[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 |
[out] | closestPolygon | polygon id of the closest polygon |
MStatus getAxisAtPoint | ( | MPoint & | pt, |
MVector & | normal, | ||
MVector & | uTangent, | ||
MVector & | vTangent, | ||
MSpace::Space | space = MSpace::kObject , |
||
const MString * | uvSet = NULL , |
||
int * | closestPolygon = NULL |
||
) |
Find the point on the mesh which is closest to the given point, and return the axis at that point.
The axis or affine space is defined by non-normalized and non-orthogonized U tangent, V tangent and normal. It's useful to detect local surface deformation for meshes with similar UV mapping.
This method is not threadsafe.
[in] | pt | The point to be queried |
[out] | normal | Space for the normal |
[out] | uTangent | Space for the U tangent |
[out] | vTangent | Space for the V tangent |
[in] | space | The coordinate system for this operation |
[in] | uvSet | UV set to work with |
[out] | closestPolygon | polygon id of the closest polygon |
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.
[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 |
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.
[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 |
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).
[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 |
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.
[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 |
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.
[in] | uvSet | UV set to work with |
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.
[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 |
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.
[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 |
MStatus getMeshShellsIds | ( | MFn::Type | compType, |
MIntArray & | meshShellIds, | ||
unsigned int & | nbMeshShells | ||
) | const |
Introduced in 2023.0
Constructs an array of unique integer for each mesh shell.
This method let the user identify each connected piece of mesh.
The meshShellIds array that is returned will contain a mesh shell number for each face. This number uniquely identifies a connected set of components. Numbers are positive, starting at 0.
For example, the array { 0, 0, 0, 1, 1, 1, 1, 0} would represent an object where components 0, 1, 2 and 7 are connected together (mesh shell number 0), and components 3 to 6 belong to shell number 1.
[in] | compType | The type of component we query for: kMeshPolygonComponent, kMeshVertComponent, kMeshEdgeComponent |
[out] | meshShellIds | The container for the mesh shell Ids |
[out] | nbMeshShells | The number of mesh shells. |
MStatus getPinUVs | ( | MUintArray & | uvIds, |
MDoubleArray & | pinData, | ||
const MString * | uvSet = NULL |
||
) | const |
This method returns the pin uvs of the mesh, and also the pin data associated with those uvs.
[out] | uvIds | The list of pin uvs ids. |
[out] | pinData | The list of pin weights. |
[in] | uvSet | UV set to work with. |
MStatus setPinUVs | ( | const MUintArray & | uvIds, |
const MDoubleArray & | pinData, | ||
const MString * | uvSet = NULL |
||
) |
This method sets the specified uvs of the mesh as "pinned" uvs, a "pinned" uv is one which should not be modified.
If pin weight is set to 1.0 then it becomes fully pinned and uv tools should not modify that uv. If the pin weight is set to a value between 0.0 and 1.0 then uv tools should weight their changes to that uv accordingly.
[in] | uvIds | The list of pin uvs ids. |
[in] | pinData | The list of pin weights. |
[in] | uvSet | UV set to work with. |
bool isPolygonUVReversed | ( | int | polygonId, |
const MString * | uvSet = NULL , |
||
MStatus * | ReturnStatus = NULL |
||
) | const |
This method determines if the winding order of texture coordinates (uv's) for specified polygon are reversed (clockwise)
[in] | polygonId | The polygon to be tested |
[in] | uvSet | UV set to work with |
[out] | ReturnStatus | Status code |
int numColorSets | ( | MStatus * | ReturnStatus = NULL | ) | const |
Returns the number of color sets for an object.
[out] | ReturnStatus | return status value |
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.
[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 nullptr if the uv-set should be shared by all instances. |
[in] | ReturnStatus | Status code. See below. |
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.
[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. |
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.
[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. |
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.
[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. |
MStatus getColorSetNames | ( | MStringArray & | setNames | ) | const |
Get the names of all of the colors sets on this object.
[out] | setNames | Array of color set names found |
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.
[out] | familyNames | Array of color set names found |
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.
[out] | familyName | The color set family name |
[out] | setNames | Array of color set names in the family |
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.
[in] | name | The set name or set family name |
[out] | ReturnStatus | Status code |
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.
[in] | colorSetName | Name of color set to use |
[out] | instances | Instances associated with this color set |
Set vertex-face Color for all vertices on this face.
[in] | color | The color to set |
[in] | faceIndex | The face to set it for |
MStatus setFaceColor | ( | MColor & | color, |
int | faceIndex, | ||
MColorRepresentation | rep | ||
) |
Set vertex-face Color of specified channels for all vertices on this face.
[in] | color | The color to set |
[in] | faceIndex | The face to set it for |
[in] | rep | The RGB/RGBA/A channel(s) to set |
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.
[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. |
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.
[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 |
MStatus setFaceVertexColor | ( | MColor & | color, |
int | faceIndex, | ||
int | vertexIndex, | ||
MDGModifier * | modifier = NULL |
||
) |
Set color for this vertex in this face.
[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. |
MStatus setFaceVertexColor | ( | MColor & | color, |
int | faceIndex, | ||
int | vertexIndex, | ||
MDGModifier * | modifier, | ||
MColorRepresentation | rep | ||
) |
Set color of specified channels for this vertex in this face.
[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 |
MStatus setFaceVertexColor | ( | int | faceIndex, |
int | localVertexIndex, | ||
MColor & | color, | ||
MDGModifier * | modifier = NULL |
||
) |
Set color for this vertex in this face.
[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. |
MStatus setFaceVertexColor | ( | int | faceIndex, |
int | localVertexIndex, | ||
MColor & | color, | ||
MDGModifier * | modifier, | ||
MColorRepresentation | rep | ||
) |
Set color of specified channels for this vertex in this face.
[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 |
MStatus setFaceColors | ( | MColorArray & | colors, |
MIntArray & | faceList | ||
) |
Set color for these faces.
The color will be set for each vertex-face component of a face.
[in] | colors | The colors to set |
[in] | faceList | The faces to set it for |
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.
[in] | colors | The colors to set |
[in] | faceList | The faces to set it for |
[in] | rep | The RGB/RGBA/A channel(s) to set |
MStatus setVertexColors | ( | MColorArray & | colors, |
MIntArray & | vertexList, | ||
MDGModifier * | modifier = NULL |
||
) |
Set color for these vertices.
[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. |
MStatus setVertexColors | ( | MColorArray & | colors, |
MIntArray & | vertexList, | ||
MDGModifier * | modifier, | ||
MColorRepresentation | rep | ||
) |
Set color of specified channels for these vertices.
[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 |
MStatus setFaceVertexColors | ( | MColorArray & | colors, |
MIntArray & | faceList, | ||
MIntArray & | vertexList, | ||
MDGModifier * | modifier = NULL |
||
) |
Set colors for these face/vertex pairs.
[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. |
MStatus setFaceVertexColors | ( | MColorArray & | colors, |
MIntArray & | faceList, | ||
MIntArray & | vertexList, | ||
MDGModifier * | modifier, | ||
MColorRepresentation | rep | ||
) |
Set colors of specified channels for these face/vertex pairs.
[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 |
Remove previously set color these faces.
For each face, the color will be unset for each vertex-face component in the face.
[in] | faceList | The faces to remove color from |
Remove color from these vertices.
[in] | vertexList | The object-relative (mesh-relative/global) vertex indices to remove color from |
Remove colors for these face/vertex pairs.
[in] | faceList | The faces to remove color for |
[in] | vertexList | The corresponding object-relative (mesh-relative/global) vertex indices to remove color for |
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.
[out] | colors | Storage for the colors to be returned. |
[in] | colorSet | Color set name |
[in] | defaultUnsetColor | Default Unset color |
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.
[out] | colors | Storage for the colors to be returned. |
[in] | colorSet | Color set name |
[in] | defaultUnsetColor | Default unset color |
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.
[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 |
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.
[in] | colorArray | The array of color values to be set |
[in] | colorSet | The color set to work with |
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.
[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 |
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.
[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 |
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.
[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 |
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 returned. If defaultUnsetColor is not set, (0,0,0,1) will be returned.
[out] | colorArray | Storage for the color values list |
[in] | colorSet | Color set to work with |
[in] | defaultUnsetColor | Default unset color |
MStatus getColorIndex | ( | int | faceIndex, |
int | localVertexIndex, | ||
int & | colorIndex, | ||
const MString * | colorSet = NULL |
||
) |
Get an index into the array returned by getColors.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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).
[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 |
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.
[in] | colorIds | The color indices to be mapped to each polygon-vertex |
[in] | colorSet | Color set to work with |
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.
[in] | colorSet | Color set to work with |
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.
[out] | ReturnStatus | The return status of the method |
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.
[in] | enable | True to turn on color display, false to turn it off. |
int getHoles | ( | MIntArray & | holeInfoArray, |
MIntArray & | holeVertexArray, | ||
MStatus * | ReturnStatus = NULL |
||
) |
Retrieves a list of the holes in the polygon.
[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. |
bool onBoundary | ( | int | polygonId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
A method to determines whether the specified face in the mesh is a boundary face.
[in] | polygonId | The polygon (face) to examine |
[out] | ReturnStatus | The return status of the method |
bool isBlindDataTypeUsed | ( | int | blindDataId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Is this BlindData type id is already in use in this scene?
[in] | blindDataId | The blind data id to check for |
[out] | ReturnStatus | Status Code |
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".
[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. |
bool hasBlindDataComponentId | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MStatus * | ReturnStatus = NULL |
||
) | const |
Does this component have blind data with the given ID.
[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 if any component of the given type on this mesh have blind data with the given ID.
[in] | compType | The component type e.g. MFn::kMeshVertComponent |
[in] | blindDataId | The blind data id to check for |
[out] | ReturnStatus | Status Code |
bool hasBlindDataComponentId | ( | int | compID, |
MFn::Type | compType, | ||
MStatus * | ReturnStatus = NULL |
||
) | const |
Does this component have any kind of blind data.
[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 |
Does any component of this type have any blind data.
(.e. is there any vertex blind data on this mesh?)
[in] | compType | The component type e.g. MFn::kMeshVertComponent |
[out] | ReturnStatus | Status Code |
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)
[in] | compType | The component type e.g. MFn::kMeshVertComponent |
[out] | blindDataIds | space for this list of blind data id values. |
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".
[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 |
MStatus getFaceVertexBlindDataIndex | ( | int | faceIndex, |
int | vertexIndex, | ||
int & | blindDataIndex | ||
) | const |
Get the single index to retrieve face-vertex blind data.
[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 |
MStatus getBlindDataFaceVertexIndices | ( | int | blindDataIndex, |
int & | faceIndex, | ||
int & | vertexIndex | ||
) | const |
Get the face and vertex indices from the face-vertex blind data index.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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 |
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.
[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. |
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.
[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 |
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.
[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. |
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.
[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 |
MStatus setIntBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
int | data | ||
) |
Set a value for an integer blind data attribute.
[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 |
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.
[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 |
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.
[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 |
MStatus setFloatBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
float | data | ||
) |
Set a value for a float blind data attribute.
[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 |
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.
[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 |
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.
[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 |
MStatus setDoubleBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
double | data | ||
) |
Set a value for a double blind data attribute.
[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 |
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.
[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 |
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.
[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 |
MStatus setBoolBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
bool | data | ||
) |
Set a value for a boolean blind data attribute.
[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 |
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.
[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 |
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.
[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 |
MStatus setStringBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
MString | data | ||
) |
Set a value for a string blind data attribute.
[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 |
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.
[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 |
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.
[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 |
MStatus setBinaryBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
MString | data | ||
) |
Set a value for a binary blind data attribute.
[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. |
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.
[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 |
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.
[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 |
MStatus setBinaryBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
char * | data, | ||
int | length | ||
) |
Set a value for a binary blind data attribute.
[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 |
Delete a value for a binary blind data attribute on a particular componenr.
[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 |
Delete the values for the given attribute on the given binary blind data type from all components of the given type.
[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 |
Delete all blind data from components of the given type, e.g.
all edges from a particular component.
[in] | compType | The component type e.g. MFn::kMeshVertComponent |
Delete the values for a binary blind data type (all its attributes) from a particular component.
[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 |
Delete the values for a binary blind data type (all its attributes) from all components of the given type.
[in] | compType | The component type e.g. MFn::kMeshVertComponent |
[in] | blindDataId | The id for the blind data to be cleared |
Get a string representing a particular component type.
[in] | compType | The type of component to fetch |
[out] | status | Status Code |
Get a component type from its string name.
[in] | assocName | String representing the component 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.
Checking for duplicates, is the default state.
[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.
If the functionset is operating on a mesh node with construction history, this method will fail as the node will continue to get its geometry from its history connection. To use this method you must first break the history connection.
[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 } |
This method creates copies the given source mesh onto the current surface.
After the copy this function set continues operate on the original mesh.
[in] | source | the mesh to be copied |
|
static |
Triangulates a polygon.
The polygon consists of 2D positions with optional 3D normals and holes. These 2D positions can be in any coordinate system. 3D positions can be projected to a 2D plane by its face normal. 3D normals are references to help triangulation. This function can work without normals but normals can improve the quality. This function works with pointers and is more efficient than the other variant.
[in] | pointsAndHoles | Array of 2D positions and hole description. The array contains 2D positions (x,y) followed by the hole offsets. For example, if pointsAndHoles = [x1, y1, x2, y2, ..., x9, y9, o1, o1, o2, o2], then this means that (x1, y1) ~ (x9, y9) are positions, o1 is the offset for the first loop and o2 is the offset for the second loop. |
[in] | pointsCount | The number of 2D positions in pointsAndHoles |
[in] | outerPointsCount | The number of outer (non-hole) 2D positions in pointsAndHoles |
[in] | holesCount | The number of holes in pointsAndHoles |
[in] | considerNormal | If true then normals are considered during triangulation |
[in] | normals | Array of 3D normals. If considerNormal is false, this array can be nullptr. If considerNormal is true, then there must be one normal per point. |
[out] | triangles | Array of triangle indices into pointsAndHoles array. The size of this array is trianglesCount * 3 |
[out] | trianglesCount | The number of triangles written in triangles array |
|
static |
Triangulates a polygon.
The polygon consists of positions with optional normals and holes. Normals are references to help triangulation. This function can work without normals but normals can improve the quality. A simple example:
MFloatPointArray Points; MIntArray Holes; MFloatVectorArray Normals; MIntArray Triangles;
Points.append(MFloatPoint(-1, 0, -1)); Points.append(MFloatPoint(-1, 0, 1)); Points.append(MFloatPoint(1, 0, 1)); Points.append(MFloatPoint(1, 0, -1)); Points.append(MFloatPoint(0.5, 0, -0.5)); Points.append(MFloatPoint(0.5, 0, 0.5)); Points.append(MFloatPoint(-0.5, 0, 0.5)); Points.append(MFloatPoint(-0.5, 0, -0.5)); Holes.append(4) // the 1st hole starts at 4th in Points for (unsigned int i = 0; i < 8; i++) Normals.append(MFloatVector(0, 1, 0));
MFnMesh::polyTriangulate(Points, Holes, 4, Normals, Triangles)
[in] | points | Array of 3D points. The poly's outer vertices come first, followed by the vertices for each hole. |
[in] | holes | Array of offsets into the 'points' array indicating where each hole's vertices start. |
[in] | outerPointsCount | The number of outer (non-hole) positions in points array |
[in] | normals | Array of normals. This array can be empty. If this array is not empty, then there must be one normal per point. |
[out] | triangles | Array of triangle indices into points array |
MString createColorSetWithName | ( | const MString & | colorSetName, |
MDGModifier * | modifier, | ||
MStatus * | ReturnStatus | ||
) |
Deprecated in 2019.0
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.
[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. |
Deprecated in 2019.0
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 nullptr 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.
[in] | parentOrOwner | parent of the polygon that will be created |
[out] | ReturnStatus | Status code |
Deprecated in 2019.0
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.
[out] | ReturnStatus | Status code. See below. |
MObject addPolygon | ( | MPointArray & | vertexArray, |
double | polyTolerance, | ||
bool | mergeVertices = true , |
||
double | pointTolerance = kMFnMeshPointTolerance , |
||
bool | forceGeometry = true , |
||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Deprecated in 2019.0
Not available in Python.
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 nullptr 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.
[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 |
bool intersect | ( | MPoint & | raySource, |
MVector & | rayDirection, | ||
MPointArray & | points, | ||
MStatus * | ReturnStatus = NULL |
||
) | const |
Deprecated in 2019.0
Not available in Python.
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.
[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 |
bool intersect | ( | const MPoint & | raySource, |
const MVector & | rayDirection, | ||
MPointArray & | points, | ||
MStatus * | ReturnStatus = NULL |
||
) | const |
Deprecated in 2019.0
Not available in Python.
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.
[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 |
MStatus getBlindDataAttrNames | ( | int | blindDataId, |
MStringArray & | longNames, | ||
MStringArray & | shortNames | ||
) | const |
Not available in Python.
Get the blind data attribute names for the specified blind data type id.
[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 |
bool hasBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MStatus * | ReturnStatus = NULL |
||
) | const |
Deprecated in 2019.0
Not available in Python.
[in] | compID | |
[in] | compType | |
[in] | blindDataId | |
[out] | ReturnStatus |
Deprecated in 2019.0
Not available in Python.
[in] | compID | |
[in] | compType | |
[out] | ReturnStatus |
MStatus createUVSet | ( | MString & | uvSetName, |
MDGModifier * | modifier = NULL , |
||
const MUintArray * | instances = NULL |
||
) |
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()
[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 nullptr if the uv-set should be shared by all instances. |
MStatus copyUVSet | ( | const MString & | fromName, |
MString & | toName, | ||
MDGModifier * | modifier = NULL |
||
) |
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
[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. |
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.
[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. |
MStatus createColorSet | ( | MString & | colorSetName, |
MDGModifier * | modifier = NULL , |
||
const MUintArray * | instances = NULL |
||
) |
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()
[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 nullptr if the uv-set should be shared by all instances. |
MStatus createColorSet | ( | MString & | colorSetName, |
MDGModifier * | modifier, | ||
bool | clamped, | ||
MColorRepresentation | rep, | ||
const MUintArray * | instances = NULL |
||
) |
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()
[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 nullptr if the uv-set should be shared by all instances. |
MStatus getCurrentColorSetName | ( | MString & | setName, |
int | instance = kMFnMeshInstanceUnspecified |
||
) | const |
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().
[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. |
MStatus getStringBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
MString & | data | ||
) | const |
Deprecated in 2019.0
Not available in Python.
[in] | compID | |
[in] | compType | |
[in] | blindDataId | |
[in] | attrName | |
[out] | data |
MStatus getBinaryBlindData | ( | int | compID, |
MFn::Type | compType, | ||
int | blindDataId, | ||
MString | attrName, | ||
MString & | data | ||
) | const |
Deprecated in 2019.0
Not available in Python.
[in] | compID | |
[in] | compType | |
[in] | blindDataId | |
[in] | attrName | |
[out] | data |
|
overridevirtual |
Not available in Python.
Get the current metadata associated with this mesh.
When the MFnMesh is a mesh node then the metadata returned will be that associated with the output mesh attribute. When it is simple mesh data then the metadata returned is that belonging directly to that mesh data.
Metadata is shared and reference counted so the sequence of events for editing metadata inside a node with an input mesh and output mesh is: MFnMesh inMesh = theInputMesh(); MFnMesh outMesh = theOutputMesh(); const adsk::Data::Associations newMetadata( inMesh.metadata() ); doMetadataEditing( newMetadata ); outMesh.setMetadata( &newMetadata ); The "doMetadataEditing" call will take care of copying anything you are changing so that there is a minimum amount of duplication. After this sequence the inMesh and outMesh will contain different metadata.
[out] | ReturnStatus | Status code. See below. |
Reimplemented from MFnDependencyNode.
|
overridevirtual |
Not available in Python.
Replace the existing metadata with the given values.
[in] | newMetadata | The new associated metadata for this mesh |
Reimplemented from MFnDependencyNode.
Not available in Python.
Verify consistency in all of the existing metadata channels The intended use of this method is to check that the metadata channels are still internally consistent after operations have been performed on the underlying mesh (right number of vertexes, edges, faces, logical connectivity, sensible index values).
It's not meant to provide data validation (e.g. make sure a certain data in a channel is within it's legal range).
[out] | errors | String containing information about what went wrong |
Reimplemented from MFnDependencyNode.
MObject create | ( | const MPointArray & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects, | ||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Introduced in 2023.0
Creates a new polygonal mesh given an array of vertices, edge and polygon connection data and sets this function set to operate on the new surface.
This mesh creation path mirrors the creation method for mayaAscii and mayaBinary file readers.
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 nullptr 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.
[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] | edgeArray | array of vertex connections that define each edge. Each consecutive set of 3 of integers represents the [startVertex,endVertex,smooth] data of an edge. For example, a cube could have the following edges: { 0, 1, 0, 1, 2, 0, 2, 3, 0, 3, 0, 0, 4, 5, 0, 5, 6, 0, 6, 7, 0, 7, 4, 0, 2, 6, 0, 5, 3, 0, 4, 0, 0, 7, 1, 0, } |
[in] | polygonCounts | array of edge counts for each polygon. For example the cube would have 6 faces, each of which had 4 edges, so the polygonCounts would be {4,4,4,4,4,4}. |
[in] | polygonConnects | array of edge connections for each polygon. For example, in the cube, we have 4 edges for each face, so we list the edges for face0, face1, etc consecutively in the array. These are specified by indexes in the edgeArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, -3, 8, -6, 9, -4,-10, -5, 10, -11, -8, 11, -1, -12, -7, -9, -2 } Negative index values are supported and indicate that the edge direction for this edge index entry should be reversed. These negative indices are 1-based. That means: Reversed edgeId 0 == -1 Reversed edgeId 1 == -2 ... Reversed edgeId n == -(n+1) |
[in] | parentOrOwner | parent of the polygon that will be created |
[out] | ReturnStatus | Status code |
MObject create | ( | const MFloatPointArray & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects, | ||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Introduced in 2023.0
Creates a new polygonal mesh given an array of vertices, edge and polygon connection data and sets this function set to operate on the new surface.
This mesh creation path mirrors the creation method for mayaAscii and mayaBinary file readers.
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 nullptr 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.
[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] | edgeArray | array of vertex connections that define each edge. Each consecutive set of 3 of integers represents the [startVertex,endVertex,smooth] data of an edge. For example, a cube could have the following edges: { 0, 1, 0, 1, 2, 0, 2, 3, 0, 3, 0, 0, 4, 5, 0, 5, 6, 0, 6, 7, 0, 7, 4, 0, 2, 6, 0, 5, 3, 0, 4, 0, 0, 7, 1, 0, } |
[in] | polygonCounts | array of edge counts for each polygon. For example the cube would have 6 faces, each of which had 4 edges, so the polygonCounts would be {4,4,4,4,4,4}. |
[in] | polygonConnects | array of edge connections for each polygon. For example, in the cube, we have 4 edges for each face, so we list the edges for face0, face1, etc consecutively in the array. These are specified by indexes in the edgeArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, -3, 8, -6, 9, -4,-10, -5, 10, -11, -8, 11, -1, -12, -7, -9, -2 } Negative index values are supported and indicate that the edge direction for this edge index entry should be reversed. These negative indices are 1-based. That means: Reversed edgeId 0 == -1 Reversed edgeId 1 == -2 ... Reversed edgeId n == -(n+1) |
[in] | parentOrOwner | parent of the polygon that will be created |
[out] | ReturnStatus | Status code |
MObject create | ( | const MPointArray & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects, | ||
const MFloatArray & | uArray, | ||
const MFloatArray & | vArray, | ||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Introduced in 2023.0
Creates a new polygonal mesh given an array of vertices, edge and polygon connection data and sets this function set to operate on the new surface.
This mesh creation path mirrors the creation method for mayaAscii and mayaBinary file readers.
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 nullptr 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.
[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] | edgeArray | array of vertex connections that define each edge. Each consecutive set of 3 of integers represents the [startVertex,endVertex,smooth] data of an edge. For example, a cube could have the following edges: { 0, 1, 0, 1, 2, 0, 2, 3, 0, 3, 0, 0, 4, 5, 0, 5, 6, 0, 6, 7, 0, 7, 4, 0, 2, 6, 0, 5, 3, 0, 4, 0, 0, 7, 1, 0, } |
[in] | polygonCounts | array of edge counts for each polygon. For example the cube would have 6 faces, each of which had 4 edges, so the polygonCounts would be {4,4,4,4,4,4}. |
[in] | polygonConnects | array of edge connections for each polygon. For example, in the cube, we have 4 edges for each face, so we list the edges for face0, face1, etc consecutively in the array. These are specified by indexes in the edgeArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, -3, 8, -6, 9, -4,-10, -5, 10, -11, -8, 11, -1, -12, -7, -9, -2 } Negative index values are supported and indicate that the edge direction for this edge index entry should be reversed. These negative indices are 1-based. That means: Reversed edgeId 0 == -1 Reversed edgeId 1 == -2 ... Reversed edgeId n == -(n+1) |
[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 |
MObject create | ( | const MFloatPointArray & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects, | ||
const MFloatArray & | uArray, | ||
const MFloatArray & | vArray, | ||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Introduced in 2023.0
Creates a new polygonal mesh given an array of vertices, edge and polygon connection data and sets this function set to operate on the new surface.
This mesh creation path mirrors the creation method for mayaAscii and mayaBinary file readers.
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 nullptr 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.
[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] | edgeArray | array of vertex connections that define each edge. Each consecutive set of 3 of integers represents the [startVertex,endVertex,smooth] data of an edge. For example, a cube could have the following edges: { 0, 1, 0, 1, 2, 0, 2, 3, 0, 3, 0, 0, 4, 5, 0, 5, 6, 0, 6, 7, 0, 7, 4, 0, 2, 6, 0, 5, 3, 0, 4, 0, 0, 7, 1, 0, } |
[in] | polygonCounts | array of edge counts for each polygon. For example the cube would have 6 faces, each of which had 4 edges, so the polygonCounts would be {4,4,4,4,4,4}. |
[in] | polygonConnects | array of edge connections for each polygon. For example, in the cube, we have 4 edges for each face, so we list the edges for face0, face1, etc consecutively in the array. These are specified by indexes in the edgeArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, -3, 8, -6, 9, -4,-10, -5, 10, -11, -8, 11, -1, -12, -7, -9, -2 } Negative index values are supported and indicate that the edge direction for this edge index entry should be reversed. These negative indices are 1-based. That means: Reversed edgeId 0 == -1 Reversed edgeId 1 == -2 ... Reversed edgeId n == -(n+1) |
[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 |
MStatus createInPlace | ( | const MPointArray & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects | ||
) |
Introduced in 2023.0
Replaces the existing polygonal mesh with a new one specified by array of vertices, edge and polygon connection data.
This function will then operate on the replacement surface.
This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.
If the functionset is operating on a mesh node with construction history, this method will fail as the node will continue to get its geometry from its history connection. To use this method you must first break the history connection.
[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] | edgeArray | array of vertex connections that define each edge. Each consecutive set of 3 of integers represents the [startVertex,endVertex,smooth] data of an edge. For example, a cube could have the following edges: { 0, 1, 0, 1, 2, 0, 2, 3, 0, 3, 0, 0, 4, 5, 0, 5, 6, 0, 6, 7, 0, 7, 4, 0, 2, 6, 0, 5, 3, 0, 4, 0, 0, 7, 1, 0, } |
[in] | polygonCounts | array of edge counts for each polygon. For example the cube would have 6 faces, each of which had 4 edges, so the polygonCounts would be {4,4,4,4,4,4}. |
[in] | polygonConnects | array of edge connections for each polygon. For example, in the cube, we have 4 edges for each face, so we list the edges for face0, face1, etc consecutively in the array. These are specified by indexes in the edgeArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, -3, 8, -6, 9, -4,-10, -5, 10, -11, -8, 11, -1, -12, -7, -9, -2 } Negative index values are supported and indicate that the edge direction for this edge index entry should be reversed. These negative indices are 1-based. That means: Reversed edgeId 0 == -1 Reversed edgeId 1 == -2 ... Reversed edgeId n == -(n+1) |
MStatus createInPlace | ( | const MFloatPointArray & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects | ||
) |
Introduced in 2023.0
Replaces the existing polygonal mesh with a new one specified by array of vertices, edge and polygon connection data.
This function will then operate on the replacement surface.
This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.
If the functionset is operating on a mesh node with construction history, this method will fail as the node will continue to get its geometry from its history connection. To use this method you must first break the history connection.
[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] | edgeArray | array of vertex connections that define each edge. Each consecutive set of 3 of integers represents the [startVertex,endVertex,smooth] data of an edge. For example, a cube could have the following edges: { 0, 1, 0, 1, 2, 0, 2, 3, 0, 3, 0, 0, 4, 5, 0, 5, 6, 0, 6, 7, 0, 7, 4, 0, 2, 6, 0, 5, 3, 0, 4, 0, 0, 7, 1, 0, } |
[in] | polygonCounts | array of edge counts for each polygon. For example the cube would have 6 faces, each of which had 4 edges, so the polygonCounts would be {4,4,4,4,4,4}. |
[in] | polygonConnects | array of edge connections for each polygon. For example, in the cube, we have 4 edges for each face, so we list the edges for face0, face1, etc consecutively in the array. These are specified by indexes in the edgeArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, -3, 8, -6, 9, -4,-10, -5, 10, -11, -8, 11, -1, -12, -7, -9, -2 } Negative index values are supported and indicate that the edge direction for this edge index entry should be reversed. These negative indices are 1-based. That means: Reversed edgeId 0 == -1 Reversed edgeId 1 == -2 ... Reversed edgeId n == -(n+1) |
MObject commonCreate | ( | const A & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects, | ||
const MFloatArray & | uArray, | ||
const MFloatArray & | vArray, | ||
MObject | parentOrOwner = MObject::kNullObj , |
||
MStatus * | ReturnStatus = NULL |
||
) |
Template (private) version of create.
See create for details.
template MStatus commonCreateInPlace< MPointArray > | ( | const A & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects | ||
) |
Template (private) version of createInPlace.
See createInPlace for details.
MObject commonCreate | ( | const A & | vertexArray, |
const MIntArray & | edgeArray, | ||
const MIntArray & | polygonCounts, | ||
const MIntArray & | polygonConnects, | ||
MObject | parentOrOwner, | ||
MStatus * | ReturnStatus | ||
) |
Template (private) version of create.
See create for details.