class MFnMesh

Jump to documentation

: public MFnDagNode Polygonal surface function set. (OpenMaya) (OpenMaya.py)

Inheritance:

MFnMesh < MFnDagNode < MFnDependencyNode < MFnBase

public members:

MFnMesh ( const MObject & object, MStatus * ReturnStatus = NULL )
enum MColorRepresentation
kAlpha
kRGB
kRGBA
MObject create ( int numVertices , int numPolygons , const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( int numVertices , int numPolygons , const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
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 )
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 )
MObject generateSmoothMesh ( MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject addPolygon ( const MPointArray & vertexArray, bool mergeVertices = true, double pointTolerance = kMFnMeshPointTolerance, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject addPolygon ( const MPointArray & vertexArray, int & faceIndex, bool mergeVertices = true, double pointTolerance = kMFnMeshPointTolerance, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MStatus deleteFace (int index, MDGModifier *modifier = NULL)
MStatus deleteEdge (int index, MDGModifier *modifier = NULL)
MStatus deleteVertex (int index, MDGModifier *modifier = NULL)
enum SplitPlacement
kOnEdge
kInternalPoint
kInvalid
MStatus split ( MIntArray & placements, MIntArray & edgeList, MFloatArray & edgeFactors, MFloatPointArray & internalPoints)
MStatus subdivideFaces ( MIntArray & faceList, int divisionCount)
MStatus subdivideEdges ( MIntArray & edgeList, int divisionCount)
MStatus extrudeFaces ( MIntArray & faceList, int extrusionCount, MFloatVector * translation, bool extrudeTogether)
MStatus extrudeEdges ( MIntArray & edgeList, int extrusionCount, MFloatVector * translation, bool extrudeTogether)
MStatus duplicateFaces ( MIntArray & faceList, MFloatVector * translation)
MStatus extractFaces ( MIntArray & faceList, MFloatVector * translation)
MStatus collapseFaces ( MIntArray & faceList)
MStatus collapseEdges ( MIntArray & edgeList)
int numVertices ( MStatus * ReturnStatus = NULL) const
int numEdges ( MStatus * ReturnStatus = NULL ) const
int numPolygons ( MStatus * ReturnStatus = NULL ) const
int numFaceVertices ( MStatus * ReturnStatus = NULL ) const
int polygonVertexCount ( int polygonId, MStatus * ReturnStatus = NULL ) const
int numUVs ( MStatus * ReturnStatus = NULL ) const
int numUVs ( const MString &uvSet, MStatus * ReturnStatus = NULL ) const
int numColors ( MStatus * ReturnStatus = NULL ) const
int numColors ( const MString &colorSet, MStatus * ReturnStatus = NULL ) const
int numNormals ( MStatus * ReturnStatus = NULL ) const
bool hasColorChannels ( const MString &colorSet, MStatus * ReturnStatus = NULL ) const
bool hasAlphaChannels ( const MString &colorSet, MStatus * ReturnStatus = NULL ) const
MColorRepresentation getColorRepresentation ( const MString &colorSet, MStatus * ReturnStatus = NULL) const
bool isColorClamped ( const MString &colorSet, MStatus * ReturnStatus = NULL ) const
MStatus setIsColorClamped ( const MString &colorSet, bool clamped)
MStatus getTriangles ( MIntArray & triangleCounts, MIntArray &triangleVertices ) const
static MMeshIsectAccelParams uniformGridParams ( int xDiv, int yDiv, int zDiv )
static MMeshIsectAccelParams autoUniformGridParams ()
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 )
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 )
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 )
MStatus sortIntersectionFaceTriIds ( MIntArray * faceIds, MIntArray * triIds )
MStatus freeCachedIntersectionAccelerator ()
MString cachedIntersectionAcceleratorInfo ( MStatus *ReturnStatus = NULL )
static MString globalIntersectionAcceleratorsInfo ()
static void clearGlobalIntersectionAcceleratorInfo ()
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
MStatus getClosestPointAndNormal ( const MPoint & toThisPoint, MPoint & theClosestPoint, MVector & theNormal, MSpace::Space space = MSpace::kObject , int * closestPolygon = NULL ) const
MStatus getClosestPoint (const MPoint &toThisPoint, MPoint &theClosestPoint, MSpace::Space space = MSpace::kObject , int * closestPolygon = NULL ) const
MStatus getClosestNormal (const MPoint &toThisPoint, MVector & theNormal, MSpace::Space space = MSpace::kObject , int * closestPolygon = NULL ) const
MStatus getConnectedShaders ( unsigned int instanceNumber, MObjectArray & shaders, MIntArray & indices ) const
MStatus getConnectedSetsAndMembers ( unsigned int instanceNumber, MObjectArray & sets, MObjectArray & comps, bool renderableSetsOnly ) const
MObject copy ( const MObject & source, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MStatus updateSurface ()
MStatus syncObject ()
MStatus getPoints ( MFloatPointArray & vertexArray, MSpace::Space space = MSpace::kObject ) const
MStatus getPoints ( MPointArray & vertexArray, MSpace::Space space = MSpace::kObject ) const
MStatus setPoints ( MFloatPointArray & vertexArray, MSpace::Space space = MSpace::kObject )
MStatus setPoints ( MPointArray & vertexArray, MSpace::Space space = MSpace::kObject )
MStatus getVertices ( MIntArray & vertexCount, MIntArray & vertexList ) const
MStatus getPolygonVertices ( int polygonId, MIntArray & vertexList ) const
MStatus getPolygonTriangleVertices ( int polygonId, int triangleId, int triangleVertices[3] ) const
MStatus setPoint ( int vertexId, const MPoint & pos, MSpace::Space space = MSpace::kObject )
MStatus getPoint ( int vertexId, MPoint & pos, MSpace::Space space = MSpace::kObject ) const
MStatus getNormals ( MFloatVectorArray & normals, MSpace::Space space = MSpace::kObject ) const
MStatus setNormals ( MFloatVectorArray & normals, MSpace::Space space = MSpace::kObject )
MStatus getFaceVertexNormal ( int faceIndex, int vertexIndex, MVector & normal, MSpace::Space space = MSpace::kObject ) const
MStatus getFaceVertexNormals ( int faceIndex, MFloatVectorArray & normals, MSpace::Space space = MSpace::kObject ) const
MStatus getNormalIds ( MIntArray & normalIdCounts, MIntArray &normalIds ) const
MStatus getFaceNormalIds ( int faceIndex, MIntArray &normals ) const
MStatus setFaceVertexNormal ( MVector &normal, int faceIndex, int vertexIndex, MSpace::Space space = MSpace::kObject , MDGModifier *modifier = NULL)
MStatus setVertexNormal ( MVector &normal, int vertexIndex, MSpace::Space space = MSpace::kObject , MDGModifier *modifier = NULL)
MStatus setFaceVertexNormals ( MVectorArray & normalArray, MIntArray & faceList, MIntArray & vertexList, MSpace::Space space = MSpace::kObject )
MStatus setVertexNormals ( MVectorArray & normalArray, MIntArray & vertexList, MSpace::Space space = MSpace::kObject )
MStatus getVertexNormal ( int vertexId, MVector & normal, MSpace::Space space = MSpace::kObject ) const
MStatus getPolygonNormal ( int polygonId, MVector & normal, MSpace::Space space = MSpace::kObject ) const
bool isNormalLocked (int normalId, MStatus * ReturnStatus = NULL ) const
MStatus lockVertexNormals ( MIntArray & vertexList)
MStatus lockFaceVertexNormals ( MIntArray & faceList, MIntArray & vertexList)
MStatus unlockVertexNormals ( MIntArray & vertexList)
MStatus unlockFaceVertexNormals ( MIntArray & faceList, MIntArray & vertexList)
int getTangentId ( int faceIndex, int vertexIndex, MStatus * ReturnStatus = NULL ) const
MStatus getTangents ( MFloatVectorArray & normals, MSpace::Space space = MSpace::kObject , const MString * uvSet = NULL) const
MStatus getFaceVertexTangent ( int faceIndex, int vertexIndex, MVector & tangent, MSpace::Space space = MSpace::kObject , const MString * uvSet = NULL ) const
MStatus getFaceVertexTangents ( int faceIndex, MFloatVectorArray & tangents, MSpace::Space space = MSpace::kObject , const MString * uvSet = NULL ) const
MStatus getBinormals ( MFloatVectorArray & normals, MSpace::Space space = MSpace::kObject , const MString * uvSet = NULL ) const
MStatus getFaceVertexBinormal ( int faceIndex, int vertexIndex, MVector & normal, MSpace::Space space = MSpace::kObject , const MString * uvSet = NULL) const
MStatus getFaceVertexBinormals ( int faceIndex, MFloatVectorArray & normals, MSpace::Space space = MSpace::kObject , const MString * uvSet = NULL) const
bool isPolygonConvex ( int faceIndex, MStatus * ReturnStatus = NULL ) const
MStatus getEdgeVertices ( int edgeId, int2 & vertexList ) const
bool isEdgeSmooth ( int edgeId, MStatus * ReturnStatus = NULL ) const
MStatus setEdgeSmoothing ( int edgeId, bool smooth = true )
MStatus cleanupEdgeSmoothing ()
MStatus getCreaseEdges ( MUintArray &edgeIds, MDoubleArray &creaseData) const
MStatus setCreaseEdges (const MUintArray &edgeIds, const MDoubleArray &creaseData)
MStatus getCreaseVertices ( MUintArray &vertexIds, MDoubleArray &creaseData) const
MStatus setCreaseVertices (const MUintArray &vertexIds, const MDoubleArray &creaseData)
int numUVSets ( MStatus *ReturnStatus = NULL) const
MString createUVSetWithName (const MString &uvSetName, MDGModifier *modifier = NULL, MStatus *ReturnStatus = NULL, const MUintArray *instances = NULL)
MString copyUVSetWithName (const MString &fromName, const MString &toName, MDGModifier *modifier = NULL, MStatus *ReturnStatus = NULL)
MStatus renameUVSet (const MString &origName, const MString &newName, MDGModifier *modifier = NULL)
MStatus deleteUVSet (const MString &setName, MDGModifier *modifier = NULL, MSelectionList *currentSelection = NULL)
MStatus setCurrentUVSetName (const MString &setName, MDGModifier *modifier = NULL, MSelectionList *currentSelection = NULL)
MString currentUVSetName ( MStatus *ReturnStatus = NULL, int instance = kMFnMeshInstanceUnspecified) const
MStatus getUVSetNames ( MStringArray &setNames) const
MStatus getUVSetFamilyNames ( MStringArray &familyNames) const
MStatus getUVSetsInFamily (const MString & familyName, MStringArray &setNames) const
bool isUVSetPerInstance ( const MString & name, MStatus *ReturnStatus = NULL) const
MStatus getFaceUVSetNames ( int polygonId, MStringArray &setNames) const
MStatus getAssociatedUVSetTextures (const MString uvSetName, MObjectArray & textures) const
MStatus getAssociatedUVSetInstances (const MString & uvSetName, MIntArray & instances) const
MStatus setUVs ( const MFloatArray & uArray, const MFloatArray & vArray, const MString * uvSet = NULL )
MStatus setSomeUVs ( const MIntArray & uvIds, const MFloatArray & uArray, const MFloatArray & vArray, const MString * uvSet = NULL )
MStatus getUVs ( MFloatArray & uArray, MFloatArray & vArray, const MString * uvSet = NULL ) const
MStatus setUV ( int uvId, float u, float v, const MString * uvSet = NULL )
MStatus getUV ( int uvId, float & u, float & v, const MString * uvSet = NULL ) const
MStatus getPointAtUV ( int polygonId, MPoint &theClosestPoint, float2 & uvPoint, MSpace::Space space = MSpace::kObject , const MString * uvSet = NULL, float tolerance=0.0)
MStatus getUVAtPoint ( MPoint &pt, float2 & uvPoint, MSpace::Space space = MSpace::kObject , const MString * uvSet = NULL, int * closestPolygon = NULL)
MStatus getPolygonUV ( int polygonId, int vertexIndex, float & u, float & v, const MString * uvSet = NULL ) const
MStatus getPolygonUVid ( int polygonId, int vertexIndex, int &uvId, const MString * uvSet = NULL ) const
MStatus assignUV ( int polygonId, int vertexIndex, int uvId, const MString * uvSet = NULL )
MStatus assignUVs ( const MIntArray & uvCounts, const MIntArray & uvIds, const MString * uvSet = NULL )
MStatus clearUVs ( const MString * uvSet = NULL )
MStatus getAssignedUVs ( MIntArray & uvCounts, MIntArray & uvIds, const MString * uvSet = NULL ) const
int numColorSets ( MStatus *ReturnStatus = NULL) const
MString createColorSetWithName (const MString &colorSetName, MDGModifier *modifier = NULL, MStatus *ReturnStatus = NULL)
MStatus deleteColorSet (const MString &colorSetName, MDGModifier *modifier = NULL, MSelectionList *currentSelection = NULL)
MStatus setCurrentColorSetName (const MString &setName, MDGModifier *modifier = NULL, MSelectionList *currentSelection = NULL)
MString currentColorSetName ( MStatus * ReturnStatus = NULL) const
MStatus getColorSetNames ( MStringArray &setNames) const
MStatus setFaceColor ( MColor &color, int index)
MStatus setFaceColor ( MColor &color, int index, MColorRepresentation rep)
MStatus setVertexColor ( MColor &color, int index, MDGModifier *modifier = NULL)
MStatus setVertexColor ( MColor &color, int index, MDGModifier *modifier, MColorRepresentation rep)
MStatus setFaceVertexColor ( MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier = NULL)
MStatus setFaceVertexColor ( MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier, MColorRepresentation rep)
MStatus setFaceVertexColor ( int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier = NULL)
MStatus setFaceVertexColor ( int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier, MColorRepresentation rep)
MStatus setFaceColors ( MColorArray &colors, MIntArray &faceList)
MStatus setFaceColors ( MColorArray &colors, MIntArray &faceList, MColorRepresentation rep)
MStatus setVertexColors ( MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier = NULL)
MStatus setVertexColors ( MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep)
MStatus setFaceVertexColors ( MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier = NULL)
MStatus setFaceVertexColors ( MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep)
MStatus removeFaceColors ( MIntArray &faceList)
MStatus removeVertexColors ( MIntArray &vertexList)
MStatus removeFaceVertexColors ( MIntArray &faceList, MIntArray &vertexList)
MStatus getVertexColors ( MColorArray &colors, const MString * colorSet = NULL, const MColor * defaultUnsetColor = NULL)
MStatus getFaceVertexColors ( MColorArray &colors, const MString *colorSet = NULL, const MColor * defaultUnsetColor = NULL)
MStatus getFaceVertexColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString * colorSet = NULL)
MStatus setColors ( const MColorArray & colors, const MString * colorSet = NULL )
MStatus setColors ( const MColorArray & colors, const MString * colorSet, MColorRepresentation rep )
MStatus setSomeColors ( const MIntArray & colorIds, const MColorArray & colors, const MString * colorSet = NULL )
MStatus setSomeColors ( const MIntArray & colorIds, const MColorArray & colors, const MString * colorSet, MColorRepresentation rep )
MStatus getColors ( MColorArray & colors, const MString * colorSet = NULL , const MColor *defaultUnsetColor = NULL) const
MStatus getColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet = NULL )
MStatus setColor ( int colorId, const MColor &color, const MString * colorSet = NULL )
MStatus setColor ( int colorId, const MColor &color, const MString * colorSet, MColorRepresentation rep )
MStatus getColor ( int colorId, MColor &color, const MString * colorSet = NULL, const MColor * defaultUnsetColor = NULL) const
MStatus assignColor ( int polygonId, int vertexIndex, int colorId, const MString * colorSet = NULL )
MStatus assignColors ( const MIntArray & colorIds, const MString * colorSet = NULL )
MStatus clearColors ( const MString * colorSet = NULL )
int getHoles ( MIntArray & holeInfoArray, MIntArray & holeVertexArray, MStatus * ReturnStatus = NULL )
bool onBoundary ( int polygonId, MStatus * ReturnStatus = NULL) const
bool isBlindDataTypeUsed ( int blindDataId, MStatus * ReturnStatus = NULL ) const
MStatus createBlindDataType ( int blindDataId, MStringArray longNames, MStringArray shortNames, MStringArray formatNames)
bool hasBlindDataComponentId ( int compID, MFn::Type compType, int blindDataId, MStatus * ReturnStatus = NULL ) const
bool hasBlindData ( MFn::Type compType, int blindDataId, MStatus * ReturnStatus = NULL ) const
bool hasBlindDataComponentId ( int compID, MFn::Type compType, MStatus * ReturnStatus = NULL ) const
bool hasBlindData ( MFn::Type compType, MStatus * ReturnStatus = NULL ) const
MStatus getBlindDataTypes ( MFn::Type compType, MIntArray & blindDataIds ) const
MStatus getBlindDataAttrNames (int blindDataId, MStringArray & longNames, MStringArray & shortNames, MStringArray & formatNames) const
MStatus getFaceVertexBlindDataIndex (int faceIndex, int vertexIndex, int &blindDataIndex) const
MStatus getBlindDataFaceVertexIndices (int blindDataIndex, int &faceIndex, int &vertexIndex) const
MStatus getIntBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, int &data) const
MStatus getIntBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MIntArray & data) const
MStatus getFloatBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, float &data) const
MStatus getFloatBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MFloatArray & data) const
MStatus getDoubleBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, double &data) const
MStatus getDoubleBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MDoubleArray & data) const
MStatus getBoolBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, bool &data) const
MStatus getBoolBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MIntArray & data) const
MString stringBlindDataComponentId ( int compID, MFn::Type compType, int blindDataId, MString attrName, MStatus *ReturnStatus = NULL) const
MStatus getStringBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MStringArray & data) const
MString binaryBlindDataComponentId ( int compID, MFn::Type compType, int blindDataId, MString attrName, MStatus *ReturnStatus = NULL) const
MStatus getBinaryBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MStringArray & data) const
MStatus setIntBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, int data)
MStatus setIntBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, int data)
MStatus setIntBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MIntArray & data)
MStatus setFloatBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, float data)
MStatus setFloatBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, float data)
MStatus setFloatBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MFloatArray &data)
MStatus setDoubleBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, double data)
MStatus setDoubleBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, double data)
MStatus setDoubleBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MDoubleArray &data)
MStatus setBoolBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, bool data)
MStatus setBoolBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, bool data)
MStatus setBoolBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MIntArray & data)
MStatus setStringBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, MString data)
MStatus setStringBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MString data)
MStatus setStringBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MStringArray &data)
MStatus setBinaryBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, MString data)
MStatus setBinaryBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MString data)
MStatus setBinaryBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MStringArray &data)
MStatus setBinaryBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, char *data, int length)
MStatus clearBlindData (int compID, MFn::Type compType, int blindDataId, MString attrName)
MStatus clearBlindData ( MFn::Type compType, int blindDataId, MString attrName)
MStatus clearBlindData ( MFn::Type compType)
MStatus clearBlindData (int compID, MFn::Type compType, int blindDataId)
MStatus clearBlindData ( MFn::Type compType, int blindDataId)
void setCheckSamePointTwice ( bool check = true )
bool getCheckSamePointTwice ( void )
MStatus createInPlace ( int numVertices , int numPolygons , const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects )
MStatus copyInPlace ( const MObject & source )
MObject addPolygon ( MPointArray & vertexArray, double polyTolerance, bool mergeVertices = true, double pointTolerance = kMFnMeshPointTolerance, bool forceGeometry = true, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
OBSOLETE & NO SCRIPT SUPPORT
bool intersect ( MPoint & raySource, MVector & rayDirection, MPointArray & points, MStatus * ReturnStatus = NULL ) const
OBSOLETE & NO SCRIPT SUPPORT
bool intersect ( const MPoint & raySource, const MVector & rayDirection, MPointArray & points, MStatus * ReturnStatus = NULL ) const
OBSOLETE & NO SCRIPT SUPPORT
MStatus getBlindDataAttrNames (int blindDataId, MStringArray & longNames, MStringArray & shortNames) const
OBSOLETE & NO SCRIPT SUPPORT
bool hasBlindData ( int compID, MFn::Type compType, int blindDataId, MStatus * ReturnStatus = NULL ) const
OBSOLETE & NO SCRIPT SUPPORT
bool hasBlindData ( int compID, MFn::Type compType, MStatus * ReturnStatus = NULL ) const
OBSOLETE & NO SCRIPT SUPPORT
MStatus createUVSet ( MString &uvSetName, MDGModifier *modifier = NULL, const MUintArray *instances = NULL)
NO SCRIPT SUPPORT
MStatus copyUVSet (const MString &fromName, MString &toName, MDGModifier *modifier = NULL)
NO SCRIPT SUPPORT
MStatus getCurrentUVSetName ( MString &setName, int instance = kMFnMeshInstanceUnspecified) const
NO SCRIPT SUPPORT
MStatus createColorSet ( MString &colorSetName, MDGModifier *modifier = NULL)
NO SCRIPT SUPPORT
MStatus createColorSet ( MString &colorSetName, MDGModifier *modifier, bool clamped, MColorRepresentation rep)
NO SCRIPT SUPPORT
MStatus getCurrentColorSetName ( MString &setName) const
NO SCRIPT SUPPORT
MStatus getStringBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, MString &data) const
NO SCRIPT SUPPORT
MStatus getBinaryBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, MString &data) const
NO SCRIPT SUPPORT

