MFnMesh

Base Class

MFnDagNode

Constants

Name Type Description
Color Representations
kAlpha int Alpha only.
kRGB int Red, green and blue only.
kRGBA int Red, green, blue and alpha.
Split Placement Types
kOnEdge int Split at a position along an edge.
kInternalPoint int Split at a point within a face.
kInvalid int Invalid placement type.
Boolean Operations
kIntersection int Boolean intersection.
kDifference int Boolean difference.
kUnion int Boolean union.
Other
kInstanceUnspecified int Used to specify non-instance-specific UVSets.
kIntersectTolerance float Default tolerance for mesh intersection calculations.
kPointTolerance float Default tolerance when comparing points.

Static Methods

Signature Parameters Returns Description
Name Type Description
Only available in Maya 2012 HotFix 1 or later:
autoUniformGridParams()       MMeshIsectAccelParams Creates an object which specifies a uniform voxel grid structure which can be used by the intersection routines to speed up their operation. The number of voxel cells to use will be determined automatically 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.
clearGlobalIntersectionAcceleratorInfo()         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.
globalIntersectionAcceleratorsInfo()       string Returns a string that describes the systemwide resource usage for cached mesh intersection accelerators. The string will be of the following form:

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.

uniformGridParams(xDiv, yDiv, zDiv) xDiv int Number of voxels in x direction MMeshIsectAccelParams Creates an object which specifies a uniform voxel grid structure which can 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.
yDiv int Number of voxels in y direction
zDiv int Number of voxels in z direction

Constructors

Signature Parameters Description
Name Type Description
MFnMesh()       Default constructor. Returns a new MFnMesh functionset with no Maya object attached.
MFnMesh(mesh) mesh MObject Mesh node or mesh geometry data. Returns a new MFnMesh object attached to the given mesh node or mesh geometry data.
Only available in Maya 2012 HotFix 1 or later:
MFnMesh(path) path MDagPath Dag path of a mesh node. Returns a new MFnMesh object attached to the given mesh node.

Virtual Methods

None.

Object Methods

Signature Parameters Returns Description
Name Type Description
getFloatPoints(space=MSpace.kObject) space MSpace constant Coordinate system to use. MFloatPointArray Returns a copy of the mesh's vertex positions as an MFloatPointArray.
Only available in Maya 2012 HotFix 1 or later:
addPolygon(vertices, mergeVertices=True, pointTolerance=kPointTolerance) vertices sequence of MPoints Positions of the new polygon's vertices. int Adds a new polygon to the mesh, returning the index of the new polygon. If mergeVertices is True and a new vertex is within pointTolerance of an existing one, then they are "merged" by reusing the existing vertex and discarding the new one.
mergeVertices bool If True, reuse an existing vertex if it is within the specified tolerance of a new one.
pointTolerance float How close must an existing vertex be to a new one before they are merged.
allIntersections(raySource, rayDirection, space, maxParam, testBothDirections, faceIds=None, triIds=None, idsSorted=False, accelParams=None, tolerance=kIntersectTolerance, sortHits=False) raySource MFloatPoint Ray starting point. (hitPoints, hitRayParams, hitFaces, hitTriangles, hitBary1s, hitBay2s) Finds all intersection of a ray starting at raySource and travelling in rayDirection with the mesh.

If faceIds is specified, then only those faces will be considered for intersection. If both faceIds and triIds are given, then the triIds will be interpreted as face-relative and each pair of entries will be taken as a (face,triangle) pair to be considered for intersection. Thus, the face-triangle pair (10,0) means the first triangle on face 10. If neither faceIds nor triIds is given, 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.

The search proceeds by testing all applicable face-triangles looking for intersections. If the accelParams parameter is given then the mesh builds an intersection acceleration structure based on it. 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 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 as a tuple containing the following:

  • hitPoints (MFloatPointArray) - coordinates of the points hit, in the space specified by the caller.
  • hitRayParams (MFloatArray) - parametric distances along the ray to the points hit.
  • hitFaces (MIntArray) - IDs of the faces hit
  • hitTriangles (MIntArray) - face-relative IDs of the triangles hit
  • hitBary1s (MFloatArray) - first barycentric coordinate of the points hit. If the vertices of the hitTriangle are (v1, v2, v3) then the barycentric coordinates are such that the hitPoint = (*hitBary1)*v1 + (*hitBary2)*v2 + (1-*hitBary1-*hitBary2)*v3.
  • hitBary2s (MFloatArray) - second barycentric coordinate of the points hit.
If no point was hit then the arrays will all be empty.
rayDirection MFloatVector Direction of the ray.
space MSpace constant Coordinate space in which the raySource, rayDirection and the returned hitPoint are specified.
maxParam float 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 bool 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.
faceIds sequence of ints If present, restricts the search to the specified faces.
triIds sequence of ints Face-relative triangle IDs. If present, faceIds must also be present and the two form (face, triangle) pairs to which the search is restricted.
idsSorted bool Set this to True if the faceIds or faceIds/triIds arrays are properly sorted into ascending order. For face-triangle pairs, the arrays must be sorted by ascending face ids, then by ascending triangle ids within each face. The routine sortIntersectionFaceTriIds() can be used to perform this task. It is not important to sort ids unless an acceleration structure is being used. When using an acceleration structure in conjunction with a limited set of faces or face-triangles, it is ESSENTIAL to sort the indices, otherwise performance will be severely degraded.
accelParams MMeshIsectAccelParams Optional parameters for accelerating the search.
tolerance float 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.
sortHits bool 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 returned arrays.
anyIntersection(raySource, rayDirection, space, maxParam, testBothDirections, faceIds=None, triIds=None, idsSorted=False, accelParams=None, tolerance=kIntersectTolerance) raySource MFloatPoint Ray starting point. (hitPoint, hitRayParam, hitFace, hitTriangle, hitBary1, hitBay2) or None Finds any intersection of a ray starting at raySource and travelling in rayDirection with the mesh.

If faceIds is specified, then only those faces will be considered for intersection. If both faceIds and triIds are given, then the triIds will be interpreted as face-relative and each pair of entries will be taken as a (face,triangle) pair to be considered for intersection. Thus, the face-triangle pair (10,0) means the first triangle on face 10. If neither faceIds nor triIds is given, 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.

The search proceeds by testing all applicable face-triangles looking for intersections. If the accelParams parameter is given then the mesh builds an intersection acceleration structure based on it. 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 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 point will be returned as a tuple containing the following:

  • hitPoint (MFloatPoint) - coordinate of the point hit, in the space specified by the caller.
  • hitRayParam (float) - parametric distance along the ray to the point hit.
  • hitFace (int) - ID of the face hit
  • hitTriangle (int) - face-relative ID of the triangle hit
  • hitBary1 (float) - first barycentric coordinate of the point hit. If the vertices of the hitTriangle are (v1, v2, v3) then the barycentric coordinates are such that hitPoint = (*hitBary1)*v1 + (*hitBary2)*v2 + (1-*hitBary1-*hitBary2)*v3.
  • hitBary2 (float) - second barycentric coordinate of the point hit.
