Public Member Functions | Protected Member Functions

MFnSubd Class Reference

This reference page is linked to from the following overview topics: Threading and Maya.


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:

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:

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.

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:
Inheritance graph
[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]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
MFnSubd ( const MDagPath object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters:
[in]objectThe const MDagPath to attach the function set to
[out]ReturnStatusThe return status
Status Codes:
MFnSubd ( const MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters:
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:

Member Function Documentation

MFn::Type type ( ) const [virtual]

Function set type.

Return the class type : MFn::kSubdiv.

Reimplemented from MFnDagNode.

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

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 
)

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]reverseNormalNot currently used
[in]numVerticesnumber of vertices
[in]numPolygonsnumber of polygons
[in]vertexArraypoint (vertex) array
[in]polygonCountsarray of vertex counts for each polygon
[in]polygonConnectsarray of vertex connections for each polygon
[in]parentOrOwnerparent of the polygon that will be created
[out]ReturnStatusStatus 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:
MObject copy ( const MObject source,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

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]sourcethe subdivision surface to be copied
[in]parentOrOwnerthe DAG parent or kSubdivData the new subdivision surface will belong to
[out]ReturnStatusStatus 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 
)

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]levelthe number of levels of the hierarchy to collapse
[in]makeNewNodeInvisiblesets the invisible attribute of the new node
[out]ReturnStatusStatus code
Returns:
The new collapsed subdivision object
Status Codes:
int vertexBaseMeshAdd ( double  x,
double  y,
double  z,
MStatus ReturnStatus = NULL 
)

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]xX location of the vertex
[in]yY location of the vertex
[in]zZ location of the vertex
[out]ReturnStatusStatus code
Returns:
The index of the newly created vertex. It will be -1 if the creation failed.
Status Codes:
MUint64 polygonBaseMeshAdd ( int  vertexCount,
const int  vertexIndex[],
MStatus ReturnStatus = NULL 
)

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]vertexCountNumber of vertices in the polygon
[in]vertexIndexThe vertex indices (0, 1, 2, ...)
[out]ReturnStatusStatus code
Returns:
The name of the newly created polygon
Status Codes:
MUint64 polygonBaseMeshAddWithUVs ( int  vertexCount,
const int  vertexIds[],
const double  uValues[],
const double  vValues[],
MStatus ReturnStatus = NULL 
)

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]vertexCountNumber of vertices in the polygon
[in]vertexIdsThe vertex indices (0, 1, 2, ...)
[in]uValuesU values for each vertex
[in]vValuesV values for each vertex
[out]ReturnStatusStatus code
Returns:
The name of the newly created polygon
Status Codes:
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.

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]ReturnStatusStatus code
Returns:
Edits pending (1) or not (0).
Status Codes:
void editsUpdateAll ( MStatus ReturnStatus = NULL)

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

Parameters:
[out]ReturnStatusStatus code
Status Codes:
unsigned int levelMaxCurrent ( MStatus ReturnStatus = NULL) const

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]ReturnStatusStatus code
Returns:
The finest level in the hierarchy
Status Codes:
unsigned int levelMaxAllowed ( MStatus ReturnStatus = NULL) const

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]ReturnStatusStatus code
Returns:
The maximum possibly value for the finest level in the hierarchy
Status Codes:
void levelFullySubdivideTo ( int  level,
MStatus ReturnStatus = NULL 
)

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]levelThe level to which to fully subdivide
[out]ReturnStatusStatus code
Status Codes:
unsigned int vertexCount ( int  level = 0,
MStatus ReturnStatus = NULL 
) const

Returns the finest vertex count at a particular level.

These are the vertices that are currently instantiated.

Parameters:
[in]levelThe level we are interested in
[out]ReturnStatusStatus code
Returns:
The number of vertices at the given level
Status Codes:
MUint64 vertexIdFromBaseVertexIndex ( int  baseVertexIndex,
MStatus ReturnStatus = NULL 
) const

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]baseVertexIndexThe index in the base mesh vertex array of this vertex
[out]ReturnStatusStatus code
Returns:
The 64-bit name of the vertex
Status Codes:
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.

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