Inherited from MFnDagNode:

public members:

kNextPos
MObject create ( const MTypeId &typeId, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId &typeId, const MString &name, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MString &type, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MString &type, const MString &name, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
unsigned int parentCount ( MStatus * ReturnStatus = NULL ) const
MObject parent ( unsigned int i, MStatus * ReturnStatus = NULL ) const
MStatus addChild ( MObject & child , unsigned int index = kNextPos , bool keepExistingParents = false )
MStatus removeChild ( MObject & child )
MStatus removeChildAt ( unsigned int index )
unsigned int childCount ( MStatus * ReturnStatus = NULL ) const
MObject child ( unsigned int i, MStatus * ReturnStatus = NULL ) const
MObject dagRoot ( MStatus * ReturnStatus = NULL )
bool hasParent ( const MObject & node, MStatus * ReturnStatus = NULL ) const
bool hasChild (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool isChildOf (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool isParentOf (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool inUnderWorld ( MStatus * ReturnStatus = NULL ) const
bool inModel ( MStatus * ReturnStatus = NULL ) const
bool isInstanceable ( MStatus * ReturnStatus=NULL ) const
MStatus setInstanceable ( const bool how )
bool isInstanced ( bool indirect = true, MStatus * ReturnStatus = NULL ) const
bool isInstancedAttribute ( const MObject & attr, MStatus * ReturnStatus = NULL ) const
unsigned int instanceCount ( bool total, MStatus * ReturnStatus = NULL ) const
MObject duplicate ( bool instance = false, bool instanceLeaf = false, MStatus * ReturnStatus = NULL ) const
MStatus getPath ( MDagPath & path )
MStatus getAllPaths ( MDagPathArray & paths )
MString fullPathName ( MStatus *ReturnStatus = NULL)
MString partialPathName ( MStatus *ReturnStatus = NULL)
MMatrix transformationMatrix ( MStatus * ReturnStatus = NULL ) const
bool isIntermediateObject ( MStatus * ReturnStatus = NULL ) const
MStatus setIntermediateObject ( bool isIntermediate )
int objectColor ( MStatus * ReturnStatus = NULL ) const
MStatus setObjectColor ( int color )
bool usingObjectColor ( MStatus * ReturnStatus = NULL ) const
MStatus setUseObjectColor ( bool useObjectColor )
MBoundingBox boundingBox ( MStatus * ReturnStatus = NULL ) const
MDagPath dagPath ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( const MDagPath & path )
virtual MStatus setObject ( MObject & object )
MObject model ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( const MObject & object )

Inherited from MFnDependencyNode:

public members:

virtual MFn::Type type () const
enum MAttrClass
kGlobalDynamicAttr
kLocalDynamicAttr
MObject create ( const MTypeId & typeId , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId & typeId , const MString & name , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , const MString & name , MStatus * ReturnStatus = NULL )
MTypeId typeId ( MStatus * ReturnStatus = NULL ) const
MString typeName ( MStatus * ReturnStatus = NULL ) const
MString name ( MStatus * ReturnStatus = NULL ) const
MString setName ( const MString & name , MStatus * ReturnStatus = NULL )
MStatus getConnections ( MPlugArray & array ) const
unsigned int attributeCount ( MStatus * ReturnStatus=NULL) const
MObject attribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject reorderedAttribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject attribute ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MAttrClass attributeClass ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MStatus getAffectedAttributes ( const MObject & attr, MObjectArray & affectedAttributes ) const
MStatus getAffectedByAttributes ( const MObject & attr, MObjectArray & affectedByAttributes ) const
MPlug findPlug ( const MObject & attr, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MStatus addAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MStatus removeAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MPxNode * userNode ( MStatus * ReturnStatus=NULL ) const
bool isFromReferencedFile ( MStatus * ReturnStatus=NULL) const
bool isShared ( MStatus * ReturnStatus=NULL) const
bool hasUniqueName ( MStatus * ReturnStatus=NULL) const
MString parentNamespace ( MStatus * ReturnStatus=NULL) const
bool isLocked ( MStatus * ReturnStatus=NULL) const
MStatus setLocked ( bool locked )
static MString classification ( const MString & nodeTypeName )
bool isNewAttribute ( const MObject & attr, MStatus * ReturnStatus=NULL) const
static unsigned int allocateFlag ( const MString pluginName, MStatus * ReturnStatus=NULL )
static MStatus deallocateFlag (const MString pluginName, unsigned int flag)
static MStatus deallocateAllFlags (const MString pluginName)
MStatus setFlag (unsigned int flag, bool state)
bool isFlagSet (unsigned int flag, MStatus * ReturnStatus=NULL) const
bool isDefaultNode ( MStatus * ReturnStatus=NULL) const
MStatus setDoNotWrite ( bool flag )
bool canBeWritten ( MStatus * ReturnStatus=NULL) const
bool hasAttribute (const MString & name , MStatus * ReturnStatus=NULL) const
MObject getAliasAttr (bool force, MStatus * ReturnStatus=NULL)
bool setAlias (const MString & alias,const MString & name , const MPlug & plug, bool add=true, MStatus * ReturnStatus=NULL)
bool findAlias (const MString & alias, MObject & attrObj, MStatus * ReturnStatus=NULL) const
bool getAliasList ( MStringArray & strArray, MStatus * ReturnStatus=NULL)
MString plugsAlias (const MPlug & plug, MStatus * ReturnStatus=NULL)
public
bool getPlugsAlias (const MPlug & plug, MString & aliasName, MStatus * ReturnStatus=NULL)

Inherited from MFnBase:

public members:

virtual MFn::Type type () const
bool hasObj ( MFn::Type ) const
bool hasObj ( const MObject & ) const
MObject object ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( MObject & object )
virtual MStatus setObject ( const MObject & object )

Documentation

Description

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:

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:

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.

Functions

MFnMesh:: MFnMesh ()

Description

Default class constructor. The function set is not attached to an MObject.

MFnMesh:: MFnMesh ( MObject & object, MStatus * ReturnStatus )

Description

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

Arguments

  • object the MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnMesh:: MFnMesh ( const MObject & object, MStatus * ReturnStatus )

Description

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

Arguments

  • object the const MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnMesh:: MFnMesh ( const MDagPath & object, MStatus * ReturnStatus )

Description

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

Arguments

  • object the const MDagPath to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFn::Type MFnMesh:: type () const

Description

Return the type of this function set.

Return Value

  • the constant MFn::kMesh

MFnMesh:: ~MFnMesh ()

Description

Class destructor.

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

Description

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.

Arguments

  • numVertices number of vertices
  • numPolygons number of polygons
  • 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) }
  • 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}.
  • 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 }
  • parentOrOwner parent of the polygon that will be created
  • ReturnStatus Status code

Return Value

  • MS::kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors:
    • Array length does not match given item count
    • parentOrOwner was not valid
    • There was no model present to add the object to
  • MS::kFailure An object error has occurred
  • MS::kInsufficientMemory Insufficient memory to complete this method

MObject MFnMesh:: create ( int numVertices , int numPolygons , const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner, MStatus * ReturnStatus )

Description

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

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

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

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

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

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

Arguments

  • numVertices number of vertices
  • numPolygons number of polygons
  • 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) }
  • 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}.
  • 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 }
  • parentOrOwner parent of the polygon that will be created
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData

Status Codes

  • MS:kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors
    • Array length does not match given item count
    • parentOrOwner was not valid
    • There was no model present to add the object to
  • MS::kFailure An object error has occurred.
  • MS::kInsufficientMemory Insufficient memory to complete this method

MObject MFnMesh:: create ( int numVertices , int numPolygons , const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner, MStatus * ReturnStatus )

Description

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

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

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

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

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

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

Arguments

  • numVertices number of vertices
  • numPolygons number of polygons
  • 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) }
  • 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}.
  • 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 }
  • parentOrOwner parent of the polygon that will be created
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors
    • Array length does not match given item count
    • parentOrOwner was not valid
    • There was no model present to add the object to
  • MS::kFailure An object error has occurred.
  • MS::kInsufficientMemory Insufficient memory to complete this method

MObject MFnMesh:: create ( int numVertices , int numPolygons , const MFloatPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray & uArray, const MFloatArray & vArray, MObject parentOrOwner, MStatus * ReturnStatus )

Description

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

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

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

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

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

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

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

Arguments

  • numVertices number of vertices
  • numPolygons number of polygons
  • 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) }
  • 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}.
  • 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 }
  • uArray The array of u values to be set
  • vArray The array of v values to be set
  • parentOrOwner parent of the polygon that will be created
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors
    • Array length does not match given item count
    • parentOrOwner was not valid
    • There was no model present to add the object to
  • MS::kFailure An object error has occurred.
  • MS::kInsufficientMemory Insufficient memory to complete this method

MObject MFnMesh:: create ( int numVertices , int numPolygons , const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray & uArray, const MFloatArray & vArray, MObject parentOrOwner, MStatus * ReturnStatus )

Description

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

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

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

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

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

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

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

Arguments

  • numVertices number of vertices
  • numPolygons number of polygons
  • 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) }
  • 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}.
  • 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 }
  • uArray The array of u values to be set
  • vArray The array of v values to be set
  • parentOrOwner parent of the polygon that will be created
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors
    • Array length does not match given item count
    • parentOrOwner was not valid
    • There was no model present to add the object to
  • MS::kFailure An object error has occurred.
  • MS::kInsufficientMemory Insufficient memory to complete this method

MObject MFnMesh:: generateSmoothMesh ( MObject parentOrOwner, MStatus * ReturnStatus)
Description

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

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

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

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

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

Arguments

  • parentOrOwner parent of the polygon that will be created
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData

Status Codes

  • MS:kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors
    • parentOrOwner was not valid
    • There was no model present to add the object to
  • MS::kFailure An object error has occurred.
  • MS::kInsufficientMemory Insufficient memory to complete this method

MObject MFnMesh:: addPolygon ( MPointArray & vertexArray, double polyTolerance, bool mergeVertices, double pointTolerance, bool forceGeometry, MObject parentOrOwner, MStatus * ReturnStatus )

Description

This method is OBSOLETE, please use the other addPolygon method.

Adds a new polygon to this polygonal mesh.

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

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

Arguments

  • vertexArray array of ordered vertices that make up the polygon
  • 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.
  • mergeVertices If true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
  • pointTolerance specifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
  • forceGeometry if true handle no-manifold topology regardless of non connectivity
  • parentOrOwner the DAG parent or kMeshData the new surface will belong to
  • ReturnStatus status code

Return Value

  • The transform if one is created, otherwise the geometry.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MObject MFnMesh:: addPolygon ( const MPointArray & vertexArray, bool mergeVertices, double pointTolerance, MObject parentOrOwner, MStatus * ReturnStatus)

Description

Adds a new polygon to this polygonal mesh.

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

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

Arguments

  • vertexArray array of ordered vertices that make up the polygon
  • mergeVertices If true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
  • pointTolerance specifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
  • parentOrOwner the DAG parent or kMeshData the new surface will belong to
  • ReturnStatus status code

Return Value

  • The transform if one is created, otherwise the geometry.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MObject MFnMesh:: addPolygon ( const MPointArray & vertexArray, int & faceIndex, bool mergeVertices, double pointTolerance, MObject parentOrOwner, MStatus * ReturnStatus)

Description

Adds a new polygon to this polygonal mesh. Return an index of the created polygon.

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

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

Arguments

  • vertexArray array of ordered vertices that make up the polygon
  • faceIndex index of the newly added polygon.
  • mergeVertices If true then if a vertex falls within pointTolerance of an existing vertex then the existing vertex is reused.
  • pointTolerance specifies how close verticies have to be to before they are merged. This merging is only done if mergeVerticies is true.
  • parentOrOwner the DAG parent or kMeshData the new surface will belong to
  • ReturnStatus status code

Return Value

  • The transform if one is created, otherwise the geometry.

Face Index

  • Index of the added polygon within its mesh.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MObject MFnMesh:: copy ( const MObject & source, MObject parentOrOwner, MStatus * ReturnStatus )

Description

This method creates a copy of a given source mesh. After the copy this function set will operate on the new mesh.

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

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

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

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

Arguments

  • source the mesh to be copied
  • parentOrOwner the DAG parent or kMeshData the new mesh will belong to
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors
    • parentOrOwner was not valid
    • if source object is not one of kMeshGeom, kMeshData, kMesh
    • dataMesh or underlying geometry was null
    • Source object was null
    • There was no model present to add the object to
  • MS::kFailure An object error has occurred.
  • MS::kInsufficientMemory Insufficient memory to complete this method

MStatus MFnMesh:: copyInPlace ( const MObject & source )

Description

This method creates copies the given source mesh onto the current surface. After the copy this function set continues operate on the original mesh.

Arguments

  • source the mesh to be copied
  • ReturnStatus Status code

Return Value

  • MS::kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kInvalidDataType source object must be one of kMeshGeom, kMeshData, kMesh
    • MS::kShapeHasNoGeometry dataMesh or underlying geometry was null
    • MS::kObjectDoesNotExist Source object was null
  • MS::kFailure An object error has occurred.
    • MS::kModelActive There was no model present to add the object to
    • MS::kInsufficientMemory Insufficient memory to complete this method

int MFnMesh:: numVertices ( MStatus * ReturnStatus ) const

Description

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.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of vertices of the mesh

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numEdges ( MStatus * ReturnStatus ) const

Description

Returns the number of edges for this mesh.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of edges for this mesh

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numPolygons ( MStatus * ReturnStatus ) const

Description

Returns the number of polygons for this mesh.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of polygons for this mesh

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numFaceVertices ( MStatus * ReturnStatus ) const

Description