If no point was hit then None will be returned.
rayDirection MFloatVector Direction of the ray.
space MSpace constant Coordinate space in which the raySource, rayDirection and the returned hitPoint are specified.
maxParam float 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 bool 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.
faceIds sequence of ints If present, restricts the search to the specified faces.
triIds sequence of ints Face-relative triangle IDs. If present, faceIds must also be present and the two form (face, triangle) pairs to which the search is restricted.
idsSorted bool Set this to True if the faceIds or faceIds/triIds arrays are properly sorted into ascending order. For face-triangle pairs, the arrays must be sorted by ascending face ids, then by ascending triangle ids within each face. The routine sortIntersectionFaceTriIds() can be used to perform this task. It is not important to sort ids unless an acceleration structure is being used. When using an acceleration structure in conjunction with a limited set of faces or face-triangles, it is ESSENTIAL to sort the indices, otherwise performance will be severely degraded.
accelParams MMeshIsectAccelParams Optional parameters for accelerating the search.
tolerance float 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.
assignColor(faceId, vertexIndex, colorId, colorSet='') faceId int ID of face. Reference to self Assigns a color from a colorSet to a specified vertex of a face.
vertexIndex int Face-relative/local index of vertex.
colorId int ID of the color.
colorSet string Color set to use. If not specified then the mesh's current color set will be used.
assignColors(colorIds, colorSet='') colorIds sequence of ints IDs of the colors. Reference to self Assigns colors to all of the mesh's face-vertices. The colorIds sequence must contain an entry for every vertex of every face, in face order, meaning that the entries for all the vertices of face 0 come first, followed by the entries for the vertices of face 1, etc.
colorSet string Color set to use. If not specified then the mesh's current color set will be used.
assignUV(faceId, vertexIndex, uvId, uvSet='') faceId int ID of face. Reference to self Assigns a UV coordinate to a specified vertex of a polygon.
vertexIndex int Face-relative/local index of vertex.
uvId int ID of the UV to assign to the vertex.
uvSet string UV set to use. If not specified then the mesh's current UV set will be used.
assignUVs(uvCounts, uvIds, uvSet='') uvCounts sequence of ints Number of UVs to assign for each of the mesh's faces. Must equal the number of vertices in that face or be 0 to indicate that no UVs will be assigned to that face. Reference to self Assigns UV coordinates to the mesh's face-vertices.
uvIds sequence of ints IDs of the UVs to assign.
uvSet string UV set to use. If not specified then the mesh's current UV set will be used.
booleanOp(op, mesh1, mesh2) op Boolean Operation constant Operation to perform. Reference to self Replaces this mesh's geometry with the result of a boolean operation on the two specified meshes.
mesh1 MFnMesh Functionset attached to the first mesh in the operation.
mesh2 MFnMesh Functionset attached to the second mesh in the operation.
cachedIntersectionAcceleratorInfo()       string Retrieves a string that describes the intersection acceleration structure for this object, if any. The string will be of the following form:

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.

cleanupEdgeSmoothing()       Reference to self Updates the mesh after setEdgeSmoothing has been done.

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

clearBlindData(compType) compType MFn Type constant Mesh component type. Reference to self Deletes all blind data from all the mesh's components of a given type.
clearBlindData(compType, blindDataId, compId=None, attr='') compType MFn Type constant Mesh component type. Reference to self Deletes values of the specified blind data type from the mesh's components of a given type. If a component ID is provided then the data is only deleted from that component, otherwise it is deleted from all of the mesh's components of the specified type. If a blind data attribute name is provided then only data for that attribute is deleted, otherwise data for all of the blind data type's attributes is deleted.
blindDataId int Blind data type ID.
compId int Mesh component ID.
attr string Attribute name.
clearColors(colorSet='') colorSet string Color set to use. If not specified then the mesh's current color set will be used. Reference to self Clears out all colors from a colorSet, and leaves behind an empty colorset. This method should be used if it is needed to shrink the actual size of the color set. In this case, the user should call clearColors(), setColors() and then assignColors() to rebuild the mapping info.

When called on mesh data, 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.

clearUVs(uvSet='') uvSet string UV set to use. If not specified then the mesh's current UV set will be used. Reference to self Clears out all texture coordinates from 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 mesh data, 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.

closestIntersection(raySource, rayDirection, space, maxParam, testBothDirections, faceIds=None, triIds=None, idsSorted=False, accelParams=None, tolerance=kIntersectTolerance) raySource MFloatPoint Ray starting point. (hitPoint, hitRayParam, hitFace, hitTriangle, hitBary1, hitBay2) or None Finds the closest intersection of a ray starting at raySource and travelling in rayDirection with the mesh.

If faceIds is specified, then only those faces will be considered for intersection. If both faceIds and triIds are given, then the triIds will be interpreted as face-relative and each pair of entries will be taken as a (face,triangle) pair to be considered for intersection. Thus, the face-triangle pair (10,0) means the first triangle on face 10. If neither faceIds nor triIds is given, 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.

The search proceeds by testing all applicable face-triangles looking for intersections. If the accelParams parameter is given then the mesh builds an intersection acceleration structure based on it. 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 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 as a tuple containing the following:

  • hitPoint (MFloatPoint) - coordinate of the point hit, in the space specified by the caller.
  • hitRayParam (float) - parametric distance along the ray to the point hit.
  • hitFace (int) - ID of the face hit
  • hitTriangle (int) - face-relative ID of the triangle hit
  • hitBary1 (float) - first barycentric coordinate of the point hit. If the vertices of the hitTriangle are (v1, v2, v3) then the barycentric coordinates are such that hitPoint = (*hitBary1)*v1 + (*hitBary2)*v2 + (1-*hitBary1-*hitBary2)*v3.
  • hitBary2 (float) - second barycentric coordinate of the point hit.
If no point was hit then None will be returned.
rayDirection MFloatVector Direction of the ray.
space MSpace constant Coordinate space in which the raySource, rayDirection and the returned hitPoint are specified.
maxParam float 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 bool 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.
faceIds sequence of ints If present, restricts the search to the specified faces.
triIds sequence of ints Face-relative triangle IDs. If present, faceIds must also be present and the two form (face, triangle) pairs to which the search is restricted.
idsSorted bool Set this to True if the faceIds or faceIds/triIds arrays are properly sorted into ascending order. For face-triangle pairs, the arrays must be sorted by ascending face ids, then by ascending triangle ids within each face. The routine sortIntersectionFaceTriIds() can be used to perform this task. It is not important to sort ids unless an acceleration structure is being used. When using an acceleration structure in conjunction with a limited set of faces or face-triangles, it is ESSENTIAL to sort the indices, otherwise performance will be severely degraded.
accelParams MMeshIsectAccelParams Optional parameters for accelerating the search.
tolerance float 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.
collapseEdges(edges) edges sequence of ints IDs of edges to be collapsed. Reference to self Collapses 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.
collapseFaces(faces) faces sequence of ints IDs of faces to be collapsed. Reference to self Collapses faces into vertices. Adjacent faces will be collapsed together into a single vertex. Non-adjacent faces will be collapsed into their own, separate vertices.
copy(source, parent=kNullObj) source MObject Mesh node or mesh data object to be copied. MObject Creates a new mesh with the same geometry as the source. Raises TypeError if the source is not a mesh node or mesh data object or it contains an empty mesh.

If the parent is a kMeshData wrapper (e.g. from MFnMeshData.create() ) then a mesh data object will be created and returned and the wrapper will be set to reference it.

If the parent is a transform type node then a mesh node will be created and parented beneath it and the return value will be the mesh node.

If the parent is any other type of node a TypeError will be raised.

If no parent is provided then a transform node will be created and returned and a mesh node will be created and parented under the transform.

parent MObject Parent of the new mesh.
copyInPlace(source) source MObject Mesh node or mesh data object to be copied. Reference to self. Replaces the current mesh's geometry with that from the source. Raises TypeError if the source is not a mesh node or mesh data object or it contains an empty mesh.
copyUVSet(fromName, toName, modifier=None) fromName string Name of source UV set. string Copies the contents of one UV set into another.

If the source UV set does not exist, or if it has the same name as the destination, then no copy will be made.

If the destination UV set exists then its contents will be replace by a copy of the source UV set.

If the destination UV set does not exist then a new UV set will be created and the source UV set will be copied into it. The name of the UV set will be that provided with a number appended to the end to ensure uniqueness.

The final name of the destination UV set will be returned.

This method is only valid for functionsets which are attached to mesh nodes, not mesh data.

toName string Name of destination UV set.
modifier MDGModifier If provided then the copy operation will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
create(vertices, polygonCounts, polygonConnects, uValues=None, vValues=None, parent=kNullObj) vertices sequence of MPoints or MFloatPoints. Positions of the mesh's unique vertices. Shared vertices should only appear once. For example, a cube has 6 faces of 4 vertices each, but each vertex is shared by three faces, so there would only be 8 unique vertices in the mesh. MObject Creates a new polygonal mesh and sets this function set to operate on it. This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.

If UV values are supplied both parameters must be given and they must contain the same number of values, otherwise IndexError will be raised. Note that the UVs are simply stored in the mesh, not assigned to any vertices. To assign them use assignUVs().

If the parent is a kMeshData wrapper (e.g. from MFnMeshData.create() ) then a mesh data object will be created and returned and the wrapper will be set to reference it.

If the parent is a transform type node then a mesh node will be created and parented beneath it and the return value will be the mesh node.