Parameters:
[in]vertexIdThe 64-bit name of the vertex
[out]ReturnStatusStatus code
Returns:
The index in the base mesh vertex array of this vertex
Status Codes:
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).

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]vertexIdsThe names of the vertices
[in]editsThe offsets from the original position
[in]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
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.

Parameters:
[in]vertexIdsThe names of the vertices
[in]editsThe offsets from the original positions
[in]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
MStatus vertexEditsClearAllNonBase ( )

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

Returns:
Status code
Status Codes:
MStatus vertexPositionGet ( MUint64  vertexId,
MPoint position,
MSpace::Space  space = MSpace::kObject 
) const

Get the position of the vertex with a given name.

Parameters:
[in]vertexIdThe name of the vertex
[out]positionThe vertex position in the appropriate space
[in]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
MStatus vertexEditGet ( MUint64  vertexId,
MVector edit,
MSpace::Space  space = MSpace::kObject 
) const

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

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

Parameters:
[in]vertexIdThe name of the vertex
[out]editThe offset in object space
[in]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
MStatus vertexPositionGetNoEdit ( MUint64  vertexId,
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.

Parameters:
[in]vertexIdThe name of the vertex
[out]positionThe original position
[in]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
MStatus vertexPositionSet ( MUint64  vertexId,
const MPoint position,
bool  updateEdits,
MSpace::Space  space = MSpace::kObject 
)

Set the position of the vertex with a given name.

Parameters:
[in]vertexIdThe vertex name
[out]positionThe new vertex position
[in]updateEditsIf 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]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
MStatus vertexEditSet ( MUint64  vertexId,
const MVector edit,
bool  updateEdits,
MSpace::Space  space = MSpace::kObject 
)

Set the original position offset for the given vertex.

Parameters:
[in]vertexIdThe name of the vertex
[in]editThe offset to set
[in]updateEditsIf 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]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
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).

Parameters:
[out]positionsThe array of point positions
[in]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
MStatus vertexBaseMeshSet ( const MPointArray positions,
MSpace::Space  space = MSpace::kObject 
)

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

indexing instead of the 64-bit vertex names.

Parameters:
[out]positionsThe positions for the vertices
[in]spaceSpecifies the coordinate system for this operation
Returns:
Status code
Status Codes:
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.

Parameters:
[out]positionsThe array of point positions
[out]vertexIdsThe vertex 64-bit ids
[in]spaceThe space we are working in
Returns:
Status code
Status Codes:
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.

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]positionsThe positions for the vertices
[out]vertexIdsThe vertex 64-bit ids
[in]spaceThe space we are working in
Returns:
Status code
Status Codes:
int vertexValence ( MUint64  vertexId,
MStatus ReturnStatus = NULL 
) const

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

Parameters:
[in]vertexIdThe vertex 64-bit id
[out]ReturnStatusStatus code
Returns:
The finest level in the hierarchy
Status Codes:
MStatus vertexNormal ( MUint64  vertexId,
MVector normal 
) const

Returns the normal at the vertex.

Parameters:
[in]vertexIdThe vertex 64-bit ID.
[out]normalThe value of the normal
Returns:
Status code
Status Codes:
MStatus vertexAdjacentVertices ( MUint64  vertexId,
MUint64Array vertList 
) const

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

Parameters:
[in]vertexIdThe vertex 64-bit name
[out]vertListThe resulting list of adjacent vertices
Returns:
Status code
Status Codes:
MStatus vertexIncidentEdges ( MUint64  vertexId,
MUint64Array edgeList 
) const

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

Parameters:
[in]vertexIdThe vertex 64-bit name
[out]edgeListThe resulting list of incident edges
Returns:
Status code
Status Codes:
MStatus vertexIncidentPolygons ( MUint64  vertexId,
MUint64Array polyList 
) const

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

Parameters:
[in]vertexIdThe vertex 64-bit name
[out]polyListThe resulting list of incident polygons
Returns:
Status code
Status Codes:
bool vertexIsBoundary ( MUint64  vertexId,
MStatus ReturnStatus = NULL 
) const