Returns the number of face-vertices for this mesh.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of face-vertices for this mesh

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: polygonVertexCount ( int polygonId, MStatus * ReturnStatus ) const

Description

Returns the number of vertices for the specified polygon.

Arguments

  • polygonId The polygon index
  • ReturnStatus Status code

Return Value

  • The number of vertices for the specified polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numUVs ( MStatus * ReturnStatus ) const

Description

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.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of texture coordinates

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numUVs ( const MString &uvSet, MStatus * ReturnStatus ) const

Description

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.

Arguments

  • uvSet UV set to work with
  • ReturnStatus Status code

Return Value

  • The number of texture coordinates

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numColors ( MStatus * ReturnStatus ) const

Description

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.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of colors

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: createColorSet ( MString &colorSetName, MDGModifier *modifier, bool clamped, MColorRepresentation rep)

Description

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

Arguments

  • 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.
  • 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.
  • clamped The color set stores values in 0 to 1 range if true. no range limit if false
  • rep The color set stores RGB, RGBA, or Alpha

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: createColorSet ( MString &colorSetName, MDGModifier *modifier)

Description

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

Arguments

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

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MString MFnMesh:: createColorSetWithName (const MString &colorSetName, MDGModifier *modifier, MStatus *ReturnStatus)

Description

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.

Arguments

  • colorSetName The name of the color set to add.
  • ReturnStatus Status code. See below.
  • 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.

Return Value

  • The resulting name of the color set.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: deleteColorSet (const MString &colorSetName, MDGModifier *modifier, MSelectionList *currentSelection)

Description

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.

Arguments

  • setName Name of the color set to delete
  • 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.
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numColors ( const MString &colorSet, MStatus * ReturnStatus ) const

Description

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.

Arguments

  • colorSet Color set to work with
  • ReturnStatus Status code

Return Value

  • The number of colors

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numNormals ( MStatus * ReturnStatus ) const

Description

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

Arguments

  • ReturnStatus Status code

Return Value

  • The number of per-polygon per-vertex normals

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getTriangles ( MIntArray & triangleCounts, MIntArray & triangleVertices ) const

Description

Returns the number of triangles for every polygon face and the vertex Ids of each triangle vertex. The triangleVertices array holds each vertex for each triangle in sequence, so is three times longer than the triangleCounts array

Arguments

  • triangleCounts The number of triangles for each polygon face
  • triangleVertices The triangle vertex Ids for each triangle

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPoints ( MFloatPointArray & vertexArray, MSpace::Space space ) const

Description

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

Arguments

  • vertexArray Storage for the vertex list
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPoints ( MPointArray & vertexArray, MSpace::Space space ) const

Description

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

Arguments

  • vertexArray Storage for the vertex list
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setPoints ( MFloatPointArray & vertexArray, MSpace::Space space )

Description

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

Arguments

  • vertexArray Storage for the vertex list
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setPoints ( MPointArray & vertexArray, MSpace::Space space )

Description

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

Arguments

  • vertexArray Storage for the vertex list
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getVertices ( MIntArray & vertexCount, MIntArray & vertexList ) const

Description

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.

Arguments

  • vertexCount Vertex count per polygon
  • vertexList Storage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPolygonVertices ( int polygonId, MIntArray & vertexList ) const

Description

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.

Arguments

  • polygonId The polygon to examine
  • vertexList Storage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPolygonTriangleVertices ( int polygonId, int triangleId, int vertexList[3] ) const

Description

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.

Arguments

  • polygonId The polygon to examine
  • triangleId The triangle within the polygon to examine (numbered from zero)
  • vertexList Storage for the vertex list. NOTE: Global (mesh-relative/object-relative) vertex indices are returned.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: isPolygonConvex ( int faceIndex, MStatus * ReturnStatus ) const

Description

This method determines if the specified polygon is convex.

Arguments

  • faceIndex The polygon to be tested
  • ReturnStatus Status code

Return Value

  • true The polygon is convex
  • false The edge is concave

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getEdgeVertices ( int edgeId, int2 & vertexList ) const

Description

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.

Arguments

  • edgeId The edge to get the vertices for
  • vertexList Storage for the 2 object-relative vertex indices

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getNormals ( MFloatVectorArray & normals, MSpace::Space space ) const

Description

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.

Arguments

  • normals Storage for the per-polygon per-vertex normal list
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setNormals ( MFloatVectorArray & normals, MSpace::Space space )
Description

Set the normal array (user normals)

Arguments

  • normals The normal array to set
  • space World space or Object space

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
*

MStatus MFnMesh:: setPoint ( int vertexId, const MPoint & pos, MSpace::Space space )

Description

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.

Arguments

  • vertexId The object-relative (mesh-relative/global) index of the vertex to be changed
  • pos The new value for the vertex
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPoint ( int vertexId, MPoint & pos, MSpace::Space space ) const

Description

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

Arguments

  • vertexId The object-relative (mesh-relative/global) index of the vertex to retrieve
  • pos Storage for the vertex
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setUVs ( const MFloatArray & uArray, const MFloatArray & vArray, const MString *uvSet )

Description

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:

  • MFnMesh::clearUVs()
  • MFnMesh::setUVs( ... )
  • MFnMesh::assignUVs()

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

Arguments

  • uArray The array of u values to be set
  • vArray The array of v values to be set
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter uArray and vArray lengths do not match or the arrays are smaller than the number of UVs in the set.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setSomeUVs ( const MIntArray & uvIds, const MFloatArray & uArray, const MFloatArray & vArray, const MString *uvSet )

Description

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

  • uvIds The array of uvIds to set values for
  • uArray The array of u values to be set
  • vArray The array of v values to be set
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter uArray and vArray lengths do not match or the arrays are smaller than numUVs().
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getUVs ( MFloatArray & uArray, MFloatArray & vArray, const MString *uvSet ) const

Description

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

Arguments

  • uArray Storage for the u texture coordinate list
  • vArray Storage for the v texture coordinate list
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setUV ( int uvId, float u, float v, const MString *uvSet )

Description

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.

Arguments

  • uvId The element in the uv list to be set
  • u The new u value that is to be set
  • v The new v value that is to be set
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getUV ( int uvId, float & u, float & v, const MString * uvSet) const

Description

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.

Arguments

  • uvId The element in the uv list to examine
  • u Storage for the u value
  • v Storage for the v value
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid uvId. The uvId should be less than numUVs() or numUVs(uvSet).
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPointAtUV ( int polygonId, MPoint &toThisPoint, float2 & uvPoint, MSpace::Space space, const MString *uvSet, float tolerance )

Description

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

Arguments

  • polygonId Search for uv on this face
  • toThisPoint Space for the point
  • uvPoint The UV value to try to locate
  • space The coordinate system to return "toThisPoint" in
  • uvSet UV set to work with
  • tolerance tolerance value to compare float data type

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getUVAtPoint ( MPoint &pt, float2 & uvPoint, MSpace::Space space, const MString * uvSet, int * closestPolygon)

Description

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

Arguments

  • pt The point to try to get UV for
  • uvPoint Space for the UV value
  • space The coordinate system for this operation
  • uvSet UV set to work with
  • closestPolygon polygon id of the closest polygon

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPolygonUV ( int polygonId, int vertexIndex, float & u, float & v, const MString *uvSet ) const

Description

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.

Arguments

  • polygonId The polygon (face) to examine
  • vertexIndex The face-relative (local) vertex id to examine
  • u Storage for the u value
  • v Storage for the v value
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid polygonId or vertexIndex specified.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPolygonUVid ( int polygonId, int vertexIndex, int &uvId, const MString *uvSet ) const

Description

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

Arguments

  • polygonId The polygon (face) to examine
  • vertexIndex The face-relative (local) vertex id to examine
  • uvId Storage for the uv index
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid polygonId or vertexIndex specified.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: assignUV ( int polygonId, int vertexIndex, int uvId, const MString *uvSet )

Description

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

Arguments

  • polygonId The polygon (face) to map to
  • vertexIndex The face-relative (local) vertex id of the polygon to map to
  • uvId The uv entry from the uv list that will be mapped
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid polygonId, vertexIndex, or uvId specified.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: assignUVs ( const MIntArray & uvCounts, const MIntArray & uvIds, const MString *uvSet )

Description

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.

Arguments

  • uvCounts The uv counts for each polygon (face) in the mesh
  • uvIds The uv indices to be mapped to each polygon-vertex
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid uvCounts array or invalid uvIds array.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: clearUVs ( const MString *uvSet )

Description

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.

Arguments

  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid uvCounts array or invalid uvIds array.
  • MS::kInvalidIndex Invalid uvSet was specified
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getAssignedUVs ( MIntArray & uvCounts, MIntArray & uvIds, const MString *uvSet ) const

Description

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.

Arguments

  • uvCounts The container for the uv counts for each polygon in the mesh
  • uvIds The container for the uv indices mapped to each polygon-vertex
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid uvCounts array or invalid uvIds array.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getUvShellsIds ( MIntArray & uvShellIds, unsigned int & nbUvShells, const MString * uvSet ) const

Description

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.

Arguments

  • uvShellIds The container for the uv shell Ids
  • nbUvShells The number of UV shells in this UV set.
  • uvSet UV set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getVertexNormal ( int vertexId, MVector & normal, MSpace::Space space ) const

Description

Return the normal at the given vertex. The returned normal is a per-vertex normal. See the class description for more information on normals.

Arguments

  • vertexId The object-relative (mesh-relative/global) vertex index to get the normal for
  • normal Storage for the per-vertex normal
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getPolygonNormal ( int polygonId, MVector & normal, MSpace::Space space ) const

Description

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

Arguments

  • polygonId The polygon (face) to get the normal for
  • normal Storage for the per-polygon normal
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexNormal ( int faceIndex, int vertexIndex, MVector & normal, MSpace::Space space ) const

Description

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

Arguments

  • faceIndex Index of the face of interest
  • vertexIndex The object-relative (mesh-relative/global) vertex index
  • normal Storage for the per-polygon-per-vertex normal
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexNormals ( int faceIndex, MFloatVectorArray & normals, MSpace::Space space ) const

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

Arguments

  • faceIndex Index of the face (polygon) for which to retrive the normals
  • normals Storage for the face normals
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getNormalIds ( MIntArray & normalCounts, MIntArray &normals ) const

Description

Return normal indices for all vertices for a all faces. The normalIds can be used to index into an array returned by MFnMesh::getNormals();

Arguments

  • normalCounts Number of normals for each face
  • normals Storage for the per-polygon normal ids

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceNormalIds ( int faceIndex, MIntArray &normals ) const

Description

Return normal indices for all vertices for a given face. The normalIds can be used to index into an array returned by MFnMesh::getNormals();

Arguments

  • faceIndex Index of face (polygon) of interest
  • normal Storage for the per-polygon normal ids

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBinormals ( MFloatVectorArray & binormals, MSpace::Space space, const MString * uvSet) const

Description

Return the binormal vectors for all face vertices.

Arguments

  • binormals Storage for the binormals.
  • space Specifies the coordinate system for this operation.
  • uvSet The uv map set to calculate the binormals aginst.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexBinormal ( int faceIndex, int vertexIndex, MVector & binormal, MSpace::Space space, const MString *uvSet) const

Description

Return the binormal vector at a given face vertex.

Arguments

  • faceIndex Index of the face of interest
  • vertexIndex The object-relative (mesh-relative/global) vertex index
  • binormal Storage for the binormal.
  • space Specifies the coordinate system for this operation.
  • uvSet The uv map set to calculate the binormals aginst.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexBinormals ( int faceIndex, MFloatVectorArray & binormals, MSpace::Space space, const MString *uvSet ) const

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

Arguments

  • faceIndex Index of the face (polygon) for which to retrive the binormals
  • binormals Storage for the face binormals
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

int MFnMesh:: getTangentId ( int faceIndex, int vertexIndex, MStatus * ReturnStatus ) const

Description

