#include <MFnSubd.h>
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 CatmullClark 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 perpolygon, 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:
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:
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, ... N1. 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.
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) 
MObject  copy (const MObject &source, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) 
MObject  collapse (const int level, bool makeNewNodeInvisible, MStatus *ReturnStatus=NULL) 
int  vertexBaseMeshAdd (double x, double y, double z, MStatus *ReturnStatus=NULL) 
MUint64  polygonBaseMeshAdd (int vertexCount, const int vertexIds[], MStatus *ReturnStatus=NULL) 
MUint64  polygonBaseMeshAddWithUVs (int vertexCount, const int vertexIds[], const double uValues[], const double vValues[], MStatus *ReturnStatus=NULL) 
int  editsPending (MStatus *ReturnStatus=NULL) const 
void  editsUpdateAll (MStatus *ReturnStatus=NULL) 
unsigned int  levelMaxCurrent (MStatus *ReturnStatus=NULL) const 
unsigned int  levelMaxAllowed (MStatus *ReturnStatus=NULL) const 
void  levelFullySubdivideTo (int level, MStatus *ReturnStatus=NULL) 
unsigned int  vertexCount (int level=0, MStatus *ReturnStatus=NULL) const 
MUint64  vertexIdFromBaseVertexIndex (int baseVertexIndex, MStatus *ReturnStatus=NULL) const 
int  vertexBaseIndexFromVertexId (MUint64 vertexId, MStatus *ReturnStatus=NULL) const 
MStatus  vertexEditsGetAllNonBase (MUint64Array &vertexIds, MVectorArray &edits, MSpace::Space space=MSpace::kObject) const 
MStatus  vertexEditsSetAllNonBase (const MUint64Array &vertexIds, const MVectorArray &edits, MSpace::Space space=MSpace::kObject) 
MStatus  vertexEditsClearAllNonBase () 
MStatus  vertexPositionGet (MUint64 vertId, MPoint &position, MSpace::Space space=MSpace::kObject) const 
MStatus  vertexEditGet (MUint64 vertId, MVector &edit, MSpace::Space space=MSpace::kObject) const 
MStatus  vertexPositionGetNoEdit (MUint64 vertId, MPoint &position, MSpace::Space space=MSpace::kObject) const 
MStatus  vertexPositionSet (MUint64 vertId, const MPoint &position, bool updateEdits, MSpace::Space space=MSpace::kObject) 
MStatus  vertexEditSet (MUint64 vertId, const MVector &edit, bool updateEdits, MSpace::Space space=MSpace::kObject) 
MStatus  vertexBaseMeshGet (MPointArray &positions, MSpace::Space space=MSpace::kObject) const 
MStatus  vertexBaseMeshSet (const MPointArray &positions, MSpace::Space space=MSpace::kObject) 
MStatus  vertexBaseMeshGetWithId (MPointArray &positions, MUint64Array &vertexIds, MSpace::Space space=MSpace::kObject) const 
MStatus  vertexBaseMeshSetWithId (const MPointArray &positions, const MUint64Array &vertexIds, MSpace::Space space=MSpace::kObject) 
int  vertexValence (MUint64 vertId, MStatus *ReturnStatus=NULL) const 
MStatus  vertexNormal (MUint64 vertId, MVector &normal) const 
MStatus  vertexAdjacentVertices (MUint64 vertId, MUint64Array &vertList) const 
MStatus  vertexIncidentEdges (MUint64 vertId, MUint64Array &edgeList) const 
MStatus  vertexIncidentPolygons (MUint64 vertId, MUint64Array &polyList) const 
bool  vertexIsBoundary (MUint64 vertId, MStatus *ReturnStatus=NULL) const 
bool  vertexIsValid (MUint64 vertId, MStatus *ReturnStatus=NULL) const 
bool  vertexIsCreased (MUint64 vertId, MStatus *ReturnStatus=NULL) const 
bool  vertexCreaseRelevant (MUint64 vertId, MStatus *ReturnStatus=NULL) const 
MStatus  vertexSetCrease (MUint64 vertId, bool creased) const 
MStatus  vertexChildren (MUint64 vertId, MUint64Array &children) const 
MStatus  creasesGetAll (MUint64Array &vertexIds, MUint64Array &edgeIds) const 
MStatus  creasesSetAll (const MUint64Array &vertexIds, const MUint64Array &edgeIds) 
MStatus  creasesClearAll () const 
MStatus  updateAllEditsAndCreases () 
unsigned int  edgeCount (int level=0, MStatus *ReturnStatus=NULL) const 
MUint64  edgeBetween (MUint64 vertex1, MUint64 vertex2, MStatus *ReturnStatus=NULL) const 
MStatus  edgeVertices (MUint64 edge, MUint64 &v1, MUint64 &v2) const 
MStatus  edgeAdjacentPolygon (MUint64 edge, MUint64Array &polys) const 
bool  edgeIsBoundary (MUint64 edge, MStatus *ReturnStatus=NULL) const 
bool  edgeIsValid (MUint64 edgeId, MStatus *ReturnStatus=NULL) const 
bool  edgeIsCreased (MUint64 edgeId, MStatus *ReturnStatus=NULL) const 
bool  edgeCreaseRelevant (MUint64 edgeId, MStatus *ReturnStatus=NULL) const 
MStatus  edgeSetCrease (MUint64 edgeId, bool creased) const 
MStatus  edgeChildren (MUint64 edgeId, MUint64Array &children) const 
unsigned int  polygonCount (int level=0, MStatus *ReturnStatus=NULL) const 
int  polygonCountMaxWithGivenBaseMesh (int level=1, MStatus *ReturnStatus=NULL) const 
unsigned int  polygonVertexCount (MUint64 polyId, MStatus *ReturnStatus=NULL) const 
MStatus  polygonVertices (MUint64 polyId, MUint64Array &vertIds) const 
unsigned int  polygonEdgeCount (MUint64 polyId, MStatus *ReturnStatus=NULL) const 
MStatus  polygonEdges (MUint64 polyId, MUint64Array &edgeIds) const 
bool  polygonIsValid (MUint64 polyId, MStatus *ReturnStatus=NULL) const 
bool  polygonHasChildren (MUint64 polyId, MStatus *ReturnStatus=NULL) const 
MStatus  polygonChildren (MUint64 polyId, MUint64Array &children) const 
MStatus  polygonSubdivide (MUint64 polyId) 
MStatus  polygonSetUseUVs (MUint64 polyId, bool useThem) 
bool  polygonHasVertexUVs (MUint64 polyId, MStatus *ReturnStatus=NULL) 
MStatus  polygonGetVertexUVs (MUint64 polyId, MDoubleArray &uValues, MDoubleArray &vValues) const 
MStatus  polygonSetVertexUVs (MUint64 polyId, const MDoubleArray &uValues, const MDoubleArray &vValues) 
MStatus  polygonGetCenterUV (MUint64 polyId, double &u, double &v) const 
MStatus  evaluatePosition (MUint64 polyId, double u, double v, bool uvNormalized, MPoint &) const 
MStatus  evaluateNormal (MUint64 polyId, double u, double v, bool uvNormalized, MVector &nrml) const 
MStatus  evaluatePositionAndNormal (MUint64 polyId, double u, double v, bool uvNormalized, MPoint &pos, MVector &nrml) const 
bool  getCubicSpline (MUint64 polyId, MPointArray vertices, MStatus *ReturnStatus=NULL) 
MStatus  getConnectedSetsAndMembers (unsigned int instanceNumber, MObjectArray &sets, MObjectArray &comps, bool renderableSetsOnly) const 
MStatus  getConnectedShaders (unsigned int instanceNumber, MObjectArray &shaders, MUint64Array &faces, MIntArray &indices) const 
MObject  tesselate (bool uniform, int depth, int sample, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) 
MObject  tessellateViaNurbs (MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL) 
MStatus  convertToNurbs (MObjectArray &newNurbsSurfaces) 
MStatus  updateSubdSurface () 
MStatus  vertexBaseMeshAddWithIndex (double x, double y, double z, int index) 
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. 
MFnSubd::~MFnSubd  (  )  [virtual] 
Destructor.
Class destructor.
Constructor.
Class constructor that initializes the function set to the given MObject.
[in]  object  The MObject to attach the function set to 
[out]  ReturnStatus  the return status 
Constructor.
Class constructor that initializes the function set to the given constant MDagPath object.
[in]  object  The const MDagPath to attach the function set to 
[out]  ReturnStatus  The return status 
Constructor.
Class constructor that initializes the function set to the given MObject.
[in]  object  The MObject to attach the function set to 
[out]  ReturnStatus  the return status 
MFn::Type MFnSubd::type  (  )  const [virtual] 
const char * MFnSubd::className  (  )  const [protected, virtual] 
MObject MFnSubd::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.
[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 
MObject MFnSubd::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.
[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 
MObject MFnSubd::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.
[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 
int MFnSubd::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 64bit name until you actually create a polygon that holds it.
[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 
MUint64 MFnSubd::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 64bit names only after they have been added to a polygon).
[in]  vertexCount  Number of vertices in the polygon 
[in]  vertexIndex  The vertex indices (0, 1, 2, ...) 
[out]  ReturnStatus  Status code 
MUint64 MFnSubd::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 64bit names only after they have been added to a polygon). Specify the UV values as well.
[in]  vertexCount  Number of vertices in the polygon 
[in]  vertexIds  The vertex indices (0, 1, 2, ...) 
[out]  ReturnStatus  Status code 
int MFnSubd::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.
[out]  ReturnStatus  Status code 
void MFnSubd::editsUpdateAll  (  MStatus *  ReturnStatus = NULL 
) 
If there are pending edits, this function will update the surface so that there are no pending edits.
[out]  ReturnStatus  Status code 
unsigned int MFnSubd::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.
[out]  ReturnStatus  Status code 
unsigned int MFnSubd::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.
[out]  ReturnStatus  Status code 
void MFnSubd::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.
[in]  level  The level to which to fully subdivide 
[out]  ReturnStatus  Status code 
unsigned int MFnSubd::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.
[in]  level  The level we are interested in 
[out]  ReturnStatus  Status code 
MUint64 MFnSubd::vertexIdFromBaseVertexIndex  (  int  baseVertexIndex,  
MStatus *  ReturnStatus = NULL  
)  const 
Vertices are named using 64bit integers. The base mesh vertices will also have a simple 0, 1, 2, N1 indices. Use this function to compute the proper 64bit name using the 0, 1, 2, ... indices.
[in]  baseVertexIndex  The index in the base mesh vertex array of this vertex 
[out]  ReturnStatus  Status code 
int MFnSubd::vertexBaseIndexFromVertexId  (  MUint64  vertexId,  
MStatus *  ReturnStatus = NULL  
)  const 
Given a 64bit 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.
[in]  vertexId  The 64bit name of the vertex 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::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.
[in]  vertexIds  The names of the vertices 
[in]  edits  The offsets from the original position 
[in]  space  Specifies the coordinate system for this operation 
MStatus MFnSubd::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.
[in]  vertexIds  The names of the vertices 
[in]  edits  The offsets from the original positions 
[in]  space  Specifies the coordinate system for this operation 
MStatus MFnSubd::vertexEditsClearAllNonBase  (  ) 
Find all vertices with edits and remove those edits, setting them back to their original position.
MStatus MFnSubd::vertexPositionGet  (  MUint64  vertexId,  
MPoint &  position,  
MSpace::Space  space = MSpace::kObject  
)  const 
Get the position of the vertex with a given name.
[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 
MStatus MFnSubd::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().
[in]  vertexId  The name of the vertex 
[out]  edit  The offset in object space 
[in]  space  Specifies the coordinate system for this operation 
MStatus MFnSubd::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.
[in]  vertexId  The name of the vertex 
[out]  position  The original position 
[in]  space  Specifies the coordinate system for this operation 
MStatus MFnSubd::vertexPositionSet  (  MUint64  vertexId,  
const MPoint &  position,  
bool  updateEdits,  
MSpace::Space  space = MSpace::kObject  
) 
Set the position of the vertex with a given name.
[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 
MStatus MFnSubd::vertexEditSet  (  MUint64  vertexId,  
const MVector &  edit,  
bool  updateEdits,  
MSpace::Space  space = MSpace::kObject  
) 
Set the original position offset for the given vertex.
[in]  vertexId  The name of the vertex 
[out]  edit  The offset from the original 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. 
MStatus MFnSubd::vertexBaseMeshGet  (  MPointArray &  positions,  
MSpace::Space  space = MSpace::kObject  
)  const 
Return all base mesh vertices in the array using their indices (not the 64bit names).
[out]  positions  The array of point positions 
[in]  space  Specifies the coordinate system for this operation 
MStatus MFnSubd::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 64bit vertex names.
[out]  positions  The positions for the vertices 
[in]  space  Specifies the coordinate system for this operation 
MStatus MFnSubd::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 64bit names.
[out]  positions  The array of point positions 
[out]  vertexIds  The vertex 64bit ids 
[in]  space  The space we are working in 
MStatus MFnSubd::vertexBaseMeshSetWithId  (  const MPointArray &  positions,  
const MUint64Array &  vertexIds,  
MSpace::Space  space = MSpace::kObject  
) 
Set the positions for the base mesh vertices using the 64bit 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).
[out]  positions  The positions for the vertices 
[out]  vertexIds  The vertex 64bit ids 
[in]  space  The space we are working in 
int MFnSubd::vertexValence  (  MUint64  vertexId,  
MStatus *  ReturnStatus = NULL  
)  const 
Returns the valence (number of incident edges) of the given vertex.
[in]  vertexId  The vertex 64bit id 
[out]  ReturnStatus  Status code 
Returns the normal at the vertex
[in]  vertexId  The vertex 64bit ID. 
[out]  normal  The value of the normal 
MStatus MFnSubd::vertexAdjacentVertices  (  MUint64  vertexId,  
MUint64Array &  vertList  
)  const 
Return the list of adjacent vertices as their 64bit ids.
[in]  vertexId  The vertex 64bit name 
[out]  vertList  The resulting list of adjacent vertices 
MStatus MFnSubd::vertexIncidentEdges  (  MUint64  vertexId,  
MUint64Array &  edgeList  
)  const 
Return the list of incident edges as their 64bit ids.
[in]  vertexId  The vertex 64bit name 
[out]  edgeList  The resulting list of incident edges 
MStatus MFnSubd::vertexIncidentPolygons  (  MUint64  vertexId,  
MUint64Array &  polyList  
)  const 
Return the list of incident polygons as their 64bit ids.
[in]  vertexId  The vertex 64bit name 
[out]  polyList  The resulting list of incident polygons 
bool MFnSubd::vertexIsBoundary  (  MUint64  vertexId,  
MStatus *  ReturnStatus = NULL  
)  const 
Return true if the vertex is a boundary vertex.
[in]  vertexId  The vertex 64bit name 
[out]  ReturnStatus  Status code 
bool MFnSubd::vertexIsValid  (  MUint64  vertexId,  
MStatus *  ReturnStatus = NULL  
)  const 
Return true if the vertex is a valid vertex.
[in]  vertexId  The vertex 64bit name 
[out]  ReturnStatus  Status code 
bool MFnSubd::vertexIsCreased  (  MUint64  vertexId,  
MStatus *  ReturnStatus = NULL  
)  const 
Return true if the vertex is creased.
[in]  vertexId  The vertex 64bit name 
[out]  ReturnStatus  Status code 
bool MFnSubd::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).
[in]  vertexId  The vertex 64bit name 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::vertexSetCrease  (  MUint64  vertexId,  
bool  creased  
)  const 
Set the particular vertex' crease state.
[in]  vertexId  The 64bit name of the vertex 
[in]  creased  Crease (true) or smooth (false) 
MStatus MFnSubd::vertexChildren  (  MUint64  vertexId,  
MUint64Array &  children  
)  const 
Returns the "children" of the particular vertex if they exist. The children are defined as the finerlevel 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.
[in]  vertexId  64bit name of the vertex 
[out]  children  64bit names of the children of this vertex 
MStatus MFnSubd::creasesGetAll  (  MUint64Array &  vertexIds,  
MUint64Array &  edgeIds  
)  const 
Returns all creases on the subdivision surface in two arrays of 64bit 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 noncreased 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.
[out]  vertexIds  The ids of the vertices that are creased 
[out]  edgeIds  The ids of the edges that are creased 
MStatus MFnSubd::creasesSetAll  (  const MUint64Array &  vertexIds,  
const MUint64Array &  edgeIds  
) 
Set the creases on all vertices and edges with a given 64bit name. Note that the combination of creasesGetAll() and creasesSetAll() will not exactly duplicate the crease information between two surfaces.
[in]  vertexIds  The ids of the vertices that are creased 
[in]  edgeIds  The ids of the edges that are creased 
MStatus MFnSubd::creasesClearAll  (  )  const 
Clear all crease information from this surface. No vertices or edges will be creased after this function completes.
MStatus MFnSubd::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.
unsigned int MFnSubd::edgeCount  (  int  level = 0 , 

MStatus *  ReturnStatus = NULL  
)  const 
Returns the number of edges at a level.
[in]  level  The level where we're counting the edges 
[out]  ReturnStatus  Status code 
MUint64 MFnSubd::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.
[in]  vertex1  The name of the first vertex 
[in]  vertex2  The name of the second vertex 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::edgeVertices  (  MUint64  edgeId,  
MUint64 &  v1,  
MUint64 &  v2  
)  const 
Given an edge, return the two vertices at its ends.
[in]  edgeId  The 64bit edge name 
[out]  v1  First vertex on the edge 
[out]  v2  Second vertex on the edge 
MStatus MFnSubd::edgeAdjacentPolygon  (  MUint64  edgeId,  
MUint64Array &  polys  
)  const 
Return the polygons adjacent to this edge. There can be at most two, as nonmanifold topology is not allowed.
[in]  edgeId  The 64bit edge name 
[out]  polys  The 64bit names of the polygons (1 or 2) 
bool MFnSubd::edgeIsBoundary  (  MUint64  edgeId,  
MStatus *  ReturnStatus = NULL  
)  const 
Test if the edge specified is a boundary edge or not.
[in]  edgeId  The 64bit edge name 
[out]  ReturnStatus  Status code 
bool MFnSubd::edgeIsValid  (  MUint64  edgeId,  
MStatus *  ReturnStatus = NULL  
)  const 
Returns true if the specified edge name is valid.
[in]  edgeId  The 64bit edge name 
[out]  ReturnStatus  Status code 
bool MFnSubd::edgeIsCreased  (  MUint64  edgeId,  
MStatus *  ReturnStatus = NULL  
)  const 
Return true if the edge is creased.
[in]  edgeId  The 64bit name of the edge 
[out]  ReturnStatus  Status code 
bool MFnSubd::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).
[in]  edgeId  The edge 64bit name 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::edgeSetCrease  (  MUint64  edgeId,  
bool  creased  
)  const 
Set the particular edge's crease state.
[in]  edgeId  The 64bit name of the edge 
[in]  creased  Crease (true) or smooth (false) 
MStatus MFnSubd::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.
[in]  edgeId  64bit name of the edge 
[out]  children  64bit names of the children of this edge 
unsigned int MFnSubd::polygonCount  (  int  level = 0 , 

MStatus *  ReturnStatus = NULL  
)  const 
Returns the number of polygons currently existing at the specified level of the hierarchy.
[in]  level  Level at which we're counting 
[out]  ReturnStatus  Status code 
int MFnSubd::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.
[in]  level  The level where you would be counting 
[out]  ReturnStatus  Status code 
unsigned int MFnSubd::polygonVertexCount  (  MUint64  polyId,  
MStatus *  ReturnStatus = NULL  
)  const 
How many vertices on a given polygon? The vertices are at the same level as the polygon.
[in]  polyId  The 64bit name of the polygon 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::polygonVertices  (  MUint64  polyId,  
MUint64Array &  vertexIds  
)  const 
Given the polygon, return its vertices. The vertices are at the same level as the polygon.
[in]  polyId  The 64bit name of the polygon 
[out]  vertexIds  The 64bit names of the vertices 
unsigned int MFnSubd::polygonEdgeCount  (  MUint64  polyId,  
MStatus *  ReturnStatus = NULL  
)  const 
The number of edges on the given polygon.
[in]  polyId  The 64bit name of the polygon 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::polygonEdges  (  MUint64  polyId,  
MUint64Array &  edgeIds  
)  const 
Given the polygon, return its edges. The edges are at the same level as the polygon.
[in]  polyId  The 64bit name of the polygon 
[out]  edgeIds  The 64bit names of the edges 
bool MFnSubd::polygonIsValid  (  MUint64  polygonId,  
MStatus *  ReturnStatus = NULL  
)  const 
Return true if the polygon is a valid polygon.
[in]  polygonId  The polygon 64bit name 
[out]  ReturnStatus  Status code 
bool MFnSubd::polygonHasChildren  (  MUint64  polyId,  
MStatus *  ReturnStatus = NULL  
)  const 
Returns whether or not the given polygon has children.
[in]  polyId  The polygon 64bit name 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::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.
[in]  polyId  The 64bit name of the original polygon 
[out]  children  The 64bit name of the child polygons 
MStatus MFnSubd::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).
[in]  polyId  The 64bit name of the polygon 
MStatus MFnSubd::polygonSetUseUVs  (  MUint64  polyId,  
bool  useThem  
) 
If this is set, the polygon will use the user specified UVs.
[in]  polyId  The 64bit polygon name 
[in]  useThem  Use the user set UVs 
bool MFnSubd::polygonHasVertexUVs  (  MUint64  polyId,  
MStatus *  ReturnStatus = NULL  
) 
Returns true if there are user specified UVs on this polygon.
[in]  polyId  The 64bit polygon name 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::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.
[in]  polyId  The 64bit polygon name 
[out]  uValues  Array of U values 
[out]  vValues  Array of V values 
MStatus MFnSubd::polygonSetVertexUVs  (  MUint64  polyId,  
const MDoubleArray &  uValues,  
const MDoubleArray &  vValues  
) 
Set the UV values on the polygon.
[in]  polyId  The 64bit polygon name 
[in]  uValues  Array of U values 
[in]  vValues  Array of V values 
MStatus MFnSubd::polygonGetCenterUV  (  MUint64  polyId,  
double &  u,  
double &  v  
)  const 
Return the UV values in the "center" of this polygon.
[in]  polyId  The 64bit polygon name 
[out]  u  The resulting U value 
[out]  v  The resulting V value 
MStatus MFnSubd::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.
[in]  polyId  The 64bit 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 
MStatus MFnSubd::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.
[in]  polyId  The 64bit 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 
MStatus MFnSubd::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.
[in]  polyId  The 64bit 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 
bool MFnSubd::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 bicubic Bsplines. This routine will return the 16 points that define such spline.
[in]  polyId  The 64bit polygon name 
[out]  vertices  point array 
[out]  ReturnStatus  Status code 
MStatus MFnSubd::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.
[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 
MStatus MFnSubd::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 64bit 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.
[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 
MObject MFnSubd::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^(depth1) * sample^2 triangles in the uniform case, so be careful as to how you choose these 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 
MObject MFnSubd::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^(depth1) * sample^2 triangles in the uniform case, so be careful as to how you choose these parameters.
[in]  parentOrOwner  the DAG parent or kMeshData the new Mesh will belong to 
[out]  ReturnStatus  Status Code 
MStatus MFnSubd::convertToNurbs  (  MObjectArray &  newNurbsSurfaces  ) 
Converts this surface to a set of nurbs surfaces.
[out]  newNurbsSurfaces  Storage for the arary of NURBS 
MStatus MFnSubd::updateSubdSurface  (  ) 
Signal that this subdivision surface has changed and needs to redraw itself.
MStatus MFnSubd::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, ... N1 for N total vertices.
[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 
NO SCRIPT SUPPORT.
Some of the faces (usually at level 2 or below) happen to be exactly the same as uniform bicubic Bsplines. This routine will return the 16 points that define such spline.
[in]  polyId  The 64bit polygon name 
[out]  vertices  16 vertices that define the cubic spline 
[out]  ReturnStatus  Status code 
Autodesk® Maya® 2009 © 19972008 Autodesk, Inc. All rights reserved.  Generated with 1.5.6 