Return true if the vertex is a boundary vertex.

Parameters:
[in]vertexIdThe vertex 64-bit name
[out]ReturnStatusStatus code
Returns:
Whether the vertex is boundary or not
Status Codes:
bool vertexIsValid ( MUint64  vertexId,
MStatus ReturnStatus = NULL 
) const

Return true if the vertex is a valid vertex.

Parameters:
[in]vertexIdThe vertex 64-bit name
[out]ReturnStatusStatus 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:
bool vertexIsCreased ( MUint64  vertexId,
MStatus ReturnStatus = NULL 
) const

Return true if the vertex is creased.

Parameters:
[in]vertexIdThe vertex 64-bit name
[out]ReturnStatusStatus code
Returns:
Whether the vertex is creased or not
Status Codes:
bool vertexCreaseRelevant ( MUint64  vertexId,
MStatus ReturnStatus = NULL 
) const

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]vertexIdThe vertex 64-bit name
[out]ReturnStatusStatus code
Returns:
Whether the vertex has relevant crease information
Status Codes:
MStatus vertexSetCrease ( MUint64  vertexId,
bool  creased 
) const

Set the particular vertex' crease state.

Parameters:
[in]vertexIdThe 64-bit name of the vertex
[in]creasedCrease (true) or smooth (false)
Returns:
Status code
Status Codes:
MStatus vertexChildren ( MUint64  vertexId,
MUint64Array children 
) const

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]vertexId64-bit name of the vertex
[out]children64-bit names of the children of this vertex
Returns:
Status code
Status Codes:
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.

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]vertexIdsThe ids of the vertices that are creased
[out]edgeIdsThe ids of the edges that are creased
Returns:
Status code
Status Codes:
MStatus creasesSetAll ( const MUint64Array vertexIds,
const MUint64Array edgeIds 
)

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]vertexIdsThe ids of the vertices that are creased
[in]edgeIdsThe ids of the edges that are creased
Returns:
Status code
Status Codes:
MStatus creasesClearAll ( ) const

Clear all crease information from this surface.

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

Returns:
Status code
Status Codes:
MStatus updateAllEditsAndCreases ( )

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:
unsigned int edgeCount ( int  level = 0,
MStatus ReturnStatus = NULL 
) const

Returns the number of edges at a level.

Parameters:
[in]levelThe level where we're counting the edges
[out]ReturnStatusStatus code
Returns:
Number of edges at the given level
Status Codes:
MUint64 edgeBetween ( MUint64  vertex1,
MUint64  vertex2,
MStatus ReturnStatus = NULL 
) const

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

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

Parameters:
[in]vertex1The name of the first vertex
[in]vertex2The name of the second vertex
[out]ReturnStatusStatus code
Returns:
The name of the edge between the two
Status Codes:
MStatus edgeVertices ( MUint64  edgeId,
MUint64 &  v1,
MUint64 &  v2 
) const

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

Parameters:
[in]edgeIdThe 64-bit edge name
[out]v1First vertex on the edge
[out]v2Second vertex on the edge
Returns:
Status code
Status Codes:
MStatus edgeAdjacentPolygon ( MUint64  edgeId,
MUint64Array polys 
) const

Return the polygons adjacent to this edge.

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

Parameters:
[in]edgeIdThe 64-bit edge name
[out]polysThe 64-bit names of the polygons (1 or 2)
Returns:
Status code
Status Codes:
bool edgeIsBoundary ( MUint64  edgeId,
MStatus ReturnStatus = NULL 
) const

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

Parameters:
[in]edgeIdThe 64-bit edge name
[out]ReturnStatusStatus code
Returns:
True if the edge is a boundary edge, false otherwise.
Status Codes:
bool edgeIsValid ( MUint64  edgeId,
MStatus ReturnStatus = NULL 
) const

Returns true if the specified edge name is valid.

Parameters:
[in]edgeIdThe 64-bit edge name
[out]ReturnStatusStatus code
Returns:
True if the edge name is valid, false otherwise.
Status Codes:
bool edgeIsCreased ( MUint64  edgeId,
MStatus ReturnStatus = NULL 
) const