Return the tangent index for a given face vertex.

Arguments

  • faceIndex Index of the face of interest.
  • vertexIndex The object-relative (mesh-relative/global) vertex index.

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot invalid face or vertex index.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getTangents ( MFloatVectorArray & tangents, MSpace::Space space, const MString * uvSet ) const

Description

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.

Arguments

  • tangets Storage for the tangets.
  • space Specifies the coordinate system for this operation.
  • uvSet The uv map set to calculate the tangets against.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexTangent ( int faceIndex, int vertexIndex, MVector & tangent, MSpace::Space space, const MString *uvSet) const

Description

Return the normalized tangent vector at a given face vertex.

Arguments

  • faceIndex Index of the face of interest.
  • vertexIndex The object-relative (mesh-relative/global) vertex index.
  • tangent Storage for the tangent.
  • space Specifies the coordinate system for this operation.
  • uvSet The uv map set to calculate the binormals aginst.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexTangents ( int faceIndex, MFloatVectorArray & tangents, MSpace::Space space, const MString *uvSet ) const

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

Arguments

  • faceIndex Index of the face (polygon) for which to retrive the tangents
  • tangents Storage for the face tangents
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: isEdgeSmooth ( int edgeId, MStatus * ReturnStatus ) const

Description

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

Arguments

  • edgeId The edge to be tested
  • ReturnStatus Status code

Return Value

  • true The edge is smooth (soft)
  • false The edge is hard

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setEdgeSmoothing ( int edgeId, bool smooth )

Description

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.

Arguments

  • edgeId The edge to set the smoothing information for
  • smooth If true the edge will be smooth (soft), otherwise the edge will be hard.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: cleanupEdgeSmoothing ()

Description

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.

Arguments

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getCreaseEdges ( MUintArray &edgeIds, MDoubleArray &creaseData) const

Description

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

Arguments

  • edgeIds The list of crease edges ids.
  • creaseData The data related to the crease edges.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setCreaseEdges (const MUintArray &edgeIds, const MDoubleArray &creaseData)

Description

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

Arguments

  • edgeIds The list of crease edges ids.
  • creaseData The data related to the crease edges.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getCreaseVertices ( MUintArray &vertexIds, MDoubleArray &creaseData) const

Description

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

Arguments

  • vertexIds The list of crease vertices ids.
  • creaseData The data related to the crease vertices.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setCreaseVertices (const MUintArray &vertexIds, const MDoubleArray &creaseData)

Description

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

Arguments

  • vertexIds The list of crease vertices ids.
  • creaseData The data related to the crease vertices.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: intersect ( const MPoint & raySource, const MVector & rayDirection, MPointArray & points, MStatus * ReturnStatus ) const

Description

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 obsolete. Please use the other intersect method of this class.

Arguments

  • raySource Starting point for the ray
  • rayDirection Direction of the ray
  • points Storage for any points of intersection
  • ReturnStatus Status code

Return Value

  • true The given ray intersects this polygon
  • false The given ray does not intersect this polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: intersect ( MPoint & raySource, MVector & rayDirection, MPointArray & points, MStatus * ReturnStatus ) const

Description

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 obsolete. Please use the other intersect method of this class.

Arguments

  • raySource Starting point for the ray
  • rayDirection Direction of the ray
  • points Storage for any points of intersection
  • ReturnStatus Status code

Return Value

  • true The given ray intersects this polygon
  • false The given ray does not intersect this polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: intersect ( const MPoint & raySource, const MVector & rayDirection, MPointArray & points, double tolerance, MSpace::Space space, MIntArray * polygonIds, MStatus * ReturnStatus ) const

Description

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

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

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

Arguments

  • raySource Starting point for the ray
  • rayDirection Direction of the ray
  • points Storage for any points of intersection
  • tolerance Tolerance used in intersection calculation
  • space specifies the coordinate system for this operation
  • polygonIds Storage for the polygon id's that correspond to the points of intersection.
  • ReturnStatus Status code

Return Value

  • true The given ray intersects this polygon
  • false The given ray does not intersect this polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.

MMeshIsectAccelParams MFnMesh:: uniformGridParams ( int xDiv, int yDiv, int zDiv )

Description

Creates a MMeshIsectAccelParams configuration object to pass to the methods MFnMesh::closestIntersection(), MFnMesh::anyIntersection(), or MFnMesh::allIntersections(). This object specifies that a uniform voxel grid structure should be used by the intersection routines to speed up their operation. This object specifies the number of voxel cells to be used in the x, y, and z dimensions. The grid acceleration structure will be cached with the mesh, so that if the same MMeshIsectAccelParams configuration is used on the next intersect call, the acceleration structure will not need to be rebuilt.

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

Arguments

  • xDiv Number of voxels in the x direction
  • yDiv Number of voxels in the y direction
  • zDiv Number of voxels in the z direction

MMeshIsectAccelParams MFnMesh:: autoUniformGridParams ()

Description

Creates a MMeshIsectAccelParams configuration object to pass to the methods MFnMesh::closestIntersection(), MFnMesh::anyIntersection(), or MFnMesh::allIntersections(). This object specifies that a uniform voxel grid structure should be used by the intersection routines to speed up their operation, and that the system should automatically determine the number of voxel cells to use based on the density of triangles in the mesh. The grid acceleration structure will be cached with the mesh, so that if the same MMeshIsectAccelParams configuration is used on the next intersect call, the acceleration structure will not need to be rebuilt.

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

MStatus MFnMesh:: freeCachedIntersectionAccelerator ()

Description

If the mesh has a cached intersection accelerator structure, then this routine forces it to be deleted. Ordinarily, these structures are cached so that series of calls to the closestIntersection(), allIntersections(), and anyIntersection() method can reuse the same structure. Once the client is finished with these intersection operations, however, they are responsible for freeing the acceleration structure, which is what this method does.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MString MFnMesh:: cachedIntersectionAcceleratorInfo ( MStatus *ReturnStatus )

Description

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.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

Return Value

  • The description string

MString MFnMesh:: globalIntersectionAcceleratorsInfo ()

Description

Retrieves a string that describes the systemwide resource usage for cached mesh intersection accelerators. The string will be formatted similar to:

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

This means that:

- a total of 10 intersection accelerators have been created as instructed by calls to closestIntersection(), allIntersections(), or anyIntersection() with non-NULL accelParams values. These structures are destroyed and re-created when intersection requests with differing acceleration parameters are passed in for the same mesh, so it is useful to see this value, which is the total count of how many have been created. In this case, 8 of the 10 created have been destroyed, either automatically or via calls to the freeCachedIntersectionAccelerator() method

- the total memory footprint for the 2 accelerators currently in existence is 10,000KB

- the total build time for all 10 structures that have been created is 10.2 seconds

- the peak of total memory usage for all accelerators in the system was 14567.1KB

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

Return Value

  • The information string

void MFnMesh:: clearGlobalIntersectionAcceleratorInfo ()

Description

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 MFnMesh:: 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, MStatus * ReturnStatus )

Description

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

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

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

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

Arguments

  • raySource Starting point for the ray
  • rayDirection Direction of the ray
  • faceIds (see above) if non-NULL, describes a subset of faces to consider for intersection.
  • triIds (see above) if non-NULL, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-NULL, then faceIds must be non-NULL as well, otherwise an error will be generated.
  • 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 sortIds() 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.
  • space specifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
  • 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.
  • 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.
  • hitPoint receives the 3d coordinates of the closest intersection, in the space specified by the space parameter.
  • hitRayParam if non-NULL, points to a value that will be filled in with the parametric distance along the ray to the hit point, if one was found. That is, hitPoint = raySource+(*hitRayParam)*rayDirection. If no hit was found, the referenced value will not be modified.
  • hitFace if non-NULL, points to a value that will be filled in with the face id of the hit point, if one was found. If no hit was found, the referenced value will not be modified.
  • hitTriangle if non-NULL, points to a value that will be filled in with the 0-based index of the triangle that was hit within the face given by *hitFace. If no hit was found, the referenced value will not be modified,
  • hitBary1 if non-NULL, points to a value that will be filled in with the first barycentric coordinate of the hit point within the triangle defined by *hitFace and *hitTriangle. If v1, v2, and v3 are the vertices of that triangle, then the barycentric coordinates are such that hitPoint = (*hitBary1)*v1 + (*hitBary2)*v2 + (1-*hitBary1-*hitBary2)*v3; If no hit was found, the referenced value will not be modified,
  • hitBary2 if non-NULL, points to a value that will be filled in with the second barycentric coordinate of the hit point within the triangle defined by *hitFace and *hitTriangle. If no hit was found, the referenced value will not be modified,
  • tol 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.
  • ReturnStatus Status code

Return Value

  • true The given ray intersects the mesh, and the closest intersection of the ray with the mesh is given by the value returned in hitPoint.
  • false The given ray does not intersect this mesh

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kParamError There was an error with the parameters passed to the method. Either MSpace::kWorld was specified for a mesh with no world-space transformation, or the mesh had no data, or triIds was non-NULL without a corresponding faceIds array.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: 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, MStatus * ReturnStatus )

Description

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

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

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

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

Arguments

  • raySource Starting point for the ray
  • rayDirection Direction of the ray
  • faceIds (see above) if non-NULL, describes a subset of faces to consider for intersection.
  • triIds (see above) if non-NULL, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-NULL, then faceIds must be non-NULL as well, otherwise an error will be generated.
  • 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 sortIds() 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.
  • space specifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
  • 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.
  • 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.
  • hitPoint receives the 3d coordinates of the intersection, in the space specified by the space parameter.
  • hitRayParam if non-NULL, points to a value that will be filled in with the parametric distance along the ray to the hit point, if one was found. That is, hitPoint = raySource+(*hitRayParam)*rayDirection. If no hit was found, the referenced value will not be modified.
  • hitFace if non-NULL, points to a value that will be filled in with the face id of the hit point, if one was found. If no hit was found, the referenced value will not be modified.
  • hitTriangle if non-NULL, points to a value that will be filled in with the 0-based index of the triangle that was hit within the face given by *hitFace. If no hit was found, the referenced value will not be modified,
  • hitBary1 if non-NULL, points to a value that will be filled in with the first barycentric coordinate of the hit point within the triangle defined by *hitFace and *hitTriangle. If v1, v2, and v3 are the vertices of that triangle, then the barycentric coordinates are such that hitPoint = (*hitBary1)*v1 + (*hitBary2)*v2 + (1-*hitBary1-*hitBary2)*v3; If no hit was found, the referenced value will not be modified,
  • hitBary2 if non-NULL, points to a value that will be filled in with the second barycentric coordinate of the hit point within the triangle defined by *hitFace and *hitTriangle. If no hit was found, the referenced value will not be modified,
  • tol 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.
  • ReturnStatus Status code

Return Value

  • true The given ray intersects the mesh, and the found intersection of the ray with the mesh is given by the value returned in hitPoint.
  • false The given ray does not intersect this mesh

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kParamError There was an error with the parameters passed to the method. Either MSpace::kWorld was specified for a mesh with no world-space transformation, or the mesh had no data, or triIds was non-NULL without a corresponding faceIds array.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: 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, MStatus * ReturnStatus )

Description

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

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

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

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