If the parent is any other type of node a TypeError will be raised.

If no parent is provided then a transform node will be created and returned and a mesh node will be created and parented under the transform.

polygonCounts sequence of ints One element per polygon in the mesh, giving the number of vertices in the polygon. So if the mesh consists of a triangle and a rectangle then the counts would be [3, 4].
polygonConnects sequence of ints Indices into the sequence of vertices, mapping them onto the individual polygons. This sequence is partitioned according to the polygonCounts. So if the counts were [3, 4] then the first 3 elements of polygonConnects would be the indices for the first polygon's vertices and the next 4 elements would be the indices for the second polygon's vertices.
uValues sequence of floats U values for the mesh's unique UVs. If this parameter is provided then vValues must be provided as well and must contain the same number of elements.
vValues sequence of floats V values for the mesh's unique UVs. If this parameter is provided then uValues must be provided as well and must contain the same number of elements.
parent MObject Parent of the new mesh.
createBlindDataType(blindDataId, attrs) blindDataId int Blind data type ID. Reference to self. Create a new blind data type with the specified attributes.

Each element of the attrs sequence is a tuple containing the long name, short name and type name of the attribute. Valid type names are "int", "float", "double", "boolean", "string" or "binary".

Raises RuntimeError if the blind data id is already in use or an invalid format was specified.

attrs sequence of tuples containing (longName, shortName, typeName) Attribute definitions.
createColorSet(name, clamped, rep=kRGBA, modifier=None, instances=None) name string Proposed name for set. string Creates a new, empty color set for this mesh.

If no name is provided "colorSet#" will be used, where # is a number that makes the name unique for this mesh. If a name is provided but it conflicts with that of an existing color set then a number will be appended to the proposed name to make it unique.

The return value is the final name used for the new color set.

This method will only work when the functionset is attached to a mesh node, not mesh data.

clamped bool If True then each color channel is limited to the range 0.0 to 1.0, otherwise there is no limit.
rep Color Representation constant Specifies the color channels supported by the color set.
modifier MDGModifier If provided then the create operation will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
instances sequence of ints Instance numbers for the instances of the mesh to which the color set will apply. If this parameter is not provided then the color set will apply to all instances of the mesh.
createInPlace(vertices, polygonCounts, polygonConnects) vertices sequence of MPoints or MFloatPoints. Positions of the mesh's unique vertices. Shared vertices should only appear once. For example, a cube has 6 faces of 4 vertices each, but each vertex is shared by three faces, so there would only be 8 unique vertices in the mesh. Reference to self Replaces the existing polygonal mesh with a new one. This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.
polygonCounts sequence of ints One element per polygon in the mesh, giving the number of vertices in the polygon. So if the mesh consists of a triangle and a rectangle then the counts would be [3, 4].
polygonConnects sequence of ints Indices into the sequence of vertices, mapping them onto the individual polygons. This sequence is partitioned according to the polygonCounts. So if the counts were [3, 4] then the first 3 elements of polygonConnects would be the indices for the first polygon's vertices and the next 4 elements would be the indices for the second polygon's vertices.
createUVSet(name, modifier=None, instances=None) name
string Proposed name of the uv set. string Creates a new, empty UV set for this mesh.

If a UV set with proposed name already exists then a number will be appended to the proposed name to name it unique.

If the proposed name is empty then a name of the form uvSet# will be used where '#' is a number chosen to ensure that the name is unique.

The name used for the UV set will be returned.

This method is only valid for functionsets which are attached to mesh nodes, not mesh data.

modifier MDGModifier If provided then the create operation will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
instances sequence of ints Instance numbers for the instances of the mesh to which the UV set will apply. If this parameter is not provided then the UV set will apply to all instances of the mesh.
currentColorSetName(instance=kInstanceUnspecified) instance int Instance of the mesh to change. string Get the name of the "current" color set. The current color set is the one used for color operations when no color set is explicitly specified.

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

If there is no current color set, then an empty string will be returned.

currentUVSetName(instance=kInstanceUnspecified) instance int Instance of the mesh to change. string Get the name of the "current" uv set. The current uv set is the one 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 an empty string will be returned.

deleteColorSet(colorSet, modifier=None, currentSelection=None) colorSet string Name of the color set to delete. Reference to self Deletes a color set from the mesh.

This method is only valid for functionsets which are attached to mesh nodes, not mesh data.

modifier MDGModifier If provided then the deletion will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
currentSelection MSelectionList This method may change the selection list. To aid in supporting undo, if this parameter is supplied it will be set to the active selection prior to the change.
deleteEdge(edgeId, modifier=None) edgeId int Edge to delete. Reference to self Deletes the specified edge.
modifier MDGModifier If specified, the deletion will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
deleteFace(faceId, modifier=None) faceId int Face to delete. Reference to self Deletes the specified face.
modifier MDGModifier If specified, the deletion will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
deleteUVSet(uvSet, modifier=None, currentSelection=None) uvSet string Name of the uv set to delete. Reference to self Deletes a named uv set from the mesh.

This method is only valid for functionsets which are attached to mesh nodes, not mesh data.

modifier MDGModifier If provided then the deletion will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
currentSelection MSelectionList This method may change the selection list. To aid in supporting undo, if this parameter is supplied it will be set to the active selection prior to the change.
deleteVertex(vertexId, modifier=None) vertexId int Vertex to delete. Reference to self Deletes the specified vertex.
modifier MDGModifier If specified, the deletion will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
duplicateFaces(faces, translation=None) faces sequence of ints IDs of faces to be duplicated. Reference to self 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.
translation MFloatVector World-space translation vector to apply to the duplicated elements.
extractFaces(faces, translation=None) faces sequence of ints IDs of faces to be extracted. Reference to self Detaches a set of faces from the rest of the mesh. The resulting mesh will contain one more independant piece of geometry.
translation MFloatVector World-space translation vector to apply to the extracted elements.
extrudeEdges(edges, extrusionCount=1, translation=None, extrudeTogether=True) edges sequence of ints IDs of edges to be extruded. Reference to self Extrude the given edges along a vector. The resulting mesh will have extra parallelograms coming out of the given edges and going to the new extruded edges. The length of the new polygon is determined by the length of the vector. The extrusionCount parameter 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.
extrusionCount int Number of subsequent extrusions to do.
translation MFloatVector World-space translation vector which determines the direction of the extrusion and the length of the created polygon(s).
extrudeTogether bool Sets whether the components should be extruded individually or together, as if one complex component was being extruded.
extrudeFaces(faces, extrusionCount=1, translation=None, extrudeTogether=True) faces sequence of ints IDs of faces to be extruded. Reference to self Extrude the given faces along a vector. The resulting mesh will have extra parallelograms coming out of the given faces and going to the new extruded faces. The length of the new polygon is determined by the length of the vector. The extrusionCount parameter is the number of subsequent extrusions per faces and represents the number of polygons that will be created from each given face to the extruded faces.
extrusionCount int Number of subsequent extrusions to do.
translation MFloatVector World-space translation vector which determines the direction of the extrusion and the length of the created polygon(s).
extrudeTogether bool Sets whether the components should be extruded individually or together, as if one complex component was being extruded.
freeCachedIntersectionAccelerator()       Reference to self 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() methods 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.
generateSmoothMesh(parent=kNullObj, options=None) parent MObject Parent of the new mesh. MObject Creates a new polygonal mesh which is a smoothed version of the one to which the functionset is attached. If an options object is supplied it will be used to direct the smoothing operation, otherwise the mesh's Smooth Mesh Preview attributes will be used.

If the parent is a kMeshData wrapper (e.g. from MFnMeshData.create() ) then a mesh data object will be created and returned.

If the parent is a transform type node then a mesh node will be created and parented beneath it and the return value will be the mesh node.

If the parent is any other type of node a TypeError will be raised.

If no parent is provided then a transform node will be created and returned and a mesh node will be created and parented under the transform.

Note that, unlike the create functions, this function does not set the functionset to operate on the new mesh, but leaves it attached to the original mesh.