Return true if the edge is creased.

Parameters:
[in]edgeIdThe 64-bit name of the edge
[out]ReturnStatusStatus code
Returns:
True if the edge is creased, false otherwise
Status Codes:
bool edgeCreaseRelevant ( MUint64  edgeId,
MStatus ReturnStatus = NULL 
) const

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]edgeIdThe edge 64-bit name
[out]ReturnStatusStatus code
Returns:
Whether the edge has relevant crease information
Status Codes:
MStatus edgeSetCrease ( MUint64  edgeId,
bool  creased 
) const

Set the particular edge's crease state.

Parameters:
[in]edgeIdThe 64-bit name of the edge
[in]creasedCrease (true) or smooth (false)
Returns:
Status code
Status Codes:
MStatus edgeChildren ( MUint64  edgeId,
MUint64Array children 
) const

Returns the "children" of the particular edge.

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

Parameters:
[in]edgeId64-bit name of the edge
[out]children64-bit names of the children of this edge
Returns:
Status code
Status Codes:
unsigned int polygonCount ( int  level = 0,
MStatus ReturnStatus = NULL 
) const

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

Parameters:
[in]levelLevel at which we're counting
[out]ReturnStatusStatus code
Returns:
The number of polygons at the specified level
Status Codes:
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.

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

Parameters:
[in]levelThe level where you would be counting
[out]ReturnStatusStatus code
Returns:
The number of polygons at the given level if you were to fully subdivide at that level.
Status Codes:
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.

Parameters:
[in]polyIdThe 64-bit name of the polygon
[out]ReturnStatusStatus code
Returns:
The number of vertices on this polygon
Status Codes:
MStatus polygonVertices ( MUint64  polyId,
MUint64Array vertexIds 
) const

Given the polygon, return its vertices.

The vertices are at the same level as the polygon.

Parameters:
[in]polyIdThe 64-bit name of the polygon
[out]vertexIdsThe 64-bit names of the vertices
Returns:
Status code
Status Codes:
unsigned int polygonEdgeCount ( MUint64  polyId,
MStatus ReturnStatus = NULL 
) const

The number of edges on the given polygon.

Parameters:
[in]polyIdThe 64-bit name of the polygon
[out]ReturnStatusStatus code
Returns:
The number of edges on this polygon
Status Codes:
MStatus polygonEdges ( MUint64  polyId,
MUint64Array edgeIds 
) const

Given the polygon, return its edges.

The edges are at the same level as the polygon.

Parameters:
[in]polyIdThe 64-bit name of the polygon
[out]edgeIdsThe 64-bit names of the edges
Returns:
Status code
Status Codes:
bool polygonIsValid ( MUint64  polygonId,
MStatus ReturnStatus = NULL 
) const

Return true if the polygon is a valid polygon.

Parameters:
[in]polygonIdThe polygon 64-bit name
[out]ReturnStatusStatus 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:
bool polygonHasChildren ( MUint64  polyId,
MStatus ReturnStatus = NULL 
) const

Returns whether or not the given polygon has children.

Parameters:
[in]polyIdThe polygon 64-bit name
[out]ReturnStatusStatus 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

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]polyIdThe 64-bit name of the original polygon
[out]childrenThe 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)

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]polyIdThe 64-bit name of the polygon
Returns:
Status code
Status Codes:
MStatus polygonSetUseUVs ( MUint64  polyId,
bool  useThem 
)

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

Parameters:
[in]polyIdThe 64-bit polygon name
[in]useThemUse the user set UVs
Returns:
Status code
Status Codes:
bool polygonHasVertexUVs ( MUint64  polyId,
MStatus ReturnStatus = NULL 
)

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

Parameters:
[in]polyIdThe 64-bit polygon name
[out]ReturnStatusStatus code
Returns:
True if there were explicitly specified UVs on this polygon.
Status Codes:
MStatus polygonGetVertexUVs ( MUint64  polyId,
MDoubleArray uValues,
MDoubleArray vValues 
) const

Get the vertex UVs from the polygon.

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