Arguments

  • raySource Starting point for the ray
  • rayDirection Direction of the ray
  • faceIds (see above) if non-NULL, describes a subset of faces to consider for intersection.
  • triIds (see above) if non-NULL, then along with faceIds describes a set of face-triangles to consider for intersection. If triIds is non-NULL, then faceIds must be non-NULL as well, otherwise an error will be generated.
  • 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 sortIds() 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.
  • space specifies the space in which raySource and rayDirection are specified, as well as the space in which the hit point will be returned.
  • 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.
  • 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.
  • 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.
  • hitPoints an array that receives the 3d coordinates of the intersections, in the space specified by the space parameter.
  • hitRayParams if non-NULL, points to an array that will be filled in with the parametric distances along the ray to the hit points, if any were found. That is, for the i'th hit, hitPoints[i] = raySource+(*hitRayParams[i])*rayDirection. If no hit was found, the referenced values will not be modified.
  • hitFaces if non-NULL, points to an array that will be filled in with the face ids of the hit points, if any were found. If no hits were found, the referenced values will not be modified.
  • hitTriangles if non-NULL, points to an array that will be filled in with the 0-based indices of the triangles that were hit within the faces given by *hitFaces. If no hits were found, the referenced values will not be modified,
  • hitBary1s if non-NULL, points to an array that will be filled in with the first barycentric coordinates of the hit points within the triangles defined by *hitFaces and *hitTriangles. For the i'th hit, If v1, v2, and v3 are the vertices of that triangle, then the barycentric coordinates are such that hitPoint[i] = (*hitBary1s)[i]*v1 + (*hitBary2s)[i]*v2 + (1-(*hitBary1s)[i]-(*hitBary2s)[i])*v3; If no hits were found, the referenced value will not be modified,
  • hitBary2s if non-NULL, points to an array that will be filled in with the second barycentric coordinates of the hit points within the triangles defined by *hitFaces and *hitTriangles. If no hits were found, the referenced values will not be modified,
  • tol 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.
  • ReturnStatus Status code

Return Value

  • true The given ray intersects the mesh, and the intersections of the ray with the mesh are given by the values returned in hitPoints.
  • false The given ray does not intersect this mesh

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kParamError There was an error with the parameters passed to the method. Either MSpace::kWorld was specified for a mesh with no world-space transformation, or the mesh had no data, or triIds was non-NULL without a corresponding faceIds array.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: sortIntersectionFaceTriIds ( MIntArray * faceIds, MIntArray * triIds )

Description

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

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getClosestPointAndNormal ( const MPoint & toThisPoint, MPoint & theClosestPoint, MVector & theNormal, MSpace::Space space, int * closestPolygon ) const

Description

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.

Arguments

  • toThisPoint Point to be compared
  • theClosestPoint Storage for the closest point
  • theNormal Storage for normal at the closest point
  • space Specifies the coordinate system for this operation
  • closestPolygon Storage for the closest polygon id

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getClosestPoint (const MPoint &toThisPoint, MPoint &theClosestPoint, MSpace::Space space, int * closestPolygon ) const

Description

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.

Arguments

  • toThisPoint Point to be compared
  • theClosestPoint Storage for the closest point
  • space Specifies the coordinate system for this operation
  • closestPolygon Storage for the closest polygon id

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getClosestNormal (const MPoint &toThisPoint, MVector & theNormal, MSpace::Space space, int * closestPolygon ) const

Description

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.

Arguments

  • toThisPoint Point to be compared
  • theNormal Storage for normal at the closest point
  • space Specifies the coordinate system for this operation
  • closestPolygon Storage for the closest polygon id

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space operation.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getConnectedSetsAndMembers ( unsigned int instanceNumber, MObjectArray & sets, MObjectArray & comps, bool renderableSetsOnly ) const

Description

Returns all the sets connected to the specified instance of this mesh. For each set in the "sets" array there is a corresponding entry in the "comps" array which are all the components in that set. If the entire object is in a set, then the corresponding entry in the comps array will have no elements in it.

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

Arguments

  • instanceNumber The instance number of the mesh to query
  • sets Storage for the sets
  • comps Storage for the components that are in the corresponding set
  • renderableSetsOnly If true then this method will only return renderable sets

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getConnectedShaders ( unsigned int instanceNumber, MObjectArray & shaders, MIntArray & indices ) const

Description

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.

Arguments

  • instanceNumber The instance number of the mesh to query
  • shaders Storage for set objects (shader objects)
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: updateSurface ()

Description

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

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: syncObject ()

Description

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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceColor ( MColor &color, int faceIndex, MColorRepresentation rep)

Description

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

Arguments

  • color The color to set
  • faceIndex The face to set it for
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceColor ( MColor &color, int faceIndex)

Description

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

Arguments

  • color The color to set
  • faceIndex The face to set it for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setVertexColor ( MColor &color, int vertexIndex, MDGModifier *modifier, MColorRepresentation rep)

Description

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.

Arguments

  • color The color to set
  • vertexIndex The object-relative (mesh-relative/global) vertex index to set it for
  • 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.
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setVertexColor ( MColor &color, int vertexIndex, MDGModifier *modifier)

Description

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.

Arguments

  • color The color to set
  • vertexIndex The object-relative (mesh-relative/global) vertex index to set it for
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceVertexColor ( MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier, MColorRepresentation rep)

Description

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

Arguments

  • color The color to set
  • faceIndex The face to set it for
  • vertexIndex The object-relative (mesh_relative/global) vertex index to set it for
  • 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.
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceVertexColor ( MColor &color, int faceIndex, int vertexIndex, MDGModifier *modifier)

Description

Set color for this vertex in this face.

Arguments

  • color The color to set
  • faceIndex The face to set it for
  • vertexIndex The object-relative (mesh_relative/global) vertex index to set it for
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceVertexColor ( int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier, MColorRepresentation rep)

Description

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

Arguments

  • faceIndex The face to set it for
  • localVertexIndex The face-relative (local) vertex index to set it for
  • color The color to set
  • 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.
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceVertexColor ( int faceIndex, int localVertexIndex, MColor &color, MDGModifier *modifier)

Description

Set color for this vertex in this face.

Arguments

  • faceIndex The face to set it for
  • localVertexIndex The face-relative (local) vertex index to set it for
  • color The color to set
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceColors ( MColorArray &colors, MIntArray &faceList, MColorRepresentation rep)

Description

Set color of specified channels for these faces. The color will be set for each vertex-face component of a face.

Arguments

  • colors The colors to set
  • faceList The faces to set it for
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceColors ( MColorArray &colors, MIntArray &faceList)

Description

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

Arguments

  • colors The colors to set
  • faceList The faces to set it for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setVertexColors ( MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep)

Description

Set color of specified channels for these vertices.

Arguments

  • colors The colors to set
  • vertexList The vertices to set it for
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setVertexColors ( MColorArray &colors, MIntArray &vertexList, MDGModifier *modifier)

Description

Set color for these vertices.

Arguments

  • colors The colors to set
  • vertexList The vertices to set it for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceVertexColors ( MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier, MColorRepresentation rep)

Description

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

Arguments

  • colors The colors to set
  • faceList The faces to set it for
  • vertexList The object-relative (mesh-relative/global) vertex indices to set it for
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceVertexColors ( MColorArray &colors, MIntArray &faceList, MIntArray &vertexList, MDGModifier *modifier)

Description

Set colors for these face/vertex pairs.

Arguments

  • colors The colors to set
  • faceList The faces to set it for
  • vertexList The object-relative (mesh-relative/global) vertex indices to set it for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: removeFaceColors ( MIntArray &faceList)

Description

Remove previously set color these faces. For each face, the color will be unset for each vertex-face component in the face.

Arguments

  • faceList The faces to remove color from

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: removeVertexColors ( MIntArray &vertexList)

Description

Remove color from these vertices.

Arguments

  • vertexList The object-relative (mesh-relative/global) vertex indices to remove color from

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: removeFaceVertexColors ( MIntArray &faceList, MIntArray &vertexList)

Description

Remove colors for these face/vertex pairs

Arguments

  • faceList The faces to remove color for
  • vertexList The corresponding object-relative (mesh-relative/global) vertex indices to remove color for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: deleteFace (int faceId, MDGModifier *modifier)

Description

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

Arguments

  • faceId The face to delete
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: deleteEdge (int edgeId, MDGModifier *modifier)

Description

Delete this edge.

Arguments

  • edgeId The edge to delete
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: deleteVertex (int vertexId, MDGModifier *modifier)

Description

Delete this vertex.

Arguments

  • vertexId The object-relative (mehs-relative/global) vertex index to delete
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numColorSets ( MStatus *ReturnStatus) const

Description

Returns the number of color sets for an object.

Arguments

  • ReturnStatus return status value

Return Value

  • The number of color sets for the object

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setCurrentColorSetName (const MString &setName, MDGModifier *modifier, MSelectionList *currentSelection)

Description

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.

Arguments

  • setName Name of color set to make "current"
  • 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.
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getColorSetNames ( MStringArray &setNames) const

Description

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

Arguments

  • setNames Array of color set names found

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getCurrentColorSetName ( MString &setName) const

Description

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.

Python Notes

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

Arguments

  • setName Name of the "current" color set, if any.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MString MFnMesh:: currentColorSetName ( MStatus * ReturnStatus) const

Description

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.

Arguments

  • ReturnStatus Status code. See below.

Return Value

  • Name of the "current" color set, if any.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getVertexColors ( MColorArray &colors, const MString *colorSet , const MColor *defaultUnsetColor )

Description

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.

Arguments

  • colors Storage for the colors to be returned.
  • colorSet Color set name
  • defaultUnsetColor Default Unset color

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexColors ( MColorArray &colors, const MString *colorSet , const MColor *defaultUnsetColor )

Description

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.

Arguments

  • colors Storage for the colors to be returned.
  • colorSet Color set name
  • defaultUnsetColor Default unset color

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet )

Description

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.

Arguments

  • faceIndex The face to look for
  • localVertexIndex The face-relative (local) vertex id to look for
  • colorIndex Storage for the color index to be returned.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setColors ( const MColorArray & colorArray, const MString *colorSet, MColorRepresentation rep )

Description

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:

  • MFnMesh::clearColors()
  • MFnMesh::setColors( ... )
  • MFnMesh::assignColors()

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

Arguments

  • colorArray The array of color values to be set
  • colorSet The color set to work with
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The colorArray length is smaller than the number of colors in the set.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setColors ( const MColorArray & colorArray, const MString *colorSet )

Description

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:

  • MFnMesh::clearColors()
  • MFnMesh::setColors( ... )
  • MFnMesh::assignColors()

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

Arguments

  • colorArray The array of color values to be set
  • colorSet The color set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter The colorArray length is smaller than the number of colors in the set.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setSomeColors (const MIntArray & colorIds, const MColorArray & colorArray, const MString *colorSet, MColorRepresentation rep)

Description 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. Arguments

  • colorIds The array of colorIds to set values for
  • colorArray The array of color values to be set
  • colorSet Color set to work with
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter colorArray lengths do not match or the arrays are smaller than numColors().
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setSomeColors (const MIntArray & colorIds, const MColorArray & colorArray, const MString *colorSet )

Description

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

  • colorIds The array of colorIds to set values for
  • colorArray The array of color values to be set
  • colorSet Color set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter colorArray lengths do not match or the arrays are smaller than numColors().
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getColors ( MColorArray & colorArray, const MString *colorSet, const MColor *defaultUnsetColor) const

Description

This method copies the color array for this mesh into the given color array. Use the index returned by getColorIndex to access the array. If the color is not set for a vertex, defaultUnsetColor will be return. If defaultUnsetColor is not set, (0,0,0,1) will be return.

Arguments

  • colorArray Storage for the color values list
  • colorSet Color set to work with
  • defaultUnsetColor Default unset color

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getColorIndex (int faceIndex, int localVertexIndex, int &colorIndex, const MString *colorSet )

Description

Get an index into the array returned by getColors.

Arguments

  • faceIndex The face to look for
  • localVertexIndex The face-relative (local) vertex id to look for
  • colorIndex Storage for the color index to be returned.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful. If no color exists for faceIndex/localVertexIndex, then the colorIndex will return -1.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setColor ( int colorId, const MColor & color, const MString *colorSet, MColorRepresentation rep)

Description

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.

Arguments

  • colorId The element in the color list to be set
  • color The new color value that is to be set
  • colorSet Color set to work with
  • rep The RGB/RGBA/A channel(s) to set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setColor ( int colorId, const MColor & color, const MString *colorSet)