options MMeshSmoothOptions Options to use when generating the smoothed mesh.
getAssignedUVs(uvSet='') uvSet string UV set to use. If not specified then the mesh's current UV set will be used. (MIntArray, MIntArray) Returns a tuple containing all of the UV assignments for the specified UV set. The first element of the tuple is an array of counts giving the number of UVs assigned to each face of the mesh. The count will either be zero, indicating that that face's vertices do not have UVs assigned, or else it will equal the number of the face's vertices. The second element of the tuple is an array of UV IDs for all of the face-vertices which have UVs assigned.
getAssociatedColorSetInstances(colorSet) colorSet string Color set name. MIntArray Returns the instance numbers associated with the specified Color set. If the color map is shared across all instances, an empty array will be returned.

This method will only work if the functionset is attached to a mesh node. It will raise RuntimeError if the functionset is attached to mesh data.

getAssociatedUVSetInstances(uvSet) uvSet string UV set name. MIntArray Returns the instance numbers associated with the specified UV set. If the uv map is shared across all instances, an empty array will be returned.

This method will only work if the functionset is attached to a mesh node. It will raise RuntimeError if the functionset is attached to mesh data.

getAssociatedUVSetTextures(uvSet) uvSet string UV set name. MObjectArray Returns the texture nodes which are using the specified UV set. If the texture has a 2d texture placement, the texture, and not the placement will be returned.

This method will only work if the functionset is attached to a mesh node. It will raise RuntimeError if the functionset is attached to mesh data.

getBinaryBlindData(compId, compType, blindDataId, attr) compId int ID of mesh component. string Returns the value of the specified blind data attribute from the specified mesh component. Raises RuntimeError if the attribute is not of "binary" type.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
getBinaryBlindData(compType, blindDataId, attr) compType MFn Type constant Mesh component type. (MIntArray, [string, string, ...]) Returns a tuple containing an array of component IDs and an array of values for the specified blind data attribute for all of the mesh's components of the specified type. Raises RuntimeError if the attribute is not of "binary" type.
blindDataId int Blind data type ID.
attr string Attribute name.
getBinormals(space=MSpace.kObject, uvSet='') space MSpace constant Coordinate space to use. MFloatVectorArray Returns the binormal vectors for all face vertices.

This method is not threadsafe.

uvSet string UV set to use. If not specified then the mesh's current UV set will be used.
getBlindDataAttrNames(blindDataId) blindDataId int Blind data type ID. ((longName, shortName, typeName), ...) Returns a tuple listing the attributes of the given blind data type. Each element of the tuple is itself a tuple containing the long name, short name and type name of the attribute. Type names can be "int", "float", "double", "boolean", "string" or "binary"
getBlindDataTypes(compType) compType MFn Type constant Component type. MIntArray Returns all the blind data ID's associated with the given component type on this mesh.
getBoolBlindData(compId, compType, blindDataId, attr) compId int ID of mesh component. bool Returns the value of the specified blind data attribute from the specified mesh component. Raises RuntimeError if the attribute is not of "bool" type.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
getBoolBlindData(compType, blindDataId, attr) compType MFn Type constant Mesh component type. (MIntArray, MIntArray) Returns a tuple containing an array of component IDs and an array of values for the specified blind data attribute for all of the mesh's components of the specified type. Raises RuntimeError if the attribute is not of "bool" type.
blindDataId int Blind data type ID.
attr string Attribute name.
getClosestNormal(point, space=MSpace.kObject) point MPoint Point to be compared. (MVector, int) Returns a tuple containing the normal at the closest point on the mesh to the given point and the ID of the face in which that closest point lies.
space MSpace constant Coordinate space to use.
getClosestPoint(point, space=MSpace.kObject) point MPoint Point to be compared. (MPoint, int) Returns a tuple containing the closest point on the mesh to the given point and the ID of the face in which that closest point lies.

This method is not threadsafe.

space MSpace constant Coordinate space to use.
getClosestPointAndNormal(point, space=MSpace.kObject) point MPoint Point to be compared. (MPoint, MVector,int) Returns a tuple containing the closest point on the mesh to the given point, the normal at that point, and the ID of the face in which that point lies.

This method is not threadsafe.

space MSpace constant Coordinate space to use.
getColor(colorId, colorSet='') colorId int Index of colorSet entry to retrieve. MColor Returns a color from a colorSet. Raises IndexError if the colorId is out of range.
colorSet string Name of color set.
getColorIndex(faceId, localVertexIndex, colorSet='') faceId int ID of face. int Returns the index into the specified colorSet of the color used by a specific face-vertex. This can be used to index into the sequence returned by getColors().
localVertexIndex int Face-relative/local vertex index.
colorSet string Name of color set.
getColorRepresentation(colorSet) colorSet string Name of color set. Color Representation constant Returns the Color Representation used by the specified color set.
getColors(colorSet='') colorSet string Name of color set. MColorArray Returns all of the colors in a colorSet. If no colorSet is specified then the default colorSet is used.

Use the index returned by getColorIndex() to access the returned array.

getColorSetFamilyNames()       tuple of strings Returns the names of all of the color set families on this object. A color set family is a set of per-instance sets with the same name with each individual set applying to one or more instances. A set which is shared across all instances will be the sole member of its family.

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

getColorSetNames()       tuple of strings Returns the names of all the color sets on this object.
getColorSetsInFamily(familyName) familyName string Name of a Color set family. tuple of strings Returns the names of all of the color sets that belong to the specified 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.
getConnectedSetsAndMembers(instance, renderableSetsOnly) instance int Instance of the mesh to query. (MObjectArray, MObjectArray) Returns a tuple containing an array of sets and an array of the components of the mesh which are in those sets. If a component has no elements in it that means that the entire mesh is in the set.

This method will only work if the functionset is attached to a mesh node. It will raise RuntimeError if the functionset is attached to mesh data.

renderableSetsOnly bool If True only renderable sets will be returned.
getConnectedShaders(instance) instance int Instance of the mesh to query. (MObjectArray, MIntArray) Returns a tuple containing an array of shaders (sets) and an array of ints mapping the mesh's polygons onto those shaders. For each polygon in the mesh there will be corresponding value in the second array. If it is -1 that means that the polygon is not assigned to a shader, otherwise it indicates the index into the first array of the shader to which that polygon is assigned.

This method will only work if the functionset is attached to a mesh node. It will raise RuntimeError if the functionset is attached to mesh data.

getCreaseEdges()       (MUintArray, MDoubleArray) Returns a tuple containing two arrays. The first contains the mesh-relative/global IDs of the mesh's creased edges and the second contains the associated crease data.

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

getCreaseVertices()       (MUintArray, MDoubleArray) Returns a tuple containing two arrays. The first contains the mesh-relative/global IDs of the mesh's creased vertices and the second contains the associated crease data.

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

getDoubleBlindData(compId, compType, blindDataId, attr) compId int ID of mesh component. float Returns the value of the specified blind data attribute from the specified mesh component. Raises RuntimeError if the attribute is not of "double" type.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
getDoubleBlindData(compType, blindDataId, attr) compType MFn Type constant Mesh component type. (MIntArray, MDoubleArray) Returns a tuple containing an array of component IDs and an array of values for the specified blind data attribute for all of the mesh's components of the specified type. Raises RuntimeError if the attribute is not of "double" type.
blindDataId int Blind data type ID.
attr string Attribute name.
getEdgeVertices(edgeId) edgeId int Mesh-relative/global ID of edge. (int, int) Returns a tuple containing the mesh-relative/global IDs of the edge's two vertices. The indices can be used to refer to the elements in the array returned by the getPoints() method.
getFaceAndVertexIndices(faceVertexIndex, localVertex=True) faceVertexIndex int ID of face-vertex. (faceId, vertexIndex) Returns a tuple containg the faceId and vertexIndex represented by the given face-vertex index. This is the reverse of the operation performed by getFaceVertexIndex().

If localVertex is True then the returned vertexIndex is the face-relative/local index, otherwise it is the mesh-relative/global index.

localVertex bool Determines if returned vertexIndex be face-relative/local or mesh-relative/global.
getFaceNormalIds(faceId) faceId int ID of the face. MIntArray Returns the IDs of the normals for all the vertices of a given face. These IDs can be used to index into the arrays returned by getNormals().
getFaceUVSetNames(faceId) faceId int ID of face. tuple of strings Returns the names of all of the uv sets mapped to the specified face.

This method is not threadsafe.

getFaceVertexBinormal(faceId, vertexId, space=MSpace.kObject, uvSet='') faceId int ID of face. MVector Returns the binormal vector at a given face vertex.

