- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# MFnSubd Class Reference
OpenMaya - API module for common classes | FunctionSet classes

Search for all occurrences

## Detailed Description

Subdivision surface function set.

This function set provides access to subdivision surfaces. Objects of type MFn::kSubdiv, MFn::kSubdivData, and MFn::kSubdivGeom are supported. MFn::kSubdiv objects are shapes in the DAG, MFn::kSubdivGeom objects are the raw geometry that the shapes use, and MFn::kSubdivData objects are the data that is passed through dependency graph connections.

Maya implements fully hierarchical Catmull-Clark quad based subdivision surfaces. You can use them without any hierarchical edits, but their full power is only realized when you do use the hierarchy. Using the hierarchy lets you access additional vertices on the existing faces. For example, a single 4 vertex plane can give you access, through hierarchy, to over 16,000,000 points at the finest level of the hierarchy (please don't try it). Additionally, the points at the finer levels are created only as you need them and only in the areas where you need them, giving you an implied level of detail workflow.

The "base" mesh is sometimes used to describe the coarsest level of the hierarchy. Once we go one level finer (to level "1") all faces are four sided (though not all vertices are of valence 4). At that point, each face can be considered to have 4 "children" faces. Starting with a 4 vertex single face plane, there will be 4 faces (and 9 vertices) at level 1, 16 faces (and 25 vertices) at level 2, etc. You can go as deep as level 12.

Please consult Maya documentation on subdivision surfaces for more details.

Subdivision Surface Construction Subdivision surfaces are created by specifying a base polygonal mesh, hierarchical edits (optional) and creases (optional).

The base mesh contains a vertex list, a list of vertex counts per-polygon, and a list of vertices that make up the polygons. If you are familiar with the creation of polygonal meshes, this is exactly equivalent to that setup. With a small set of limitations, any polygonal object can be converted into a subdivision surface. The current limitations are:

- non manifold geometry The polygons must be manifold; i.e., an edge has at most two incident faces.

- vertex valence A vertex must have valence of at least 3, unless it's a boundary vertex in which case it needs the valence of at least 2.

- polygon vertex count Maximal vertex count in a single polygon is 256.

- total vertex count Maximal vertex count in a base mesh is ~8,000,000 (2^23).

The easiest way to create a subdivision surface is probably to use polyToSubdiv MEL command to create it from a polygon. Alternativelly, the same functionality is available through the API using createFromPolygon method.

Alternatively, you can create a subdivision surface either by converting an existing NURBS surface with createFromNurbsSurface or directly, by specifying vertex lists, vertex connections lists, etc. The last method will look familiar to those that have used MFnMesh::create method to create a polygon.

The following lists are used by the create method to construct a subdivision surface:

- vertex list All of the vertices for the subdivision surface are stored in a master vertex list which is an array indexed from 0 to numVertices()-1. Vertices in this list can be shared among polygons.

- polygon count list This is a list containing the number of vertices for each polygon. Each polygon in the mesh would have an entry in this list containing its number of vertices.

- vertex connection list This is a list of the vertex id's for each polygon. Since polygons can have different numbers of vertices, the polygon count list is used to determine which polygons are represented by the various sections of this list.

Texture Coordinates (UV's) You can optionally specify texture (uv) coordinates. UV coordinates are 2-d coordinates used for mapping textures to the polygons of a surface. Each polygon contains as many UV's as it has vertices. The UV values are not shared and you can think of them as "owned" by a polygon, rather than each vertex in that polygon.

Subdivision Surface Component API Names

In order to successfully use the subdivision surface API, you need to familiarize yourself with the naming convention used for its components within the API.

In the polygon case, we simply number the vertices 0, 1, ... N-1. The faces and the edges and the faces are numbered similarly.

For the subdivision surfaces, this is not the case, mostly because of the hierarchical approach we took. Since it would be prohibitive to instantiate all the faces all the time (think of those 16M that can from just one original face) the names have to be order of creation independent.

The simplest way to think about each API name is "start with a face and follow a path into the finer levels of the hierarchy recording each turn along the way".

Here's some details. You should also consult MFnSubdNames class which contains a number of helpful methods for interpreting, creating and modifying the component API names. While this will take some getting used to, the good news is that instantiating more vertices does not change the names of the existing ones (unless you're adding more level 0 vertices) so any vertex animation, etc. will not be affected by a need to model more detail into another part of the surface.

- base face name Each component API name is "rooted" at one of the faces in the original, coarsest (level 0, "base") mesh. These faces are numbered 0, 1, etc.

- level Each component exists only at a single level. The value ranges from 0 to 12.

- level 1 choice Coarsest faces can have up to 256 sides. Finer faces are always four sided. This portion of the name lets us decide which of the possibly 256 level 1 faces we are choosing.

- path from level 1 Once we are at a level 1 face, we go down to a finer face by choosing one of the four children. This is recorded as two bits per level, giving us a "path" down to the desired level.

- vertex/edge choice For all but level 0 faces, once we know the face, we just have to choose one of the four edges or vertices. This value is usually 0 for the faces (it is ignored). In the case of the level 0 faces, this contains the full index of the vertex within that face

- storage Subdivision surface components (vertex, faces, names) are stored as single unsigned 64 bit integers (MUint64 type is defined in MTypes.h). The above 5 values are compressed into the 64 bit int storage. For those that want the gory details, the following is the way the components are currently organized within the 64 bits of data. However you should use the 5 values above and not this 64 bit value as the way these 5 values are packed into the 64 bit value may change in future. The contents of the 64 bits are presented here from the highest value bit down to the lowest:

- {1} - unused
- {23} - base face name
- {8} - level 1 choice
- {2} - unused
- {4} - level
- {24} - path
- {2} - unused

For the subdivision surfaces, the most important names are those of the faces. Given a face name, each vertex on that face is named based on that face. That does mean that each vertex will typically have more than one name. Maya will always give you a unique name by choosing the one that is numerically the smallest (in the 64 bit sense).

Examples:

  pointOnSubdNode.cpp.

`#include <MFnSubd.h>`

Inheritance diagram for MFnSubd:
[legend]

List of all members.

## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnSubd ()
| Destructor.
| MFnSubd ()
| Default constructor.
| MFnSubd (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
| MFnSubd (const MDagPath &object, MStatus *ret=NULL)
| Constructor.
MObject | createBaseMesh (bool reverseNormal, int numVertices, int numPolygons, const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
| Creates a new subdivision surface given an array of vertices and connection information and sets this function set to operate on the new surface.
MObject | copy (const MObject &source, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
| This method creates a copy of a given source subdivision surface.
MObject | collapse (const int level, bool makeNewNodeInvisible, MStatus *ReturnStatus=NULL)
| This method creates a copy of a given source subdivision surface collapsed by the given number of levels.
int | vertexBaseMeshAdd (double x, double y, double z, MStatus *ReturnStatus=NULL)
| Add a vertex to the base mesh and return its "index" name.
MUint64 | polygonBaseMeshAdd (int vertexCount, const int vertexIds[], MStatus *ReturnStatus=NULL)
| Add a polygon at the base mesh level.
MUint64 | polygonBaseMeshAddWithUVs (int vertexCount, const int vertexIds[], const double uValues[], const double vValues[], MStatus *ReturnStatus=NULL)
| Add a polygon at the base mesh level.
int | editsPending (MStatus *ReturnStatus=NULL) const
| As the new hierarchical vertex offsets are being introduced, you can choose to not apply them to the surface immediatelly.
void | editsUpdateAll (MStatus *ReturnStatus=NULL)
| If there are pending edits, this function will update the surface so that there are no pending edits.
unsigned int | levelMaxCurrent (MStatus *ReturnStatus=NULL) const
| Returns the finest level that currently exist.
unsigned int | levelMaxAllowed (MStatus *ReturnStatus=NULL) const
| Returns the maximum level that can be created.
void | levelFullySubdivideTo (int level, MStatus *ReturnStatus=NULL)
| Fully subdivide the whole surface to the specified level.
unsigned int | vertexCount (int level=0, MStatus *ReturnStatus=NULL) const
| Returns the finest vertex count at a particular level.
MUint64 | vertexIdFromBaseVertexIndex (int baseVertexIndex, MStatus *ReturnStatus=NULL) const
| Vertices are named using 64-bit integers.
int | vertexBaseIndexFromVertexId (MUint64 vertexId, MStatus *ReturnStatus=NULL) const
| Given a 64-bit id of the vertex, return its index (0, 1, ...) if it happens to be a base mesh vertex.
MStatus | vertexEditsGetAllNonBase (MUint64Array &vertexIds, MVectorArray &edits, MSpace::Space space=MSpace::kObject) const
| Returns all the vertices below the base mesh that have been modified from their original position (the original position is specified by the position of the base mesh vertices).
MStatus | vertexEditsSetAllNonBase (const MUint64Array &vertexIds, const MVectorArray &edits, MSpace::Space space=MSpace::kObject)
| Given an array of vertex names and the offsets from their original positions, set the new vertex positions.
MStatus | vertexEditsClearAllNonBase ()
| Find all vertices with edits and remove those edits, setting them back to their original position.
MStatus | vertexPositionGet (MUint64 vertId, MPoint &position, MSpace::Space space=MSpace::kObject) const
| Get the position of the vertex with a given name.
MStatus | vertexEditGet (MUint64 vertId, MVector &edit, MSpace::Space space=MSpace::kObject) const
| Get the offset of the specified vertex from its original position.
MStatus | vertexPositionGetNoEdit (MUint64 vertId, MPoint &position, MSpace::Space space=MSpace::kObject) const
| What would the position of this vertex be if there were no edits; i.e., what was its original position.
MStatus | vertexPositionSet (MUint64 vertId, const MPoint &position, bool updateEdits, MSpace::Space space=MSpace::kObject)
| Set the position of the vertex with a given name.
MStatus | vertexEditSet (MUint64 vertId, const MVector &edit, bool updateEdits, MSpace::Space space=MSpace::kObject)
| Set the original position offset for the given vertex.
MStatus | vertexBaseMeshGet (MPointArray &positions, MSpace::Space space=MSpace::kObject) const
| Return all base mesh vertices in the array using their indices (not the 64-bit names).
MStatus | vertexBaseMeshSet (const MPointArray &positions, MSpace::Space space=MSpace::kObject)
| Set the positions for the base mesh vertices using the 0, 1,...
MStatus | vertexBaseMeshGetWithId (MPointArray &positions, MUint64Array &vertexIds, MSpace::Space space=MSpace::kObject) const
| Return all base mesh vertices in the array using their indices but also provide the 64-bit names.
MStatus | vertexBaseMeshSetWithId (const MPointArray &positions, const MUint64Array &vertexIds, MSpace::Space space=MSpace::kObject)
| Set the positions for the base mesh vertices using the 64-bit names.
int | vertexValence (MUint64 vertId, MStatus *ReturnStatus=NULL) const
| Returns the valence (number of incident edges) of the given vertex.
MStatus | vertexNormal (MUint64 vertId, MVector &normal) const
| Returns the normal at the vertex.
MStatus | vertexAdjacentVertices (MUint64 vertId, MUint64Array &vertList) const
| Return the list of adjacent vertices as their 64-bit ids.
MStatus | vertexIncidentEdges (MUint64 vertId, MUint64Array &edgeList) const
| Return the list of incident edges as their 64-bit ids.
MStatus | vertexIncidentPolygons (MUint64 vertId, MUint64Array &polyList) const
| Return the list of incident polygons as their 64-bit ids.
bool | vertexIsBoundary (MUint64 vertId, MStatus *ReturnStatus=NULL) const
| Return true if the vertex is a boundary vertex.
bool | vertexIsValid (MUint64 vertId, MStatus *ReturnStatus=NULL) const
| Return true if the vertex is a valid vertex.
bool | vertexIsCreased (MUint64 vertId, MStatus *ReturnStatus=NULL) const
| Return true if the vertex is creased.
bool | vertexCreaseRelevant (MUint64 vertId, MStatus *ReturnStatus=NULL) const
| Return true if the crease of the vertex is a relevant piece of information.
MStatus | vertexSetCrease (MUint64 vertId, bool creased) const
| Set the particular vertex' crease state.
MStatus | vertexChildren (MUint64 vertId, MUint64Array &children) const
| Returns the "children" of the particular vertex if they exist.
MStatus | creasesGetAll (MUint64Array &vertexIds, MUint64Array &edgeIds) const
| Returns all creases on the subdivision surface in two arrays of 64-bit ids; one for the vertices, one for edges.
MStatus | creasesSetAll (const MUint64Array &vertexIds, const MUint64Array &edgeIds)
| Set the creases on all vertices and edges with a given 64-bit name.
MStatus | creasesClearAll () const
| Clear all crease information from this surface.
MStatus | updateAllEditsAndCreases ()
| If you have been editing offsets without updating the surface, this function will save you.
unsigned int | edgeCount (int level=0, MStatus *ReturnStatus=NULL) const
| Returns the number of edges at a level.
MUint64 | edgeBetween (MUint64 vertex1, MUint64 vertex2, MStatus *ReturnStatus=NULL) const
| Return the name of the edge that connects the two vertices.
MStatus | edgeVertices (MUint64 edge, MUint64 &v1, MUint64 &v2) const
| Given an edge, return the two vertices at its ends.
MStatus | edgeAdjacentPolygon (MUint64 edge, MUint64Array &polys) const
| Return the polygons adjacent to this edge.
bool | edgeIsBoundary (MUint64 edge, MStatus *ReturnStatus=NULL) const
| Test if the edge specified is a boundary edge or not.
bool | edgeIsValid (MUint64 edgeId, MStatus *ReturnStatus=NULL) const
| Returns true if the specified edge name is valid.
bool | edgeIsCreased (MUint64 edgeId, MStatus *ReturnStatus=NULL) const
| Return true if the edge is creased.
bool | edgeCreaseRelevant (MUint64 edgeId, MStatus *ReturnStatus=NULL) const
| Return true if the crease of the edge is a relevant piece of information.
MStatus | edgeSetCrease (MUint64 edgeId, bool creased) const
| Set the particular edge's crease state.
MStatus | edgeChildren (MUint64 edgeId, MUint64Array &children) const
| Returns the "children" of the particular edge.
unsigned int | polygonCount (int level=0, MStatus *ReturnStatus=NULL) const
| Returns the number of polygons currently existing at the specified level of the hierarchy.
int | polygonCountMaxWithGivenBaseMesh (int level=1, MStatus *ReturnStatus=NULL) const
| If you were to fully subdivide at a given level, how many polygons would you have at that level? This function will tell you and possibly save you from running out of memory if you go too deep.
unsigned int | polygonVertexCount (MUint64 polyId, MStatus *ReturnStatus=NULL) const
| How many vertices on a given polygon? The vertices are at the same level as the polygon.
MStatus | polygonVertices (MUint64 polyId, MUint64Array &vertIds) const
| Given the polygon, return its vertices.
unsigned int | polygonEdgeCount (MUint64 polyId, MStatus *ReturnStatus=NULL) const
| The number of edges on the given polygon.
MStatus | polygonEdges (MUint64 polyId, MUint64Array &edgeIds) const
| Given the polygon, return its edges.
bool | polygonIsValid (MUint64 polyId, MStatus *ReturnStatus=NULL) const
| Return true if the polygon is a valid polygon.
bool | polygonHasChildren (MUint64 polyId, MStatus *ReturnStatus=NULL) const
| Returns whether or not the given polygon has children.
MStatus | polygonChildren (MUint64 polyId, MUint64Array &children) const
| Returns the list of children polygons on the given polygon.
MStatus | polygonSubdivide (MUint64 polyId)
| Subdivide the given polygon into 4 children (if this happens to be the level 0 polygon you will get as many children as that polygon has edges).
MStatus | polygonSetUseUVs (MUint64 polyId, bool useThem)
| If this is set, the polygon will use the user specified UVs.
bool | polygonHasVertexUVs (MUint64 polyId, MStatus *ReturnStatus=NULL)
| Returns true if there are user specified UVs on this polygon.
MStatus | polygonGetVertexUVs (MUint64 polyId, MDoubleArray &uValues, MDoubleArray &vValues) const
| Get the vertex UVs from the polygon.
MStatus | polygonSetVertexUVs (MUint64 polyId, const MDoubleArray &uValues, const MDoubleArray &vValues)
| Set the UV values on the polygon.
MStatus | polygonGetCenterUV (MUint64 polyId, double &u, double &v) const
| Return the UV values in the "center" of this polygon.
MStatus | evaluatePosition (MUint64 polyId, double u, double v, bool uvNormalized, MPoint &) const
| Evaluate the surface position at the given parameter point on the polygon.
MStatus | evaluateNormal (MUint64 polyId, double u, double v, bool uvNormalized, MVector &nrml) const
| Evaluate the surface normal at the given parameter point on the polygon.
MStatus | evaluatePositionAndNormal (MUint64 polyId, double u, double v, bool uvNormalized, MPoint &pos, MVector &nrml) const
| Evaluate the surface position and normal at the given parameter point on the polygon.
bool | getCubicSpline (MUint64 polyId, MPointArray vertices, MStatus *ReturnStatus=NULL)
| Some of the faces (usually at level 2 or below) happen to be exactly the same as uniform bi-cubic B-splines.
MStatus | getConnectedSetsAndMembers (unsigned int instanceNumber, MObjectArray &sets, MObjectArray &comps, bool renderableSetsOnly) const
| Returns all the sets connected to the specified instance of this mesh.
MStatus | getConnectedShaders (unsigned int instanceNumber, MObjectArray &shaders, MUint64Array &faces, MIntArray &indices) const
| Returns all the shaders (sets) connected to the specified instance of this subdivision surface and two arrays indicating face/shader assignments.
MObject | tesselate (bool uniform, int depth, int sample, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
| Performs tesselation on this surface and create a new mesh in the DAG.
MObject | tessellateViaNurbs (MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
| Performs tesselation on this surface and create a new mesh in the DAG.
MStatus | convertToNurbs (MObjectArray &newNurbsSurfaces)
| Converts this surface to a set of nurbs surfaces.
MStatus | updateSubdSurface ()
| Signal that this subdivision surface has changed and needs to redraw itself.
MStatus | vertexBaseMeshAddWithIndex (double x, double y, double z, int index)
| Very similar to vertexBaseMeshAdd, this gives you an advanced option of specifying the index for the new vertex to be created.
| MFnSubd (const MObject &object, MStatus *ret=NULL)
| Constructor.
bool | getCubicSpline (MUint64 polyId, MPoint vertices[16], MStatus *ReturnStatus=NULL)
| NO SCRIPT SUPPORT.
## Protected Member Functions
virtual const char * | className () const
| Class name.

## Constructor & Destructor Documentation

~MFnSubd | ( |  | ) | `[virtual]`

Destructor.

Class destructor.

MFnSubd | ( | MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

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

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnSubd | ( | const MDagPath & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

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

Parameters:

  [in] | object | The const MDagPath to attach the function set to
  [out] | ReturnStatus | The return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnSubd | ( | const MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

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

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

## Member Function Documentation

MFn::Type type | ( |  | ) | const`[virtual]`

Search for all occurrences

Function set type.

Return the class type : MFn::kSubdiv.

Reimplemented from MFnDagNode.

const char * className | ( |  | ) | const`[protected, virtual]`

Search for all occurrences

Class name.

Return the class name : "MFnSubd".

Reimplemented from MFnDagNode.

MObject createBaseMesh | ( | bool | reverseNormal,
|  | int | numVertices,
|  | int | numPolygons,
|  | const MPointArray & | vertexArray,
|  | const MIntArray & | polygonCounts,
|  | const MIntArray & | polygonConnects,
|  | MObject | parentOrOwner = `MObject::kNullObj`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

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

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

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

If the parentOrOwner is kSubdivData then the created surface will be of type kSubdivGeom and will be returned. The parentOrOwner will become the owner of the new subdivision surface.

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

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

Parameters:

  [in] | reverseNormal | Not currently used
  [in] | numVertices | number of vertices
  [in] | numPolygons | number of polygons
  [in] | vertexArray | point (vertex) array
  [in] | polygonCounts | array of vertex counts for each polygon
  [in] | polygonConnects | array of vertex connections for each polygon
  [in] | parentOrOwner | parent of the polygon that will be created
  [out] | ReturnStatus | Status code

Returns:
  - If parentOrOwner is NULL then the transform for this surface is returned
  - If parentOrOwner is a DAG object then the new surface shape is returned
  - The surface geometry is returned if parentOrOwner is of type kSubdivData

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kLicenseFailure Application not licensed for attempted operation
  - MS::kInvalidParameter Array length does not match given item count, or parentOrOwner was not valid, or there was no model present to add the object to.
  - MS::kFailure An object error has occurred.
  - MS::kInsufficientMemory Insufficient memory to complete this method

MObject copy | ( | const MObject & | source,
|  | MObject | parentOrOwner = `MObject::kNullObj`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

This method creates a copy of a given source subdivision surface.

After the copy this function set will operate on the new subdivision surface.

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

If the parentOrOwner is kSubdivData then the created surface will be of type kSubdivGeom and will be returned. The parentOrOwner will become the owner of the new subdivision surface.

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

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

Parameters:

  [in] | source | the subdivision surface to be copied
  [in] | parentOrOwner | the DAG parent or kSubdivData the new subdivision surface will belong to
  [out] | ReturnStatus | Status code

Returns:
  - If parentOrOwner is NULL then the transform for this surface is returned
  - If parentOrOwner is a DAG object then the new surface shape is returned
  - The surface geometry is returned if parentOrOwner is of type kSubdivData

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kLicenseFailure Application not licensed for attempted operation
  - MS::kInvalidParameter parentOrOwner was not valid; or the source object was not one of kSubdivGeom, kSubdivData or kSubdiv; or dataSubdiv or underlying geometry was null; or source object was null; or there was no model present to add the object to.
  - MS::kFailure An object error has occurred.
  - MS::kInsufficientMemory Insufficient memory to complete this method

MObject collapse | ( | const int | level,
|  | bool | makeNewNodeInvisible,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

This method creates a copy of a given source subdivision surface collapsed by the given number of levels.

After the collapse this function set will operate on the new subdivision surface.

As an example, a collapse of one level means the level one vertices of the current subdivision surface become the level zero vertices of the new subdivision surface.

Be careful passing in a large value for the level, as each level of collapse increases the number of faces on the new subdivision surface significantly.

Collapsing a surface by one level means that the resulting surface is all quads. This can be useful in certain situations.

NOTE: the collapse() method will fail if the function set has not been initialized with a dag path.

Parameters:

  [in] | level | the number of levels of the hierarchy to collapse
  [in] | makeNewNodeInvisible | sets the invisible attribute of the new node
  [out] | ReturnStatus | Status code

Returns:
  The new collapsed subdivision object

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kLicenseFailure Application not licensed for attempted operation
  - MS::kInvalidParameter One of the following parameter errors
  - MS::kFailure An object error has occurred.

int vertexBaseMeshAdd | ( | double | x,
|  | double | y,
|  | double | z,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Add a vertex to the base mesh and return its "index" name.

Note that it will not have a valid 64-bit name until you actually create a polygon that holds it.

Parameters:

  [in] | x | X location of the vertex
  [in] | y | Y location of the vertex
  [in] | z | Z location of the vertex
  [out] | ReturnStatus | Status code

Returns:
  The index of the newly created vertex. It will be -1 if the creation failed.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MUint64 polygonBaseMeshAdd | ( | int | vertexCount,
|  | const int | vertexIndex[],
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Add a polygon at the base mesh level.

You will need to use the index names of the vertices (remember, they get their 64-bit names only after they have been added to a polygon).

Parameters:

  [in] | vertexCount | Number of vertices in the polygon
  [in] | vertexIndex | The vertex indices (0, 1, 2, ...)
  [out] | ReturnStatus | Status code

Returns:
  The name of the newly created polygon

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MUint64 polygonBaseMeshAddWithUVs | ( | int | vertexCount,
|  | const int | vertexIds[],
|  | const double | uValues[],
|  | const double | vValues[],
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Add a polygon at the base mesh level.

You will need to use the index names of the vertices (remember, they get their 64-bit names only after they have been added to a polygon). Specify the UV values as well.

Parameters:

  [in] | vertexCount | Number of vertices in the polygon
  [in] | vertexIds | The vertex indices (0, 1, 2, ...)
  [in] | uValues | U values for each vertex
  [in] | vValues | V values for each vertex
  [out] | ReturnStatus | Status code

Returns:
  The name of the newly created polygon

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

int editsPending | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

As the new hierarchical vertex offsets are being introduced, you can choose to not apply them to the surface immediatelly.

If you do that, the number of edits pending will increase. Any edits are not actually made until you call "updateEdits". This functions lets you know if you need to call it or not.

Parameters:

  [out] | ReturnStatus | Status code

Returns:
  Edits pending (1) or not (0).

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

void editsUpdateAll | ( | MStatus * | ReturnStatus = `NULL` | ) |

Search for all occurrences

If there are pending edits, this function will update the surface so that there are no pending edits.

Parameters:

  [out] | ReturnStatus | Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

unsigned int levelMaxCurrent | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the finest level that currently exist.

As int as a single face exists at a level, that level is counted. Note that this not mean that all of the faces exist on all levels.

Parameters:

  [out] | ReturnStatus | Status code

Returns:
  The finest level in the hierarchy

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

unsigned int levelMaxAllowed | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the maximum level that can be created.

You should probably avoid fully subdividing the surface to that level as you will most likelly just run out of memory.

Parameters:

  [out] | ReturnStatus | Status code

Returns:
  The maximum possibly value for the finest level in the hierarchy

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

void levelFullySubdivideTo | ( | int | level,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Fully subdivide the whole surface to the specified level.

This could be very expensive, so be careful, or you will run out of memory. As a rule, each level has 4 times more faces than the previous one.

Parameters:

  [in] | level | The level to which to fully subdivide
  [out] | ReturnStatus | Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

unsigned int vertexCount | ( | int | level = `0`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the finest vertex count at a particular level.

These are the vertices that are currently instantiated.

Parameters:

  [in] | level | The level we are interested in
  [out] | ReturnStatus | Status code

Returns:
  The number of vertices at the given level

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MUint64 vertexIdFromBaseVertexIndex | ( | int | baseVertexIndex,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Vertices are named using 64-bit integers.

The base mesh vertices will also have a simple 0, 1, 2, N-1 indices. Use this function to compute the proper 64-bit name using the 0, 1, 2, ... indices.

Parameters:

  [in] | baseVertexIndex | The index in the base mesh vertex array of this vertex
  [out] | ReturnStatus | Status code

Returns:
  The 64-bit name of the vertex

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

int vertexBaseIndexFromVertexId | ( | MUint64 | vertexId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Given a 64-bit id of the vertex, return its index (0, 1, ...) if it happens to be a base mesh vertex.

It is an error to call this function with a non base mesh vertex.

Parameters:

  [in] | vertexId | The 64-bit name of the vertex
  [out] | ReturnStatus | Status code

Returns:
  The index in the base mesh vertex array of this vertex

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexEditsGetAllNonBase | ( | MUint64Array & | vertexIds,
|  | MVectorArray & | edits,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  | const

Search for all occurrences

Returns all the vertices below the base mesh that have been modified from their original position (the original position is specified by the position of the base mesh vertices).

The two arrays will be of the same length upon return. Length 0 would suggest that there have been no edits from the original positions.

Parameters:

  [in] | vertexIds | The names of the vertices
  [in] | edits | The offsets from the original position
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexEditsSetAllNonBase | ( | const MUint64Array & | vertexIds,
|  | const MVectorArray & | edits,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  |

Search for all occurrences

Given an array of vertex names and the offsets from their original positions, set the new vertex positions.

Parameters:

  [in] | vertexIds | The names of the vertices
  [in] | edits | The offsets from the original positions
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexEditsClearAllNonBase | ( |  | ) |

Search for all occurrences

Find all vertices with edits and remove those edits, setting them back to their original position.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexPositionGet | ( | MUint64 | vertexId,
|  | MPoint & | position,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  | const

Search for all occurrences

Get the position of the vertex with a given name.

Parameters:

  [in] | vertexId | The name of the vertex
  [out] | position | The vertex position in the appropriate space
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexEditGet | ( | MUint64 | vertexId,
|  | MVector & | edit,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  | const

Search for all occurrences

Get the offset of the specified vertex from its original position.

This vector really is vertexPositionGet() - vertexPositionGetNoEdit().

Parameters:

  [in] | vertexId | The name of the vertex
  [out] | edit | The offset in object space
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexPositionGetNoEdit | ( | MUint64 | vertexId,
|  | MPoint & | position,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  | const

Search for all occurrences

What would the position of this vertex be if there were no edits; i.e., what was its original position.

Parameters:

  [in] | vertexId | The name of the vertex
  [out] | position | The original position
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexPositionSet | ( | MUint64 | vertexId,
|  | const MPoint & | position,
|  | bool | updateEdits,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  |

Search for all occurrences

Set the position of the vertex with a given name.

Parameters:

  [in] | vertexId | The vertex name
  [out] | position | The new vertex position
  [in] | updateEdits | If false, you will need to call updateSubdSurface() before any change would be applied. Further, you must set this to true before you start calling the same function on the vertices of the finer levels.
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexEditSet | ( | MUint64 | vertexId,
|  | const MVector & | edit,
|  | bool | updateEdits,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  |

Search for all occurrences

Set the original position offset for the given vertex.

Parameters:

  [in] | vertexId | The name of the vertex
  [in] | edit | The offset to set
  [in] | updateEdits | If false, you will need to call updateSubdSurface() before any change would be applied. Further, you must set this to true before you start calling the same function on the vertices of the finer levels.
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexBaseMeshGet | ( | MPointArray & | positions,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  | const

Search for all occurrences

Return all base mesh vertices in the array using their indices (not the 64-bit names).

Parameters:

  [out] | positions | The array of point positions
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexBaseMeshSet | ( | const MPointArray & | positions,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  |

Search for all occurrences

Set the positions for the base mesh vertices using the 0, 1,...

indexing instead of the 64-bit vertex names.

Parameters:

  [out] | positions | The positions for the vertices
  [in] | space | Specifies the coordinate system for this operation

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexBaseMeshGetWithId | ( | MPointArray & | positions,
|  | MUint64Array & | vertexIds,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  | const

Search for all occurrences

Return all base mesh vertices in the array using their indices but also provide the 64-bit names.

Parameters:

  [out] | positions | The array of point positions
  [out] | vertexIds | The vertex 64-bit ids
  [in] | space | The space we are working in

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexBaseMeshSetWithId | ( | const MPointArray & | positions,
|  | const MUint64Array & | vertexIds,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  |

Search for all occurrences

Set the positions for the base mesh vertices using the 64-bit names.

The ordering of the elements in the array is irrelevant. The edits will be automatically updated (i.e., editsPending() will return 0 after the call to this function).

Parameters:

  [out] | positions | The positions for the vertices
  [out] | vertexIds | The vertex 64-bit ids
  [in] | space | The space we are working in

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

int vertexValence | ( | MUint64 | vertexId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the valence (number of incident edges) of the given vertex.

Parameters:

  [in] | vertexId | The vertex 64-bit id
  [out] | ReturnStatus | Status code

Returns:
  The finest level in the hierarchy

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexNormal | ( | MUint64 | vertexId,
|  | MVector & | normal
| ) |  | const

Search for all occurrences

Returns the normal at the vertex.

Parameters:

  [in] | vertexId | The vertex 64-bit ID.
  [out] | normal | The value of the normal

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexAdjacentVertices | ( | MUint64 | vertexId,
|  | MUint64Array & | vertList
| ) |  | const

Search for all occurrences

Return the list of adjacent vertices as their 64-bit ids.

Parameters:

  [in] | vertexId | The vertex 64-bit name
  [out] | vertList | The resulting list of adjacent vertices

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexIncidentEdges | ( | MUint64 | vertexId,
|  | MUint64Array & | edgeList
| ) |  | const

Search for all occurrences

Return the list of incident edges as their 64-bit ids.

Parameters:

  [in] | vertexId | The vertex 64-bit name
  [out] | edgeList | The resulting list of incident edges

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexIncidentPolygons | ( | MUint64 | vertexId,
|  | MUint64Array & | polyList
| ) |  | const

Search for all occurrences

Return the list of incident polygons as their 64-bit ids.

Parameters:

  [in] | vertexId | The vertex 64-bit name
  [out] | polyList | The resulting list of incident polygons

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool vertexIsBoundary | ( | MUint64 | vertexId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Return true if the vertex is a boundary vertex.

Parameters:

  [in] | vertexId | The vertex 64-bit name
  [out] | ReturnStatus | Status code

Returns:
  Whether the vertex is boundary or not

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool vertexIsValid | ( | MUint64 | vertexId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Return true if the vertex is a valid vertex.

Parameters:

  [in] | vertexId | The vertex 64-bit name
  [out] | ReturnStatus | Status code

Returns:
  Whether the vertex is valid or not. Valid means that the vertex has been instantiated on the surface. Not all vertices at all levels exist by default. A vertex only exists if it was created at the time the subdiv was first created or if the subdiv was refined.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool vertexIsCreased | ( | MUint64 | vertexId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Return true if the vertex is creased.

Parameters:

  [in] | vertexId | The vertex 64-bit name
  [out] | ReturnStatus | Status code

Returns:
  Whether the vertex is creased or not

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool vertexCreaseRelevant | ( | MUint64 | vertexId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Return true if the crease of the vertex is a relevant piece of information.

The vertex inherits the crease state from its parent. So, its crease state is relevant only if different from its parent (or if there is no direct parent vertex).

Parameters:

  [in] | vertexId | The vertex 64-bit name
  [out] | ReturnStatus | Status code

Returns:
  Whether the vertex has relevant crease information

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexSetCrease | ( | MUint64 | vertexId,
|  | bool | creased
| ) |  | const

Search for all occurrences

Set the particular vertex' crease state.

Parameters:

  [in] | vertexId | The 64-bit name of the vertex
  [in] | creased | Crease (true) or smooth (false)

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexChildren | ( | MUint64 | vertexId,
|  | MUint64Array & | children
| ) |  | const

Search for all occurrences

Returns the "children" of the particular vertex if they exist.

The children are defined as the finer-level version of the current vertex plus the neighbors of that vertex. For a valence n vertex this means 2n+1 vertices are returned if a finer level exists.

Parameters:

  [in] | vertexId | 64-bit name of the vertex
  [out] | children | 64-bit names of the children of this vertex

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus creasesGetAll | ( | MUint64Array & | vertexIds,
|  | MUint64Array & | edgeIds
| ) |  | const

Search for all occurrences

Returns all creases on the subdivision surface in two arrays of 64-bit ids; one for the vertices, one for edges.

Note that this information alone is not suitable for "copying" the surface; there may be some relevant crease information in the non-creased vertices or edges which will not be part of the arrays returned here. Consider a vertex at level N that is creased while the corresponding vertex at level N+1 is not creased. Calling creasesGetAll will return the level N vertex. Applying the creasing to this vertex in the copy will also set the vertex at level N+1 to be creased as well, since vertices inherit creasing from their parent unless they have a different creasing set explicitly. So to get correct behavior when copying surfaces it is necessary to set the creasing attribute explicitly to the appropriate value on all the vertices, not just the creased vertices. The same applies to edges.

Parameters:

  [out] | vertexIds | The ids of the vertices that are creased
  [out] | edgeIds | The ids of the edges that are creased

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus creasesSetAll | ( | const MUint64Array & | vertexIds,
|  | const MUint64Array & | edgeIds
| ) |  |

Search for all occurrences

Set the creases on all vertices and edges with a given 64-bit name.

Note that the combination of creasesGetAll() and creasesSetAll() will not exactly duplicate the crease information between two surfaces.

Parameters:

  [in] | vertexIds | The ids of the vertices that are creased
  [in] | edgeIds | The ids of the edges that are creased

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus creasesClearAll | ( |  | ) | const

Search for all occurrences

Clear all crease information from this surface.

No vertices or edges will be creased after this function completes.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus updateAllEditsAndCreases | ( |  | ) |

Search for all occurrences

If you have been editing offsets without updating the surface, this function will save you.

This will dirty up the complete surface and recompute the positions of all the cvs, updating the crease info along the way. Not cheap to call.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

unsigned int edgeCount | ( | int | level = `0`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the number of edges at a level.

Parameters:

  [in] | level | The level where we're counting the edges
  [out] | ReturnStatus | Status code

Returns:
  Number of edges at the given level

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MUint64 edgeBetween | ( | MUint64 | vertex1,
|  | MUint64 | vertex2,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Return the name of the edge that connects the two vertices.

If the edge doesn't exist, it will be created.

Parameters:

  [in] | vertex1 | The name of the first vertex
  [in] | vertex2 | The name of the second vertex
  [out] | ReturnStatus | Status code

Returns:
  The name of the edge between the two

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus edgeVertices | ( | MUint64 | edgeId,
|  | MUint64 & | v1,
|  | MUint64 & | v2
| ) |  | const

Search for all occurrences

Given an edge, return the two vertices at its ends.

Parameters:

  [in] | edgeId | The 64-bit edge name
  [out] | v1 | First vertex on the edge
  [out] | v2 | Second vertex on the edge

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus edgeAdjacentPolygon | ( | MUint64 | edgeId,
|  | MUint64Array & | polys
| ) |  | const

Search for all occurrences

Return the polygons adjacent to this edge.

There can be at most two, as non-manifold topology is not allowed.

Parameters:

  [in] | edgeId | The 64-bit edge name
  [out] | polys | The 64-bit names of the polygons (1 or 2)

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool edgeIsBoundary | ( | MUint64 | edgeId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Test if the edge specified is a boundary edge or not.

Parameters:

  [in] | edgeId | The 64-bit edge name
  [out] | ReturnStatus | Status code

Returns:
  True if the edge is a boundary edge, false otherwise.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool edgeIsValid | ( | MUint64 | edgeId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns true if the specified edge name is valid.

Parameters:

  [in] | edgeId | The 64-bit edge name
  [out] | ReturnStatus | Status code

Returns:
  True if the edge name is valid, false otherwise.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool edgeIsCreased | ( | MUint64 | edgeId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Return true if the edge is creased.

Parameters:

  [in] | edgeId | The 64-bit name of the edge
  [out] | ReturnStatus | Status code

Returns:
  True if the edge is creased, false otherwise

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool edgeCreaseRelevant | ( | MUint64 | edgeId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Return true if the crease of the edge is a relevant piece of information.

The edge inherits the crease state from its parent. So, its crease state is relevant only if different from its parent (or if there is no direct parent edge).

Parameters:

  [in] | edgeId | The edge 64-bit name
  [out] | ReturnStatus | Status code

Returns:
  Whether the edge has relevant crease information

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus edgeSetCrease | ( | MUint64 | edgeId,
|  | bool | creased
| ) |  | const

Search for all occurrences

Set the particular edge's crease state.

Parameters:

  [in] | edgeId | The 64-bit name of the edge
  [in] | creased | Crease (true) or smooth (false)

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus edgeChildren | ( | MUint64 | edgeId,
|  | MUint64Array & | children
| ) |  | const

Search for all occurrences

Returns the "children" of the particular edge.

If the edge has children, there will always be two child edges.

Parameters:

  [in] | edgeId | 64-bit name of the edge
  [out] | children | 64-bit names of the children of this edge

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

unsigned int polygonCount | ( | int | level = `0`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the number of polygons currently existing at the specified level of the hierarchy.

Parameters:

  [in] | level | Level at which we're counting
  [out] | ReturnStatus | Status code

Returns:
  The number of polygons at the specified level

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

int polygonCountMaxWithGivenBaseMesh | ( | int | level = `1`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

If you were to fully subdivide at a given level, how many polygons would you have at that level? This function will tell you and possibly save you from running out of memory if you go too deep.

Note that this is exactly the same as "polygonCount" for levels 0 and 1.

Parameters:

  [in] | level | The level where you would be counting
  [out] | ReturnStatus | Status code

Returns:
  The number of polygons at the given level if you were to fully subdivide at that level.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

unsigned int polygonVertexCount | ( | MUint64 | polyId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

How many vertices on a given polygon? The vertices are at the same level as the polygon.

Parameters:

  [in] | polyId | The 64-bit name of the polygon
  [out] | ReturnStatus | Status code

Returns:
  The number of vertices on this polygon

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus polygonVertices | ( | MUint64 | polyId,
|  | MUint64Array & | vertexIds
| ) |  | const

Search for all occurrences

Given the polygon, return its vertices.

The vertices are at the same level as the polygon.

Parameters:

  [in] | polyId | The 64-bit name of the polygon
  [out] | vertexIds | The 64-bit names of the vertices

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

unsigned int polygonEdgeCount | ( | MUint64 | polyId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

The number of edges on the given polygon.

Parameters:

  [in] | polyId | The 64-bit name of the polygon
  [out] | ReturnStatus | Status code

Returns:
  The number of edges on this polygon

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus polygonEdges | ( | MUint64 | polyId,
|  | MUint64Array & | edgeIds
| ) |  | const

Search for all occurrences

Given the polygon, return its edges.

The edges are at the same level as the polygon.

Parameters:

  [in] | polyId | The 64-bit name of the polygon
  [out] | edgeIds | The 64-bit names of the edges

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool polygonIsValid | ( | MUint64 | polygonId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Return true if the polygon is a valid polygon.

Parameters:

  [in] | polygonId | The polygon 64-bit name
  [out] | ReturnStatus | Status code

Returns:
  Whether the polygon is valid or not. Valid means that the polygon has been instantiated on the surface. Not all polygons at all levels exist by default. A polygon only exists if it was created at the time the subdiv was first created or if the subdiv was refined.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool polygonHasChildren | ( | MUint64 | polyId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns whether or not the given polygon has children.

Parameters:

  [in] | polyId | The polygon 64-bit name
  [out] | ReturnStatus | Status code

Returns:
  Whether the polygon has children.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred. This can happen if the polyId passed in refers to a face that is not currently instantiated on the surface.

MStatus polygonChildren | ( | MUint64 | polyId,
|  | MUint64Array & | children
| ) |  | const

Search for all occurrences

Returns the list of children polygons on the given polygon.

If the children array is not empty, we will just append to it.

Parameters:

  [in] | polyId | The 64-bit name of the original polygon
  [out] | children | The 64-bit name of the child polygons

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred. This can happen if the polyId passed in refers to a face that is not currently instantiated on the surface.

MStatus polygonSubdivide | ( | MUint64 | polyId | ) |

Search for all occurrences

Subdivide the given polygon into 4 children (if this happens to be the level 0 polygon you will get as many children as that polygon has edges).

Parameters:

  [in] | polyId | The 64-bit name of the polygon

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus polygonSetUseUVs | ( | MUint64 | polyId,
|  | bool | useThem
| ) |  |

Search for all occurrences

If this is set, the polygon will use the user specified UVs.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [in] | useThem | Use the user set UVs

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool polygonHasVertexUVs | ( | MUint64 | polyId,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Returns true if there are user specified UVs on this polygon.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [out] | ReturnStatus | Status code

Returns:
  True if there were explicitly specified UVs on this polygon.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus polygonGetVertexUVs | ( | MUint64 | polyId,
|  | MDoubleArray & | uValues,
|  | MDoubleArray & | vValues
| ) |  | const

Search for all occurrences

Get the vertex UVs from the polygon.

The values come back in exactly the same order as the polygon vertices do.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [out] | uValues | Array of U values
  [out] | vValues | Array of V values

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus polygonSetVertexUVs | ( | MUint64 | polyId,
|  | const MDoubleArray & | uValues,
|  | const MDoubleArray & | vValues
| ) |  |

Search for all occurrences

Set the UV values on the polygon.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [in] | uValues | Array of U values
  [in] | vValues | Array of V values

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus polygonGetCenterUV | ( | MUint64 | polyId,
|  | double & | u,
|  | double & | v
| ) |  | const

Search for all occurrences

Return the UV values in the "center" of this polygon.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [out] | u | The resulting U value
  [out] | v | The resulting V value

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus evaluatePosition | ( | MUint64 | polyId,
|  | double | u,
|  | double | v,
|  | bool | uvNormalized,
|  | MPoint & | pos
| ) |  | const

Search for all occurrences

Evaluate the surface position at the given parameter point on the polygon.

The limitation is that this cannot be a base mesh polygon; i.e., it has to be at least level 1.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [in] | u | U value on the face
  [in] | v | V value on the face
  [in] | uvNormalized | If true, its as if U, V are in [0,1]
  [out] | pos | The resulting 3d position

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus evaluateNormal | ( | MUint64 | polyId,
|  | double | u,
|  | double | v,
|  | bool | uvNormalized,
|  | MVector & | nrml
| ) |  | const

Search for all occurrences

Evaluate the surface normal at the given parameter point on the polygon.

The limitation is that this cannot be a base mesh polygon; i.e., it has to be at least level 1.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [in] | u | U value on the face
  [in] | v | V value on the face
  [in] | uvNormalized | If true, its as if U, V are in [0,1]
  [out] | nrml | The resulting surface normal

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus evaluatePositionAndNormal | ( | MUint64 | polyId,
|  | double | u,
|  | double | v,
|  | bool | uvNormalized,
|  | MPoint & | pos,
|  | MVector & | nrml
| ) |  | const

Search for all occurrences

Evaluate the surface position and normal at the given parameter point on the polygon.

The limitation is that this cannot be a base mesh polygon; i.e., it has to be at least level 1.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [in] | u | U value on the face
  [in] | v | V value on the face
  [in] | uvNormalized | If true, its as if U, V are in [0,1]
  [out] | pos | The resulting 3d position
  [out] | nrml | The resulting surface normal

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool getCubicSpline | ( | MUint64 | polyId,
|  | MPointArray | vertices,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Some of the faces (usually at level 2 or below) happen to be exactly the same as uniform bi-cubic B-splines.

This routine will return the 16 points that define such spline.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [out] | vertices | point array
  [out] | ReturnStatus | Status code

Returns:
  True if we can make the conversion, false otherwise

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

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

Search for all occurrences

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

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

Parameters:

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

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus getConnectedShaders | ( | unsigned int | instanceNumber,
|  | MObjectArray & | shaders,
|  | MUint64Array & | faces,
|  | MIntArray & | indices
| ) |  | const

Search for all occurrences

Returns all the shaders (sets) connected to the specified instance of this subdivision surface and two arrays indicating face/shader assignments.

For each face in the face array, there is a corresponding entry in the indices array to indicate the assigned shader in the shader array.

For instance, faces[0] is the 64-bit index of the face on the subdivision surface. Then indices[0] is an index into the shaders array, eg. "3". Then shaders[3] is the shader assigned to the subdivision surface face.

If a face does not have a shader assigned to it, the value of the index will be -1. The shader objects can be derived from the sets returned.

See also getConnectedSetsAndMembers.

Parameters:

  [in] | instanceNumber | The instance number of the subdivision surface to query
  [out] | shaders | Storage for set objects (shader objects)
  [out] | faces | Storage for indices matching faces to indices
  [out] | indices | Storage for indices matching indices to shaders

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MObject tesselate | ( | bool | uniform,
|  | int | depth,
|  | int | sample,
|  | MObject | parentOrOwner = `MObject::kNullObj`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Performs tesselation on this surface and create a new mesh in the DAG.

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

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

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

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

Note: Each level 1 face will tesselate into approximatelly: 2 * 4^(depth-1) * sample^2 triangles in the uniform case, so be careful as to how you choose these parameters.

Parameters:

  [in] | uniform | Use uniform tesselation if this is set.
  [in] | depth | Used in the uniform tesselation: how deep do we go
  [in] | sample | In both tesselation cases, once we decide which level to tesselate at, how many times do we sample.
  [in] | parentOrOwner | the DAG parent or kMeshData the new Mesh will belong to
  [out] | ReturnStatus | Status Code

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

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MObject tessellateViaNurbs | ( | MObject | parentOrOwner = `MObject::kNullObj`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Performs tesselation on this surface and create a new mesh in the DAG.

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

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

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

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

Note: Each level 1 face will tesselate into approximatelly: 2 * 4^(depth-1) * sample^2 triangles in the uniform case, so be careful as to how you choose these parameters.

Parameters:

  [in] | parentOrOwner | the DAG parent or kMeshData the new Mesh will belong to
  [out] | ReturnStatus | Status Code

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

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus convertToNurbs | ( | MObjectArray & | newNurbsSurfaces | ) |

Search for all occurrences

Converts this surface to a set of nurbs surfaces.

Parameters:

  [out] | newNurbsSurfaces | Storage for the arary of NURBS

Returns:
  Status code.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus updateSubdSurface | ( |  | ) |

Search for all occurrences

Signal that this subdivision surface has changed and needs to redraw itself.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus vertexBaseMeshAddWithIndex | ( | double | x,
|  | double | y,
|  | double | z,
|  | int | index
| ) |  |

Search for all occurrences

Very similar to vertexBaseMeshAdd, this gives you an advanced option of specifying the index for the new vertex to be created.

You have to be extremelly careful to end up with the indices 0, 1, ... N-1 for N total vertices.

Parameters:

  [in] | x | X location of the vertex
  [in] | y | Y location of the vertex
  [in] | z | Z location of the vertex
  [in] | index | The index the vertex is to take

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

bool getCubicSpline | ( | MUint64 | polyId,
|  | MPoint | vertices[16],
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

NO SCRIPT SUPPORT.

Some of the faces (usually at level 2 or below) happen to be exactly the same as uniform bi-cubic B-splines.

This routine will return the 16 points that define such spline.

Parameters:

  [in] | polyId | The 64-bit polygon name
  [out] | vertices | 16 vertices that define the cubic spline
  [out] | ReturnStatus | Status code

Returns:
  True if we can make the conversion, false otherwise

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd
MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd MFnSubd