Parameters:
[in]polyIdThe 64-bit polygon name
[out]uValuesArray of U values
[out]vValuesArray of V values
Returns:
Status code
Status Codes:
MStatus polygonSetVertexUVs ( MUint64  polyId,
const MDoubleArray uValues,
const MDoubleArray vValues 
)

Set the UV values on the polygon.

Parameters:
[in]polyIdThe 64-bit polygon name
[in]uValuesArray of U values
[in]vValuesArray of V values
Returns:
Status code
Status Codes:
MStatus polygonGetCenterUV ( MUint64  polyId,
double &  u,
double &  v 
) const

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

Parameters:
[in]polyIdThe 64-bit polygon name
[out]uThe resulting U value
[out]vThe resulting V value
Returns:
Status code
Status Codes:
MStatus evaluatePosition ( MUint64  polyId,
double  u,
double  v,
bool  uvNormalized,
MPoint pos 
) const

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]polyIdThe 64-bit polygon name
[in]uU value on the face
[in]vV value on the face
[in]uvNormalizedIf true, its as if U, V are in [0,1]
[out]posThe resulting 3d position
Returns:
Status code
Status Codes:
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.

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

Parameters:
[in]polyIdThe 64-bit polygon name
[in]uU value on the face
[in]vV value on the face
[in]uvNormalizedIf true, its as if U, V are in [0,1]
[out]nrmlThe resulting surface normal
Returns:
Status code
Status Codes:
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.

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

Parameters:
[in]polyIdThe 64-bit polygon name
[in]uU value on the face
[in]vV value on the face
[in]uvNormalizedIf true, its as if U, V are in [0,1]
[out]posThe resulting 3d position
[out]nrmlThe resulting surface normal
Returns:
Status code
Status Codes:
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.

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

Parameters:
[in]polyIdThe 64-bit polygon name
[out]verticespoint array
[out]ReturnStatusStatus code
Returns:
True if we can make the conversion, false otherwise
Status Codes:
MStatus getConnectedSetsAndMembers ( unsigned int  instanceNumber,
MObjectArray sets,
MObjectArray comps,
bool  renderableSetsOnly 
) const

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

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

Parameters:
[in]instanceNumberThe instance number of the mesh to query
[out]setsStorage for the sets
[out]compsStorage for the components that are in the corresponding set
[in]renderableSetsOnlyIf true then this method will only return renderable sets
Returns:
Status code
Status Codes:
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.

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]instanceNumberThe instance number of the subdivision surface to query
[out]shadersStorage for set objects (shader objects)
[out]facesStorage for indices matching faces to indices
[out]indicesStorage for indices matching indices to shaders
Returns:
Status code
Status Codes:
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.

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]uniformUse uniform tesselation if this is set.
[in]depthUsed in the uniform tesselation: how deep do we go
[in]sampleIn both tesselation cases, once we decide which level to tesselate at, how many times do we sample.
[in]parentOrOwnerthe DAG parent or kMeshData the new Mesh will belong to
[out]ReturnStatusStatus 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:
MObject tessellateViaNurbs ( MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

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]parentOrOwnerthe DAG parent or kMeshData the new Mesh will belong to
[out]ReturnStatusStatus 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:
MStatus convertToNurbs ( MObjectArray newNurbsSurfaces)

Converts this surface to a set of nurbs surfaces.

Parameters:
[out]newNurbsSurfacesStorage for the arary of NURBS
Returns:
Status code.
Status Codes:
MStatus updateSubdSurface ( )

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

Returns:
Status code
Status Codes:
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.

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

Parameters:
[in]xX location of the vertex
[in]yY location of the vertex
[in]zZ location of the vertex
[in]indexThe index the vertex is to take
Returns:
Status code
Status Codes:
bool getCubicSpline ( MUint64  polyId,
MPoint  vertices[16],
MStatus ReturnStatus = NULL 
)

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]polyIdThe 64-bit polygon name
[out]vertices16 vertices that define the cubic spline
[out]ReturnStatusStatus code
Returns:
True if we can make the conversion, false otherwise
Status Codes:

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