This method is not threadsafe.

vertexId int Mesh-relative/global ID of vertex.
space MSpace constant Coordinate space to use.
uvSet string UV set to use. If not specified then the mesh's current UV set will be used.
getFaceVertexBinormals(faceId, space=MSpace.kObject, uvSet='') faceId int ID of face. MFloatVectorArray Returns all the per-vertex-per-face binormals for a given face.

This method is not threadsafe.

space MSpace constant Coordinate space to use.
uvSet string UV set to use. If not specified then the mesh's current UV set will be used.
getFaceVertexColors(colorSet='', defaultUnsetColor=None) colorSet string Name of color set. MColorArray Returns colors for all the mesh's face-vertices.

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

If no face has color for that vertex, the entry returned will be defaultUnsetColor. 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 return (0,0,0). If a vertex has shared color, the same value will be set for all its vertes/faces.

If the colorSet is not specified, the default color set will be used. If the defaultUnsetColor is not given, then (-1, -1, -1, -1) will be used.

defaultUnsetColor MColor Color to return for vertices which have no color set.
getFaceVertexIndex(faceId, vertexIndex, localVertex=True) faceId int ID of face. int Returns the index for a specific face-vertex into an array of face-vertex values, such as those returned by getFaceVertexBinormals(), getFaceVertexColors(), getFaceVertexNormals(), etc.

The values in the target arrays are presumed to be in face order: e.g. F0V0, F0V1.. F0Vn, F1V0, etc...

If localVertex is True then vertexIndex must be a face-relative/local index. If localVertex is False then vertexIndex must be a mesh-relative/global index.

The opposite operation is performed by the getFaceAndVertexIndices() method.

vertexIndex int Vertex index. Face-relative/local or mesh-relative/global, depending on localVertex.
localVertex bool Determines whether the vertexIndex is face-relative/local or mesh-relative/global.
getFaceVertexNormal(faceId, vertexId, space=MSpace.kObject) faceId int ID of the face of interest. MVector Returns the per-vertex-per-face normal for a given face and vertex.

This method is not threadsafe.

vertexId int Mesh-relative/global vertex ID.
space MSpace constant Coordinate space to use.
getFaceVertexNormals(faceId, space=MSpace.kObject) faceId int ID of the face of interest. MFloatVectorArray Returns the normals for a given face.

This method is not threadsafe.

space MSpace constant Coordinate space to use.
getFaceVertexTangent(faceId, vertexId, space=MSpace.kObject, uvSet='') faceId int ID of face. MVector Return the normalized tangent vector at a given face vertex.

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

This method is not threadsafe.

vertexId int Mesh-relative/global ID of vertex.
space MSpace constant Coordinate space to use.
uvSet string UV set to use. If not specified then the mesh's current UV set will be used.
getFaceVertexTangents(faceId, space=MSpace.kObject, uvSet='') faceId int ID of face. MFloatVectorArray Returns all the per-vertex-per-face tangents for a given face.

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

This method is not threadsafe.

space MSpace constant Coordinate space to use.
uvSet string UV set to use. If not specified then the mesh's current UV set will be used.
getFloatBlindData(compId, compType, blindDataId, attr) compId int ID of mesh component. float Returns the value of the specified blind data attribute from the specified mesh component. Raises RuntimeError if the attribute is not of "float" type.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
getFloatBlindData(compType, blindDataId, attr) compType MFn Type constant Mesh component type. (MIntArray, MFloatArray) Returns a tuple containing an array of component IDs and an array of values for the specified blind data attribute for all of the mesh's components of the specified type. Raises RuntimeError if the attribute is not of "float" type.
blindDataId int Blind data type ID.
attr string Attribute name.
getHoles()       ((face, (v1, v2, ...)), (face, (v1, v2, ...)), ...) Returns a tuple describing the holes in the mesh. Each element of the tuple is itself a tuple. The first element of the sub-tuple is the integer ID of the face in which the hole occurs. The second element of the sub-tuple is another tuple containing the mesh-relative/global IDs of the vertices which make up the hole.

Take the following return value as an example:

((3, (7, 2, 6)), (5, (11, 10, 3, 4)))

This says that the mesh has two holes. The first hole is in face 3 and consists of vertices 7, 2 and 6. The second hole is in face 5 and consists of vertices 11, 10, 3 and 4.

getIntBlindData(compId, compType, blindDataId, attr) compId int ID of mesh component. int Returns the value of the specified blind data attribute from the specified mesh component. Raises RuntimeError if the attribute is not of "int" type.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
getIntBlindData(compType, blindDataId, attr) compType MFn Type constant Mesh component type. (MIntArray, MIntArray) Returns a tuple containing an array of component IDs and an array of values for the specified blind data attribute for all of the mesh's components of the specified type. Raises RuntimeError if the attribute is not of "int" type.
blindDataId int Blind data type ID.
attr string Attribute name.
getInvisibleFaces()       MUintArray Returns the invisible faces of the mesh. Invisible faces are like lightweight holes in that they are not rendered but do not require additional geometry the way that holes do. They have the advantage over holes that if the mesh is smoothed then their edges will be smoothed as well, while holes will retain their hard edges.

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

getNormalIds()       (MIntArray, MIntArray) Returns the normal IDs for all of the mesh's polygons as a tuple of two int arrays. The first array contains the number of vertices for each polygon and the second contains the normal IDs for each polygon-vertex. These IDs can be used to index into the array returned by getNormals().
getNormals(space=MSpace.kObject) space MSpace constant Coordinate system to use. MFloatVectorArray Returns a copy of the mesh's normals. The normals are the per-polygon per-vertex normals. To find the normal for a particular vertex-face, use getFaceNormalIds() to get the index into the array.

This method is not threadsafe.

getPoint(vertexId, space=MSpace.kObject) vertexId int Mesh-relative/global index of the vertex to be changed. MPoint Returns the position of specified vertex.
space MSpace constant Coordinate system in which the point is to be returned.
getPointAtUV(faceId, u, v, space=MSpace.kObject, uvSet='', tolerance=0.0) faceId int ID of face in which to find the point. MPoint Returns the position of the point at the give UV value in the specified face.

This method is not threadsafe.

u float U component of UV.
v float V component of UV.
space MSpace constant Coordinate system in which the point is to be returned.
uvSet string Name of UV set to use. If not provided, the current UV set will be used.
tolerance float Tolerance value.
getPoints(space=MSpace.kObject) space MSpace constant Coordinate system to use. MPointArray Returns a copy of the mesh's vertex positions as an MPointArray.
getPolygonNormal(polygonId, space=MSpace.kObject) polygonId int ID of polygon to get normal from. MVector Returns the per-polygon normal for the given polygon.

This method is not threadsafe.

space MSpace constant Coordinate system to use.
getPolygonTriangleVertices(polygonId, triangleId) polygonId int ID of the polygon. (int, int, int) Returns the mesh-relative/global IDs of the 3 vertices of the specified triangle of the specified polygon. These IDs can be used to index into the arrays returned by getPoints() and getFloatPoints().
triangleId int Face-relative ID of the triangle.
getPolygonUV(polygonId, vertexId, uvSet='') polygonId int ID of the polygon. (float, float) Returns a tuple containing the U and V values at a specified vertex of a specified polygon.

This method is not threadsafe.

vertexId int Face-relative/local index of the vertex.
uvSet string Name of UV set to use. If not provided, the current UV set will be used.
getPolygonUVid(polygonId, vertexId, uvSet='') polygonId int ID of the polygon. int Returns the ID of the UV at a specified vertex of a specified polygon.

This method is not threadsafe.