Description

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.

Arguments

  • colorId The element in the color list to be set
  • color The new color value that is to be set
  • colorSet Color set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getColor ( int colorId, MColor & color, const MString * colorSet, const MColor * defaultUnsetColor) const

Description

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.

Arguments

  • colorId The element in the color list to examine
  • color Storage for the color value
  • colorSet Color set to work with
  • defaultUnsetColor default unset color

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid colorId. The colorId should be less than numColors() or numColors(colorSet).
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: assignColor ( int polygonId, int vertexIndex, int colorId, const MString *colorSet )

Description

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

Arguments

  • polygonId The polygon (face) to map to
  • vertexIndex The face-relative (local) vertex id of the polygon to map to
  • colorId The color entry from the color list that will be mapped
  • colorSet Color set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid polygonId, vertexIndex, or colorId specified.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: assignColors ( const MIntArray & colorIds, const MString * colorSet )

Description

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.

Arguments

  • colorIds The color indices to be mapped to each polygon-vertex
  • colorSet Color set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid colorIds array.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: clearColors ( const MString * colorSet )

Description

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.

Arguments

  • colorSet Color set to work with

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid colorIds array.
  • MS::kInvalidIndex Invalid colorSet was specified
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceVertexNormal ( MVector &normalIn, int faceId, int vertexId, MSpace::Space space, MDGModifier *modifier)

Description

Set Normal for this face/vertex pair

Arguments

  • normalIn The normal to set
  • faceId The face to set it for
  • vertexId The object-relative (mesh-relative/global) vertex index to set it for
  • space World space or Object space
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setVertexNormal ( MVector &normalIn, int vertexId, MSpace::Space space, MDGModifier *modifier)

Description

Set Shared Normal for this vertex

Arguments

  • normalIn The normal to set
  • vertexId The object-relative (mesh-relative/global) vertex index to set it for
  • space World space or Object space
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFaceVertexNormals ( MVectorArray &normalsIn, MIntArray & faceList, MIntArray & vertexList, MSpace::Space space)

Description

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.

Arguments

  • normalsIn The normals to set
  • faceList The faces to set them for
  • vertexList The object-relative (mesh-relative/global) vertex indices to set them for
  • space World space or Object space

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setVertexNormals ( MVectorArray &normalsIn, MIntArray & vertexList, MSpace::Space space)

Description

Set Shared Normals for these vertices. The length of the normalsIn array should be same as the length of the vertexList array.

Arguments

  • normalsIn The normals to set
  • vertexList The object-relative (mesh-relative/global) vertex indices to set them for
  • space World space or Object space

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: isNormalLocked (int normalId, MStatus * ReturnStatus ) const

Description

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

*

MStatus MFnMesh:: lockFaceVertexNormals ( MIntArray & faceList, MIntArray & vertexList)

Description

Lock Normals for these face/vertex pairs

Arguments

  • faceList The faces to lock normal in
  • vertexList The corresponding object-relative (global) vertex indices to lock them for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: lockVertexNormals ( MIntArray & vertexList)

Description

Lock Shared Normals for these vertices.

Arguments

  • vertexList The object-relative (global) verticex ides to lock normals for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: unlockFaceVertexNormals ( MIntArray & faceList, MIntArray & vertexList)

Description

Unlock Normals for these face/vertex pairs

Arguments

  • faceList The faces to unlock normal in
  • vertexList The corresponding object-relative (global) vertex indices to unlock them for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: unlockVertexNormals ( MIntArray & vertexList)

Description

Unlock Shared Normals for these vertices

Arguments

  • vertexList The vertices to unlock normals for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: getHoles ( MIntArray & holeInfoArray, MIntArray & holeVertexArray, MStatus * ReturnStatus )

Description

Retrieves a list of the holes in the polygon.

Arguments

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

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

Return Value

  • The number of holes in the mesh.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: onBoundary (int polygonId, MStatus * ReturnStatus) const

Description

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

Arguments

  • polygonId The polygon (face) to examine
  • ReturnStatus The return status of the method

Return Value

  • true If the specified edge is on the border of the object.
  • false If the specified edge is not on the boundary of the object.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid polygonId was specified
  • MS::kFailure An object error has occurred.

bool MFnMesh:: isBlindDataTypeUsed ( int blindDataId, MStatus * ReturnStatus ) const

Description

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

Arguments

  • blindDataId The blind data id to check for
  • Status Code Returned status

Return Value

  • true: Id in use, false: id not in use

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: createBlindDataType ( int blindDataId, MStringArray longNames, MStringArray shortNames, MStringArray formatNames)

Description

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

Arguments

  • blindDataId The desired id for the new blind data type
  • longNames Attribute long names
  • shortNames Attribute short names
  • formatNames Names of the data types.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceVertexBlindDataIndex (int faceIndex, int vertexIndex, int &blindDataIndex) const

Description

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

Arguments

  • faceIndex The face index to look for
  • vertexIndex The object-relative (mesh-relative/global) vertex index
  • blindDataIndex The component index for face vertex blind data storage to be returned

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBlindDataFaceVertexIndices (int blindDataIndex, int &faceIndex, int &vertexIndex) const

Description

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

Arguments

  • blindDataIndex The component index for face vertex blind data storage to decompose
  • faceIndex The corresponding face index to be returned
  • vertexIndex The object-relative (mesh-relative/global) vertex index to be returned

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: hasBlindDataComponentId ( int compID, MFn::Type compType, int blindDataId, MStatus * ReturnStatus) const

Description

Does this component have blind data with the given ID.

Arguments

  • compId The component to check for blind data om When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • Status Code Status Code

Return Value

  • true: has the specified blind data, false: does not

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: hasBlindData ( int compID, MFn::Type compType, int blindDataId, MStatus * ReturnStatus) const

Description

This method is OBSOLETE and NON SCRIPTABLE. Please use hasBlindDataComponentId() instead.

bool MFnMesh:: hasBlindData ( MFn::Type compType, int blindDataId, MStatus * ReturnStatus) const

Description

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

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • Status Code Status Code

Return Value

  • true: has the specified blind data, false: does not

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: hasBlindDataComponentId ( int compID, MFn::Type compType, MStatus * ReturnStatus) const

Description

Does this component have any kind of blind data

Arguments

  • compId The component to check for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • Status Code Status Code

Return Value

  • true: has the specified blind data, false: does not

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: hasBlindData ( int compID, MFn::Type compType, MStatus * ReturnStatus) const

Description

This method is OBSOLETE and NOT SCRIPTABLE. Please use hasBlindDataComponentId() instead.

bool MFnMesh:: hasBlindData ( MFn::Type compType, MStatus * ReturnStatus) const

Description

Does any component of this type have any blind data. (.e. is there any vertex blind data on this mesh?)

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • Status Code Status Code

Return Value

  • true: has the specified blind data, false: does not

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBlindDataTypes ( MFn::Type compType, MIntArray & blindDataIds ) const

Description

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)

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataIds space for this list of blind data id values.

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBlindDataAttrNames (int blindDataId, MStringArray & longNames, MStringArray & shortNames) const

Description

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

Arguments

  • blindDataId The blind data id to check for
  • longNames Space for the attribute long names
  • shortNames Space for the attribute short names

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBlindDataAttrNames (int blindDataId, MStringArray & longNames, MStringArray & shortNames, MStringArray & formatNames) const

Description

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

Arguments

  • blindDataId The blind data id to check for
  • longNames Space for the attribute long names
  • shortNames Space for the attribute short names
  • formatName Space for the data format names

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred. The specified blind data type does not exist.

MStatus MFnMesh:: getIntBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, int &data) const

Description

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.

Arguments

  • compId The component to get for blind data on. When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • data Space for the data item

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getIntBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MIntArray & data) const

Description

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.

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • 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)
  • data Space for the data items

Return Value

  • true: has the specified blind data, false: does not

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFloatBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, float &data) const

Description

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.

Arguments

  • compId The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • data Space for the data item

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFloatBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MFloatArray & data) const

Description

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.

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • 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)
  • data Space for the data items

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getDoubleBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, double &data) const

Description

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.

Arguments

  • compId The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • data Space for the data item

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getDoubleBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MDoubleArray & data) const

Description

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.

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • 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)
  • data Space for the data items

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBoolBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, bool &data) const

Description

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.

Arguments

  • compId The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • data Space for the data item

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBoolBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MIntArray & data) const

Description

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.

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • 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)
  • 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

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getStringBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, MString &data) const

Description

This method is OBSOLETE and NON SCRIPTABLE. Please use stringBlindDataComponentId() instead.

MString MFnMesh:: stringBlindDataComponentId ( int compID, MFn::Type compType, int blindDataId, MString attrName, MStatus *ReturnStatus) const

Description

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.

Arguments

  • compId The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • ReturnStatus Status code. See below.

Return Value

  • Blind data.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getStringBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MStringArray & data) const

Description

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.

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • 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)
  • 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

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBinaryBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, MString &data) const

Description

This method is OBSOLETE and NON SCRIPTABLE. Please use getBinaryBlindDataComponentId() instead.

MString MFnMesh:: binaryBlindDataComponentId ( int compID, MFn::Type compType, int blindDataId, MString attrName, MStatus *ReturnStatus) const

Description

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.

Arguments

  • compId The component to get for blind data on When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • ReturnStatus Status code. See below.

Return Value

  • The data item.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getBinaryBlindData ( MFn::Type compType, int blindDataId, MString attrName, MIntArray & compIDs, MStringArray & data) const

Description

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.

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The blind data id to check for
  • attrName The attribute name
  • 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)
  • 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

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setIntBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, int data)

Description

Set a value for an integer blind data attribute.

Arguments

  • compId The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setIntBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, int data)

Description

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

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setIntBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MIntArray & data)

Description

Set a values for an integer blind data on an array of components. The arrays of values and components must be the same size.

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data The attribute values for each component

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFloatBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, float data)

Description

Set a value for a float blind data attribute.

Arguments

  • compId The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFloatBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, float data)

Description

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

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setFloatBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MFloatArray & data)

Description

Set a values for a float blind data on an array of components. The arrays of values and components must be the same size.

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data The attribute values for each component

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setDoubleBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, double data)

Description

Set a value for a double blind data attribute.

Arguments

  • compId The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setDoubleBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, double data)

Description

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

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setDoubleBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MDoubleArray & data)

Description

Set a values for a double blind data on an array of components. The arrays of values and components must be the same size.

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data The attribute values for each component

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setBoolBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, bool data)

Description

Set a value for a boolean blind data attribute.

Arguments

  • compId The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setBoolBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, bool data)

Description

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

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setBoolBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MIntArray & data)

Description

Set a values for a boolean blind data on an array of components. The arrays of values and components must be the same size.

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data The attribute values for each component

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setStringBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, MString data)

Description

Set a value for a string blind data attribute.

Arguments

  • compId The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setStringBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MString data)

Description

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

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setStringBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MStringArray & data)

Description

Set a values for a string blind data on an array of components. The arrays of values and components must be the same size.

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data The attribute values for each component

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setBinaryBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, MString data)

Description

Set a value for a binary blind data attribute.

Arguments

  • compId The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value as an MString. Note that the physical size must be set explicitly for binary data.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setBinaryBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MString data)

Description

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

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setBinaryBlindData ( MIntArray & compIDs, MFn::Type compType, int blindDataId, MString attrName, MStringArray & data)

Description

Set a values for a binary blind data on an array of components. The arrays of values and components must be the same size.

Arguments

  • 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)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data The attribute values for each component

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setBinaryBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName, char *data, int length)

Description

Set a value for a binary blind data attribute.

Arguments

  • compId The component to set the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The desired id for the new blind data type
  • attrName Attribute name
  • data Attribute value as a char string
  • length Length of char string to use

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: clearBlindData ( int compID, MFn::Type compType, int blindDataId, MString attrName)