vertexId int Face-relative/local index of the vertex.
uvSet string Name of UV set to use. If not provided, the current UV set will be used.
getPolygonVertices(polygonId) polygonId int ID of the polygon. MIntArray Returns the mesh-relative/global vertex IDs the specified polygon. These IDs can be used to index into the arrays returned by getPoints() and getFloatPoints().
getSmoothMeshDisplayOptions()       MMeshSmoothOptions Returns the options currently in use when smoothing the mesh for display.
getStringBlindData(compId, compType, blindDataId, attr) compId int ID of mesh component. string Returns the value of the specified blind data attribute from the specified mesh component. Raises RuntimeError if the attribute is not of "string" type.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
getStringBlindData(compType, blindDataId, attr) compType MFn Type constant Mesh component type. (MIntArray, [string, string, ...]) Returns a tuple containing an array of component IDs and an array of values for the specified blind data attribute for all of the mesh's components of the specified type. Raises RuntimeError if the attribute is not of "string" type.
blindDataId int Blind data type ID.
attr string Attribute name.
getTangentId(faceId, vertexId) faceId int ID of the face of interest. int Returns the ID of the tangent for a given face and vertex.
vertexId int Mesh-relative/global vertex ID.
getTangents(space=MSpace.kObject, uvSet='') space MSpace constant Coordinate space to use. MFloatVectorArray Return the tangent vectors for all face vertices. The tangent is defined as the surface tangent of the polygon running in the U direction defined by the uv map.

This method is not threadsafe.

uvSet string UV set to use. If not specified then the mesh's current UV set will be used.
getTriangles()       (MIntArray, MIntArray) Returns a tuple describing the mesh's triangulation. The first element of the tuple is an array giving the number of triangles for each of the mesh's polygons. The second tuple gives the ids of the vertices of all the triangles.
getUV(uvId, uvSet='') uvId int Index of the UV to be returned. (float, float) Returns a tuple containing the u and v values of the specified UV.
uvSet string Name of UV set to use. If not provided, the current UV set will be used.
getUVAtPoint(point, space=MSpace.kObject, uvSet='') point MPoint Point for which to retrieve UV. (float, float, int) Returns a tuple containing the u and v coordinates of the point on the mesh closest to the given point, and the ID of the face containing that closest point.

This method is not threadsafe.

space MSpace constant Coordinate system to use.
uvSet string Name of UV set to use. If not provided, the current UV set will be used.
getUVs(uvSet='') uvSet string Name of UV set to use. If not provided, the current UV set will be used. (MFloatArray, MFloatArray) Returns a tuple containing an array of U values and an array of V values, representing all of the UVs for the given UV set.
getUVSetFamilyNames()       tuple of strings Returns 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, getUVSetsInFamily() may be used to determine the names of the associated individual sets.

getUVSetNames()       tuple of strings Returns the names of all the uv sets on this object.
getUVSetsInFamily(familyName) familyName string Name of a UV set family. tuple of strings Returns the names of all of the uv sets that belong to the specified 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.
getUvShellsIds(uvSet='') uvSet string UV set to use. If not specified then the mesh's current UV set will be used. (int, MIntArray) Returns a tuple containing describing how the specified UV set's UVs are grouped into shells. The first element of the tuple is the number of distinct shells. The second element of the tuple is an array of shell indices, one per uv, indicating which shell that uv is part of.
getVertexColors(colorSet='', defaultUnsetColor=None) colorSet string Name of color set. MColorArray Gets colors for all vertices of the given colorSet. If no face has color for that vertex, the entry returned will be defaultUnsetColor. If a color was set for some or all the faces for that vertex, an average of those vertex/face values where the color has been set will be returned.

If the colorSet is not specified, the default color set will be used. If the defaultUnsetColor is not given, then (-1, -1, -1, -1) will be used.

defaultUnsetColor MColorArray Color to return for vertices which have no color set.
getVertexNormal(vertexId, angleWeighted, space=MSpace.kObject) vertexId int Mesh-relative/global ID of vertex to set normal for. MVector Returns the normal at the given vertex.

The returned normal is a single per-vertex normal, so unshared normals at a vertex will be averaged.

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

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

This method is not threadsafe.

angleWeighted bool Should the angle of the face at the vertex affect the normal calculation?
space MSpace constant Coordinate system to use.
getVertexNormals(angleWeighted, space=MSpace.kObject) angleWeighted bool Should the angle of the face at the vertex affect the normal calculation? MFloatVectorArray Returns all the vertex normals.

The returned normals are per-vertex normals, so unshared normals at a vertex will be averaged.

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

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

This method is not threadsafe.

space MSpace constant Coordinate system to use.
getVertices()       (MIntArray, MIntArray) Returns the mesh-relative/global vertex IDs for all of the mesh's polygons as a tuple of two int arrays. The first array contains the number of vertices for each polygon and the second contains the mesh-relative IDs for each polygon-vertex. These IDs can be used to index into the arrays returned by getPoints() and getFloatPoints().
hasAlphaChannels(colorSet) colorSet string Name of color set. bool Returns True if the color set has an alpha channel.
hasBlindData(compType, compId=None, blindDataId=None) compId int Component ID. bool Returns true if any component of the given type on this mesh has blind data. If a component ID is provided then only that particular component is checked. If a blind data ID is provided then only blind data of that type is checked.
compType MFn Type constant Component type.
blindDataId int Optional blind data type ID.
hasColorChannels(colorSet) colorSet string Name of color set. bool Returns True if the color set has RGB channels.
isBlindDataTypeUsed(blindDataId) blindDataId int Blind data type ID. bool Returns True if the blind data type is already in use anywhere in the scene.
isColorClamped(colorSet) colorSet string Name of color set. bool Returns True if the color sets RGBA components are clamped to the range 0 to 1.
isColorSetPerInstance(colorSet) name string Name of a color set or color set family. bool Returns True if the color set is per-instance, and False if it is shared across all instances.
isEdgeSmooth(edgeId) edgeId int Edge to check. bool Returns True if the edge is smooth, False if it is hard.
isNormalLocked(normalId) normalId int Normal to check. bool Returns True if the normal is locked, False otherwise.
isPolygonConvex(faceId) faceId int Polygon to check. bool Returns True if the polygon is convex, False if it is concave.
isUVSetPerInstance(uvSet) name string Name of a UV set or UV set family. bool Returns True if the UV set is per-instance, and False if it is shared across all instances.
lockFaceVertexNormals(faceIds, vertexIds) faceIds sequence of ints IDs of faces. Reference to self Locks the normals for the given face/vertex pairs.
vertexIds sequence of ints Mesh-relative/global IDs of vertices.
lockVertexNormals(vertexIds) vertexIdx sequence of ints Mesh-relative/global indices of vertices. Reference to self Locks the shared normals for the specified vertices.
numColors(colorSet='') colorSet string Name of color set. int Returns the number of colors in the given color set. If no color set is specified then the mesh's current color set will be used.
numUVs(uvSet='') uvSet string Name of UV set. int Returns the number of UVs (texture coordinates) in the given UV set. If no UV set is specified then the mesh's current UV set will be used.
onBoundary(faceId) faceId int ID of face. bool Returns true if the face is on the border of the mesh, meaning that one or more of its edges is a border edge.
polygonVertexCount(faceId) faceId int ID of the polygon int Returns the number of vertices in the given polygon. Raises ValueError if the polygon ID is invalid.
removeFaceColors(faceIds) faceIds sequence of ints IDs of faces. Reference to self Removes colors from all vertices of the specified faces.
removeFaceVertexColors(faceIds, vertexIds) faceIds sequence of ints IDs of faces. Reference to self Removes colors from the specified face/vertex pairs.
vertexIds sequence of ints Mesh-relative/global IDs of vertices.
removeVertexColors(vertexIds) vertexIds sequence of ints Mesh-relative/global IDs of vertices. Reference to self Removes colors from the specified vertices in all of the faces which share those vertices.
renameUVSet(origName, newName, modifier=None) origName string Original name of UV set. Reference to self Renames a UV set. The set must exist and the new name cannot be the same as that of an existing set.

This method is only valid for functionsets which are attached to mesh nodes, not mesh data.

newName string New name of UV set.
modifier MDGModifier If provided then the rename operation will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
setBinaryBlindData(compId, compType, blindDataId, attr, data) compId int Mesh component ID. Reference to self Sets the value of a "binary" blind data attribute on a component of the mesh.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data string Data to set.
setBinaryBlindData(compIds, compType, blindDataId, attr, data) compIds sequence of ints Mesh component ID. Reference to self Sets the value of a "binary" blind data attribute on multiple components of the mesh. If the data is a sequence of strings then it must provide a value for each component in compIds. If it is a single string then all of the specified components will have their blind data set to that value.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data string or sequence of strings Data to set.
setBoolBlindData(compId, compType, blindDataId, attr, data) compId int Mesh component ID. Reference to self Sets the value of a "boolean" blind data attribute on a component of the mesh.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data bool or int Data to set.
setBoolBlindData(compIds, compType, blindDataId, attr, data) compIds sequence of ints Mesh component ID. Reference to self Sets the value of a "boolean" blind data attribute on multiple components of the mesh. If the data is a sequence then it must provide a value for each component in compIds. If it is a single value then all of the specified components will have their blind data set to that value.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data bool or int, or sequence of bools or ints Data to set.
setColor(colorId, color, colorSet='', rep=kRGBA) colors sequence of MColor's Colors to set. Reference to self Sets a color in the specified colorSet. If no colorSet is given the current colorSet will be used. If the colorId is greater than or equal to numColors() then the colorSet will be grown to accommodate the specified color.
color MColor Color to set.
colorSet string Name of color set.
rep Color Representation constant Specifies the color channels to set.
setColors(colors, colorSet='', rep=kRGBA) colors sequence of MColor's Colors to set. Reference to self Sets all the colors of the specified colorSet. If no colorSet is given the current colorSet will be used. After using this method to set the color values, you can call assignColors() to assign the corresponding color ids to the geometry.

The color sequence 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 sequence is larger than the color set size, then the color set for this mesh will be expanded to accommodate the new color values.

In order to shrink the colorSet you have to clear its existing colors. E.g:

  • clearColors()
  • setColors( ... )
  • assignColors()
colorSet string Name of color set.
rep Color Representation constant Specifies the color channels to set.
setCreaseEdges(edgeIds, creaseData) edgeIds sequence of ints Mesh-relative/global IDs of crease edges. Reference to self 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).

creaseData sequence of floats Data related to the crease edges.
setCreaseVertices(vertexIds, creaseData) vertexIds sequence of ints Mesh-relative/global IDs of crease vertices. Reference to self 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).

creaseData sequence of floats Data related to the crease vertices.
setCurrentColorSetName(colorSet, modifier=None, currentSelection=None) colorSet string Name of the color set. Reference to self Sets the "current" color set for this object. The current color set is the one used when no color set name is specified for a color operation. If the specified color set does not exist then the current color set will not be changed.

This method is only valid for functionsets which are attached to mesh nodes, not mesh data.

modifier MDGModifier If provided then the deletion will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
currentSelection MSelectionList This method may change the selection list. To aid in supporting undo, if this parameter is supplied it will be set to the active selection prior to the change.
setCurrentUVSetName(uvSet, modifier=None, currentSelection=None) uvSet string Name of the uv set. Reference to self Sets the "current" uv set for this object. The current uv set is the one used when no uv set name is specified for a uv set operation. If the specified uv set does not exist then the current uv set will not be changed.

This method is only valid for functionsets which are attached to mesh nodes, not mesh data.

modifier MDGModifier If provided then the deletion will be added to the modifier and won't take effect until the modifier's doIt() is called. Otherwise it will take effect immediately.
currentSelection MSelectionList This method may change the selection list. To aid in supporting undo, if this parameter is supplied it will be set to the active selection prior to the change.
setDoubleBlindData(compId, compType, blindDataId, attr, data) compId int Mesh component ID. Reference to self Sets the value of a "double" blind data attribute on a component of the mesh.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data float Data to set.
setDoubleBlindData(compIds, compType, blindDataId, attr, data) compIds sequence of ints Mesh component ID. Reference to self Sets the value of a "double" blind data attribute on multiple components of the mesh. If the data is a sequence then it must provide a value for each component in compIds. If it is a single value then all of the specified components will have their blind data set to that value.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data float or sequence of floats Data to set.
setEdgeSmoothing(edgeId, smooth=True) edgeId int Mesh-relative/global ID of edge. Reference to self Sets the specified edge to be hard or smooth.

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.

smooth bool If True the edge will be smooth, otherwise it will be hard.
setFaceColor(color, faceId, rep=kRGBA) color MColor Color to set. Reference to self Sets the face-vertex color for all vertices on this face.
faceId int ID of face.
rep Color Representation constant Specifies the color channels to set.
setFaceColors(colors, faceIds, rep=kRGBA) colors sequence of MColor's Colors to set. Reference to self Sets the colors of the specified faces. For each face in the faceIds sequence the corresponding color from the colors sequence will be applied to all of its vertices.
faceIds sequence of ints IDs of faces.
rep Color Representation constant Specifies the color channels to set.
setFaceVertexColor(color, faceId, vertexId, modifier=None, rep=kRGBA) color MColor Color to set. Reference to self Sets a face-specific normal at a vertex.
faceId int ID of face.
vertexId int Mesh-relative/global ID of vertex.
modifier MDGModifier If specified, and the functionset is attached to a mesh node (as opposed to mesh data), then the operation will be added to the modifier and will not take effect until the modifier's doIt() is called. Otherwise, it will take effect immediately.
rep Color Representation constant Specifies the color channels to set.
setFaceVertexColors(colors, faceIds, vertexIds, modifier=None, rep=kRGBA) colors sequence of MColor's Colors to set. Reference to self Sets the colors of the specified face/vertex pairs.
faceIds sequence of ints IDs of faces.
vertexIds sequence of ints Mesh-relative/global IDs of vertices.
modifier MDGModifier If specified, and the functionset is attached to a mesh node (as opposed to mesh data), then the operation will be added to the modifier and will not take effect until the modifier's doIt() is called. Otherwise, it will take effect immediately.
rep Color Representation constant Specifies the color channels to set.
setFaceVertexNormal(normal, faceId, vertexId, space=MSpace.kObject, modifier=None) normal MVector New normal value. Reference to self Sets a face-specific normal at a vertex.
faceId int Face to set normal for.
vertexId int Mesh-relative/global ID of vertex to set normal for.
space MSpace constant Coordinate system in which the normal is specified.
modifier MDGModifier If specified, and the functionset is attached to a mesh node (as opposed to mesh data), an operation will be added to the modifier and the new normal will not be set until the modifier's doIt() is called. Otherwise, the new normal will be set immediately.
setFaceVertexNormals(normals, faceIds, vertexIds, space=MSpace.kObject) normals sequence of MVector's New normal values. Reference to self Sets normals for the given face/vertex pairs.
faceIds sequence of ints IDs of faces to set normal for.
vertexIds sequence of ints Mesh-relative/global IDs of vertices to set normal for.
space MSpace constant Coordinate system in which the normal is specified.
setFloatBlindData(compId, compType, blindDataId, attr, data) compId int Mesh component ID. Reference to self Sets the value of a "float" blind data attribute on a component of the mesh.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data float Data to set.
setFloatBlindData(compIds, compType, blindDataId, attr, data) compIds sequence of ints Mesh component ID. Reference to self Sets the value of a "float" blind data attribute on multiple components of the mesh. If the data is a sequence then it must provide a value for each component in compIds. If it is a single value then all of the specified components will have their blind data set to that value.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data float or sequence of floats Data to set.
setIntBlindData(compId, compType, blindDataId, attr, data) compId int Mesh component ID. Reference to self Sets the value of an "int" blind data attribute on a component of the mesh.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data int Data to set.
setIntBlindData(compIds, compType, blindDataId, attr, data) compIds sequence of ints Mesh component ID. Reference to self Sets the value of an "int" blind data attribute on multiple components of the mesh. If the data is a sequence then it must provide a value for each component in compIds. If it is a single value then all of the specified components will have their blind data set to that value.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data int or sequence of ints Data to set.
setInvisibleFaces(faceIds, makeVisible=False) faceIds sequence of ints IDs of faces. Reference to self Sets the specified faces of the mesh to be visible or invisible. See the getInvisibleFaces() method for a description of invisible faces.
makeVisible bool If True the specified faces will be made visible, otherwise they will be made invisible.
setIsColorClamped(colorSet, clamped) colorSet string Name of color set. Reference to self Sets whether the color set's RGBA components should be clamped to the range 0 to 1.
clamped bool True if the components should be clamped, False if not.
setNormals(normals, space=MSpace.kObject) normals sequence of MFloatVector New normal values. Reference to self Sets the mesh's normals (user normals).
space MSpace constant Coordinate system in which the normals are specified.
setPoint(vertexId, point, space=MSpace.kObject) vertexId int Mesh-relative/global index of the vertex to be changed. Reference to self Sets the position of specified vertex.

Note that if you modify the position of a vertex for a mesh node (as opposed to mesh data), a tweak will be created. If you have a node 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.

point MPoint New position of the vertex.
space MSpace constant Coordinate system in which the point is specified.
setPoints(points, space=MSpace.kObject) points sequence of MPoint or MFloatPoint Vertex positions to set. Reference to self Sets the positions of the mesh's vertices.
space MSpace constant Coordinate system in which the points are specified.
setSmoothMeshDisplayOptions(options) options MMeshSmoothOptions Smoothing options to set. Reference to self Sets the options to use when smoothing the mesh for display.
setSomeColors(colorIds, colors, colorSet='', rep=kRGBA) colorIds sequence of ints IDs of colors to set. Reference to self Sets selected colors in a colorSet.

If the largest colorId in the sequence is larger than numColors() then the colorSet 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.

colors sequence of MColor's Colors to set.
colorSet string Name of color set.
rep Color Representation constant Specifies the color channels to set.
setSomeUVs(uvIds, uValues, vValues, uvSet='') uvIds sequence of ints Indices of the UVs to be set. Reference to self Sets the specified texture coordinates (uv's) for this mesh. The uv value sequences and the uvIds sequence must all 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.

uValues sequence of floats U components of UV values to set.
vValues sequence of floats V components of UV values to set.
uvSet string Name of UV set to use. If not provided then the current UV set will be used.
setStringBlindData(compId, compType, blindDataId, attr, data) compId int Mesh component ID. Reference to self Sets the value of a "string" blind data attribute on a component of the mesh.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data string Data to set.
setStringBlindData(compIds, compType, blindDataId, attr, data) compIds sequence of ints Mesh component ID. Reference to self Sets the value of a "string" blind data attribute on multiple components of the mesh. If the data is a sequence of strings then it must provide a value for each component in compIds. If it is a single string then all of the specified components will have their blind data set to that value.
compType MFn Type constant Mesh component type.
blindDataId int Blind data type ID.
attr string Attribute name.
data string or sequence of strings Data to set.
setUV(uvId, u, v, uvSet='') uvId int Index of UV to element to set. Reference to self 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 the UV being added is new, then you must call one of the assignUV methods in order to update the geometry.

u float New u value to set.
v float New v value to set.
uvSet string Name of UV set to use. If not provided then the current UV set will be used.
setUVs(uValues, vValues, uvSet='') uValues sequence of floats U components of UV values to set. Reference to self Sets all of the texture coordinates (uv's) for this mesh. The uv value sequences 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 sequences 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:

  • clearUVs()
  • setUVs( ... )
  • assignUVs()

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

vValues sequence of floats V components of UV values to set.
uvSet string Name of UV set to use. If not provided then the current UV set will be used.
setVertexColor(color, vertexId, modifier=None, rep=kRGBA) color MColor Color to set. Reference to self Sets the color for a vertex in all the faces which share it.
vertexId int Mesh-relative/global ID of vertex.
modifier MDGModifier If specified, and the functionset is attached to a mesh node (as opposed to mesh data), then the operation will be added to the modifier and will not take effect until the modifier's doIt() is called. Otherwise, it will take effect immediately.
rep Color Representation constant Specifies the color channels to set.
setVertexColors(colors, vertexIds, modifier=None, rep=kRGBA) color sequence of MColor's Colors to set. Reference to self Sets the colors of the specified vertices. For each vertex in the vertexIds sequence, the corresponding color from the colors sequence will be applied to the vertex in all of the faces which share it.
vertexIds sequence of ints Mesh-relative/global IDs of vertices.
modifier MDGModifier If specified, and the functionset is attached to a mesh node (as opposed to mesh data), then the operation will be added to the modifier and will not take effect until the modifier's doIt() is called. Otherwise, it will take effect immediately.
rep Color Representation constant Specifies the color channels to set.
setVertexNormal(normal, vertexId, space=MSpace.kObject, modifier=None) normal MVector New normal value. Reference to self Sets the shared normal at a vertex.
vertexId int Mesh-relative/global ID of vertex to set normal for.
space MSpace constant Coordinate system in which the normal is specified.
modifier MDGModifier If specified, and the functionset is attached to a mesh node (as opposed to mesh data), an operation will be added to the modifier and the new normal will not be set until the modifier's doIt() is called. Otherwise, the new normal will be set immediately.
setVertexNormals(normals, vertexIds, space=MSpace.kObject) normals sequence of MVector's New normal values. Reference to self Sets the shared normals for the given vertices.
vertexIds sequence of ints Mesh-relative/global IDs of vertices to set normals for.
space MSpace constant Coordinate system in which the normal is specified.
sortIntersectionFaceTriIds(faceIds, triIds=none) faceIds MIntArray Face IDs to be sorted. Reference to self Convenience routine for sorting faceIds or face/triangle ids before passing them into the closestIntersection(), allIntersections(), or anyIntersection() methods. When using an acceleration structure with an intersection operation it is essential that any faceId or faceId/triId arrays be sorted properly to ensure optimal performance.
triIds MIntArray
Face-relative triangle IDs to be sorted. If present the array must be the same length as the faceIds array and the two are taken together as (faceId, triId) pairs.
split(placements) placements sequence of tuples Describes how to place each point of the split. Reference to self Each tuple in the placements sequence consists of a Split Placement constant followed by one or two parameters.

If the Split Placement is kOnEdge then the tuple will contain two more elements giving the int id of the edge to split, and a float value between 0 and 1 indicating how far along the edge to do the split. The same edge cannot be split more than once per call.

If the Split Placement is kInternalPoint then the tuple will contain just one more element giving an MFloatPoint within the face.

All splits must begin and end on an edge meaning that the first and last tuples in the placements sequence must be kOnEdge placements.

subdivideEdges(edges, numDivisions) edges sequence of ints IDs of edges to be subdivided. Reference to self Subdivides edges at regular intervals.

For example, if numDivisions is 2 then two equally-spaced vertices will be added to each of the specified edges: one 1/3 of the way along the edge and a second 2/3 of the way along the edge.

numDivisions int Number of times to subdivide each edge.
subdivideFaces(faces, numDivisions) faces sequence of ints IDs of faces to be subdivided. Reference to self Subdivides each specified face into a grid of smaller faces. Triangles are subdivided into a grid of smaller triangles and quads are subdivided into a grid of smaller quads. Faces with more than four edges are ignored.

The numDivisions parameter tells how many times to subdivide each edge of the face. Internal points and edges are introduced as needed to create a grid of smaller faces.

numDivisions int Number of times to subdivide the edges of each face.
syncObject()       Reference to self If a non-api operation happens that many have changed the underlying Maya object attached to this functionset, calling this method will make sure that the functionset picks up those changes. In particular this call should be used after calling mel commands which might affect the mesh. Note that this only applies when the functionset is attached to a mesh node. If it's attached to mesh data the it is not necessary to call this method.
unlockFaceVertexNormals(faceIds, vertexIds) faceIds sequence of ints IDs of faces. Reference to self Unlocks the normals for the given face/vertex pairs.
vertexIds sequence of ints Mesh-relative/global IDs of vertices.
unlockVertexNormals(vertexIds) vertexIdx sequence of ints Mesh-relative/global indices of vertices. Reference to self Unlocks the shared normals for the specified vertices.
updateSurface()       Reference to self Signal that this polygonal mesh has changed and needs to be redrawn.

Object Attributes

Name Type Access Description
Only available in Maya 2012 HotFix 1 or later:
checkSamePointTwice bool RW Controls whether polygons created or added through the functionset are checked for duplicate points.
displayColors bool RW Determines if the mesh's colors are displayed. Attempting to turn color display on when the functionset is attached to mesh data (as opposed to a mesh node) will raise TypeError.
numColorSets int R Number of color sets.
numEdges int R Number of edges.
numFaceVertices int R Total number of vertices. Shared vertices are counted for each face which uses them.
numNormals int R number of per-polygon per-vertex normals
numPolygons int R Number of polygons/faces.
numUVSets int R Number of UV sets.
numVertices int R Number of distinct vertices. Shared vertices are only counted once.

Sequence Support

None.

Number Support

None.

Comparison Support

None.

str() Support

Default.

repr() Support

Default.

© 2011 Autodesk, Inc. All rights reserved.