Description

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

Arguments

  • compId The component to clear the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The id for the blind data to be cleared
  • attrName Attribute name

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: clearBlindData ( MFn::Type compType, int blindDataId, MString attrName)

Description

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

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The id for the blind data to be cleared
  • attrName The attribute to clear the blind data for

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: clearBlindData ( MFn::Type compType)

Description

Delete all blind data from components of the given type, e.g. all edges from a particular component.

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: clearBlindData (int compID, MFn::Type compType, int blindDataId)
Description

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

Arguments

  • compId The component to clear the blind data for When compType = MFn::kMeshFaceVertComponent then compID must be obtained by calling MFnMesh::getFaceVertexBlindDataIndex(faceIndex,vertexIndex)
  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The id for the blind data to be cleared

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: clearBlindData ( MFn::Type compType, int blindDataId)

Description

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

Arguments

  • compType The component type e.g. MFn::kMeshVertComponent
  • blindDataId The id for the blind data to be cleared

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: createUVSet ( MString &uvSetName, MDGModifier *modifier, const MUintArray *instances)

Description

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

Arguments

  • 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.
  • 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.
  • instances The instance number(s) for which the set should be added, or NULL if the uv-set should be shared by all instances.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MString MFnMesh:: createUVSetWithName (const MString &uvSetName, MDGModifier *modifier, MStatus *ReturnStatus, const MUintArray *instances)

Description

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.

Arguments

  • 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.
  • 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.
  • ReturnStatus Status code. See below.
  • instances The instance number(s) for which the set should be added, or NULL if the uv-set should be shared by all instances.

Return Value

  • The name used for the UV set. May be different then the given name if a new name needed to be generated.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: copyUVSet (const MString &fromName, MString &toName, MDGModifier *modifier)

Description

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

Arguments

  • fromName The name of the uv set to change
  • 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.
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MString MFnMesh:: copyUVSetWithName (const MString &fromName, const MString &toName, MDGModifier *modifier, MStatus *ReturnStatus)

Description

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.

Arguments

  • fromName The name of the uv set to change
  • toName The name to set the uv set to.
  • ReturnStatus Status Code. See below.
  • 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.

Return Value

  • The name of the new UV set. May be different then the name passed in if a new name was generated.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: renameUVSet (const MString &origName, const MString &newName, MDGModifier *modifier)

Description

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.

Arguments

  • origName The name of the uv set to change
  • newName The name to set the uv set to.
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: deleteUVSet (const MString &setName, MDGModifier *modifier, MSelectionList *currentSelection)

Description

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.

Arguments

  • setName Name of the uv set to delete
  • 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.
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setCurrentUVSetName (const MString &setName, MDGModifier *modifier, MSelectionList *currentSelection)

Description

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.

Arguments

  • setName Name of uv set to make "current"
  • 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.
  • 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.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getCurrentUVSetName ( MString &setName, int instance) const

Description

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.

Arguments

  • setName Name of the "current" uv set, if any.
  • instance Instance of the mesh whose set we are interested in

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MString MFnMesh:: currentUVSetName ( MStatus *ReturnStatus, int instance) const

Description

Python Notes

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

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.

Arguments

  • setName Name of the "current" uv set, if any.
  • instance Instance of the mesh whose set we are interested in

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnMesh:: numUVSets ( MStatus *ReturnStatus) const

Description

Returns the number of uv sets for an object.

Arguments

  • ReturnStatus return status value

Return Value

  • The number of uv sets for the object

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getUVSetNames ( MStringArray &setNames) const

Description

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

Arguments

  • setNames Array of uv set names found

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getUVSetFamilyNames ( MStringArray &familyNames) const

Description

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.

Arguments

  • setNames Array of uv set names found

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getUVSetsInFamily (const MString & familyName, MStringArray &setNames) const

Description

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.

Arguments

  • familyName The uv set family name
  • setNames Array of uv set names in the family

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: isUVSetPerInstance ( const MString & name, MStatus *ReturnStatus ) const

Description

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.

Arguments

  • name The set name or set family name
  • ReturnStatus Status code

Return Value

  • true if the set is per-instance

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getFaceUVSetNames (int polygonId, MStringArray &setNames) const
Description

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

Arguments

  • polygonId The polygon ID of the face of interest
  • setNames The string array to return the UV sets names in

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred or an internal error.

MStatus MFnMesh:: getAssociatedUVSetTextures (const MString uvSetName, MObjectArray & textures) const

Description

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.

Arguments

  • uvSetName Name of uv set to use
  • textures Texture nodes using the uv set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: getAssociatedUVSetInstances (const MString & uvSetName, MIntArray & instances) const

Description

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.

Arguments

  • uvSetName Name of uv set to use
  • instances Instances associated with this uv set

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred or the name does not exist

MStatus MFnMesh:: subdivideFaces ( MIntArray & faceList, int divisionCount)

Description

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.

Arguments

  • faceList array of face IDs to subdivide
  • divisionCount number of subsequent subdivisions to do

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kValueOutOfRange The given subdivision count is less than 1
    • MS::kIndexOutOfRange The given faceIDs are not on the mesh
    • MS::kInvalidParameter The given information cannot result in the subdivision of the faces.
    • MS::kNotFound The given face list is empty
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

MStatus MFnMesh:: subdivideEdges ( MIntArray & edgeList, int divisionCount)

Description

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.

Arguments

  • edgeList array of edge component IDs to be subdivided
  • divisionCount number of subsequent subdivisions to do

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kIndexOutOfRange The given edge IDs are not on the mesh
    • MS::kValueOutOfRange The given subdivision count is less than 1
    • MS::kInvalidParameter The subdivisions could not be completed successfully.
    • MS::kNotFound The given edge list is empty
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

MStatus MFnMesh:: extrudeFaces ( MIntArray & faceList, int extrusionCount, MFloatVector * translation, bool extrudeTogether)

Description

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.

Arguments

  • faceList array of face component IDs to be extruded
  • extrusionCount number of subsequent extrusions to do
  • translation translation vector to apply to the extruded elements. This is a world-space translation. Use NULL if not required.
  • extrudeTogether sets whether the components should be extruded individually or together, as if one complex component was being extruded.

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kIndexOutOfRange The given face IDs are not on the mesh
    • MS::kValueOutOfRange The given extrusion count is less than 1
    • MS::kInvalidParameter The extrusion could not be completed successfully.
    • MS::kNotFound The given face list is empty
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

MStatus MFnMesh:: extrudeEdges ( MIntArray & edgeList, int extrusionCount, MFloatVector * translation, bool extrudeTogether)

Description

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.

Arguments

  • edgeList array of edge component IDs to be extruded
  • extrusionCount number of subsequent extrusions to do
  • translation translation vector to apply to the extruded elements. This is a world-space translation. Use NULL if not required.
  • extrudeTogether sets whether the components should be extruded individually or together, as if one complex component was being extruded.

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kIndexOutOfRange The given edge IDs are not on the mesh
    • MS::kValueOutOfRange The given extrusion count is less than 1
    • MS::kInvalidParameter The extrusion could not be completed successfully.
    • MS::kNotFound The given edge list is empty
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

MStatus MFnMesh:: duplicateFaces ( MIntArray & faceList, MFloatVector * translation)

Description

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.

Arguments

  • faceList array of face component IDs to be duplicated
  • translation translation vector to apply to the duplicated elements. This is a world-space translation. Use NULL if not required.

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kIndexOutOfRange The given face IDs are not on the mesh
    • MS::kInvalidParameter The duplication could not be completed successfully.
    • MS::kNotFound The given face list is empty
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

MStatus MFnMesh:: extractFaces ( MIntArray & faceList, MFloatVector * translation)

Description

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.

Arguments

  • faceList array of face component IDs to be extracted
  • translation translation vector to apply to the extracted elements. This is a world-space translation. Use NULL if not required.

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kIndexOutOfRange The given face IDs are not on the mesh
    • MS::kInvalidParameter The extraction could not be completed successfully.
    • MS::kNotFound The given face list is empty
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

MStatus MFnMesh:: collapseFaces ( MIntArray & faceList)

Description

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

Arguments

  • faceList array of face component IDs to be collapsed

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kIndexOutOfRange The given face IDs are not on the mesh
    • MS::kInvalidParameter The collapse could not be completed successfully.
    • MS::kNotFound The given face list is empty
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

MStatus MFnMesh:: collapseEdges ( MIntArray & edgeList)

Description

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.

Arguments

  • faceList array of edge component IDs to be collapsed

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kIndexOutOfRange The given edge IDs are not on the mesh
    • MS::kInvalidParameter The collapse could not be completed successfully.
    • MS::kNotFound The given edge list is empty
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

MStatus MFnMesh:: split ( MIntArray & placements, MIntArray & edgeList, MFloatArray & edgeFactors, MFloatPointArray & internalPoints)

Description

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

The split algorithm has two steps. First, it adds new vertices as instructed by the elements of the placements array. Second, the new vertices are joined together by new edges.

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 can be split more than once, but you cannot place two consecutive vertices on the same edge.

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.

After the new vertices are all added, they are joined by new edges in a continuous fashion so that the first vertex created is joined to the second vertex. The second vertex is then joined to the third vertex and so forth. If an edge cannot be created, the whole algorithm fails.

Arguments

  • placements array that contains elements of the SplitPlacement enumeration. They represent where to place the new vertices for the split.
  • 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.
  • 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.
  • 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.

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter One of the following parameter errors
    • MS::kIndexOutOfRange One or more of the edge IDs are not on the mesh.
    • MS::kValueOutOfRange One or more of the edge factors are not within the [0,1] range
    • MS::kInvalidParameter The split algorithm could not be completed successfully or the array sizes are not appropriate.
    • MS::kNotFound The given placements list is empty.
  • MS::kFailure An object error has occurred.
    • MS::kObjectDoesNotExist The base stucture was not initialized properly
    • MS::kShapeHasNoGeometry The mesh shape has no geometry to work on

void MFnMesh:: setCheckSamePointTwice ( bool check )
Description

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.

Arguments

  • check true for checking, false otherwise

bool MFnMesh:: getCheckSamePointTwice ( void )
Description

Return true if checking for duplicate points is turned on. Return false otherwise.

bool MFnMesh:: hasColorChannels ( const MString &colorSet, MStatus *ReturnStatus) const

Description

This method returns if the color set has RGB components.

Arguments

  • colorSet Color set to work with
  • ReturnStatus Status code

Return Value

  • true The color set has RGB components
  • false The color set doesn't have RGB components

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnMesh:: hasAlphaChannels ( const MString &colorSet, MStatus *ReturnStatus) const

Description

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

Arguments

  • colorSet Color set to work with
  • ReturnStatus Status code

Return Value

  • true The color set has Alpha component
  • false The color set doesn't have Alpha component

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MFnMesh::MColorRepresentation MFnMesh:: getColorRepresentation ( const MString &colorSet, MStatus *ReturnStatus) const

Description

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

Arguments

  • colorSet Color set to work with
  • ReturnStatus Status code

Return Value

  • kAlpha The color set contains only Alpha component
  • kRGB The color set contains only RGB components
  • kRGBA The color set contains RGBA components

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure The color set doesn't exist

bool MFnMesh:: isColorClamped ( const MString &colorSet, MStatus *ReturnStatus) const

Description

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

Arguments

  • colorSet Color set to work with
  • ReturnStatus Status code

Return Value

  • true All components in the color set are clamped
  • false All components in the color set are not clamped

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnMesh:: setIsColorClamped ( const MString &colorSet, bool clamped )

Description

Set the color set to be clamped.

Arguments

  • colorSet Color set to work with
  • clamped If the color set should be set clamped

Return Value

  • If the operation is successful.

Status Codes

  • true clamped.
  • false unclamped.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright