C++ API Reference

Subdivision surface function set. More...

#include <MFnSubd.h>

+ Inheritance diagram for MFnSubd:

Public Member Functions

virtual MFn::Type type () const
 Function set type. More...
 
virtual ~MFnSubd ()
 Destructor. More...
 
 MFnSubd ()
 Default constructor.
 
 MFnSubd (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MFnSubd (const MDagPath &object, MStatus *ret=NULL)
 Constructor. More...
 
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. More...
 
MObject copy (const MObject &source, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method creates a copy of a given source subdivision surface. More...
 
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. More...
 
int vertexBaseMeshAdd (double x, double y, double z, MStatus *ReturnStatus=NULL)
 Add a vertex to the base mesh and return its "index" name. More...
 
MUint64 polygonBaseMeshAdd (int vertexCount, const int vertexIds[], MStatus *ReturnStatus=NULL)
 Add a polygon at the base mesh level. More...
 
MUint64 polygonBaseMeshAddWithUVs (int vertexCount, const int vertexIds[], const double uValues[], const double vValues[], MStatus *ReturnStatus=NULL)
 Add a polygon at the base mesh level. More...
 
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. More...
 
void editsUpdateAll (MStatus *ReturnStatus=NULL)
 If there are pending edits, this function will update the surface so that there are no pending edits. More...
 
unsigned int levelMaxCurrent (MStatus *ReturnStatus=NULL) const
 Returns the finest level that currently exist. More...
 
unsigned int levelMaxAllowed (MStatus *ReturnStatus=NULL) const
 Returns the maximum level that can be created. More...
 
void levelFullySubdivideTo (int level, MStatus *ReturnStatus=NULL)
 Fully subdivide the whole surface to the specified level. More...
 
unsigned int vertexCount (int level=0, MStatus *ReturnStatus=NULL) const
 Returns the finest vertex count at a particular level. More...
 
MUint64 vertexIdFromBaseVertexIndex (int baseVertexIndex, MStatus *ReturnStatus=NULL) const
 Vertices are named using 64-bit integers. More...
 
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. More...
 
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). More...
 
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. More...
 
MStatus vertexEditsClearAllNonBase ()
 Find all vertices with edits and remove those edits, setting them back to their original position. More...
 
MStatus vertexPositionGet (MUint64 vertId, MPoint &position, MSpace::Space space=MSpace::kObject) const
 Get the position of the vertex with a given name. More...
 
MStatus vertexEditGet (MUint64 vertId, MVector &edit, MSpace::Space space=MSpace::kObject) const
 Get the offset of the specified vertex from its original position. More...
 
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. More...
 
MStatus vertexPositionSet (MUint64 vertId, const MPoint &position, bool updateEdits, MSpace::Space space=MSpace::kObject)
 Set the position of the vertex with a given name. More...
 
MStatus vertexEditSet (MUint64 vertId, const MVector &edit, bool updateEdits, MSpace::Space space=MSpace::kObject)
 Set the original position offset for the given vertex. More...
 
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). More...
 
MStatus vertexBaseMeshSet (const MPointArray &positions, MSpace::Space space=MSpace::kObject)
 Set the positions for the base mesh vertices using the 0, 1,... More...
 
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. More...
 
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. More...
 
int vertexValence (MUint64 vertId, MStatus *ReturnStatus=NULL) const
 Returns the valence (number of incident edges) of the given vertex. More...
 
MStatus vertexNormal (MUint64 vertId, MVector &normal) const
 Returns the normal at the vertex. More...
 
MStatus vertexAdjacentVertices (MUint64 vertId, MUint64Array &vertList) const
 Return the list of adjacent vertices as their 64-bit ids. More...
 
MStatus vertexIncidentEdges (MUint64 vertId, MUint64Array &edgeList) const
 Return the list of incident edges as their 64-bit ids. More...
 
MStatus vertexIncidentPolygons (MUint64 vertId, MUint64Array &polyList) const
 Return the list of incident polygons as their 64-bit ids. More...
 
bool vertexIsBoundary (MUint64 vertId, MStatus *ReturnStatus=NULL) const
 Return true if the vertex is a boundary vertex. More...
 
bool vertexIsValid (MUint64 vertId, MStatus *ReturnStatus=NULL) const
 Return true if the vertex is a valid vertex. More...
 
bool vertexIsCreased (MUint64 vertId, MStatus *ReturnStatus=NULL) const
 Return true if the vertex is creased. More...
 
bool vertexCreaseRelevant (MUint64 vertId, MStatus *ReturnStatus=NULL) const
 Return true if the crease of the vertex is a relevant piece of information. More...
 
MStatus vertexSetCrease (MUint64 vertId, bool creased) const
 Set the particular vertex' crease state. More...
 
MStatus vertexChildren (MUint64 vertId, MUint64Array &children) const
 Returns the "children" of the particular vertex if they exist. More...
 
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. More...
 
MStatus creasesSetAll (const MUint64Array &vertexIds, const MUint64Array &edgeIds)
 Set the creases on all vertices and edges with a given 64-bit name. More...
 
MStatus creasesClearAll () const
 Clear all crease information from this surface. More...
 
MStatus updateAllEditsAndCreases ()
 If you have been editing offsets without updating the surface, this function will save you. More...
 
unsigned int edgeCount (int level=0, MStatus *ReturnStatus=NULL) const
 Returns the number of edges at a level. More...
 
MUint64 edgeBetween (MUint64 vertex1, MUint64 vertex2, MStatus *ReturnStatus=NULL) const
 Return the name of the edge that connects the two vertices. More...
 
MStatus edgeVertices (MUint64 edge, MUint64 &v1, MUint64 &v2) const
 Given an edge, return the two vertices at its ends. More...
 
MStatus edgeAdjacentPolygon (MUint64 edge, MUint64Array &polys) const
 Return the polygons adjacent to this edge. More...
 
bool edgeIsBoundary (MUint64 edge, MStatus *ReturnStatus=NULL) const
 Test if the edge specified is a boundary edge or not. More...
 
bool edgeIsValid (MUint64 edgeId, MStatus *ReturnStatus=NULL) const
 Returns true if the specified edge name is valid. More...
 
bool edgeIsCreased (MUint64 edgeId, MStatus *ReturnStatus=NULL) const
 Return true if the edge is creased. More...
 
bool edgeCreaseRelevant (MUint64 edgeId, MStatus *ReturnStatus=NULL) const
 Return true if the crease of the edge is a relevant piece of information. More...
 
MStatus edgeSetCrease (MUint64 edgeId, bool creased) const
 Set the particular edge's crease state. More...
 
MStatus edgeChildren (MUint64 edgeId, MUint64Array &children) const
 Returns the "children" of the particular edge. More...
 
unsigned int polygonCount (int level=0, MStatus *ReturnStatus=NULL) const
 Returns the number of polygons currently existing at the specified level of the hierarchy. More...
 
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. More...
 
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. More...
 
MStatus polygonVertices (MUint64 polyId, MUint64Array &vertIds) const
 Given the polygon, return its vertices. More...
 
unsigned int polygonEdgeCount (MUint64 polyId, MStatus *ReturnStatus=NULL) const
 The number of edges on the given polygon. More...
 
MStatus polygonEdges (MUint64 polyId, MUint64Array &edgeIds) const
 Given the polygon, return its edges. More...
 
bool polygonIsValid (MUint64 polyId, MStatus *ReturnStatus=NULL) const
 Return true if the polygon is a valid polygon. More...
 
bool polygonHasChildren (MUint64 polyId, MStatus *ReturnStatus=NULL) const
 Returns whether or not the given polygon has children. More...
 
MStatus polygonChildren (MUint64 polyId, MUint64Array &children) const
 Returns the list of children polygons on the given polygon. More...
 
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). More...
 
MStatus polygonSetUseUVs (MUint64 polyId, bool useThem)
 If this is set, the polygon will use the user specified UVs. More...
 
bool polygonHasVertexUVs (MUint64 polyId, MStatus *ReturnStatus=NULL)
 Returns true if there are user specified UVs on this polygon. More...
 
MStatus polygonGetVertexUVs (MUint64 polyId, MDoubleArray &uValues, MDoubleArray &vValues) const
 Get the vertex UVs from the polygon. More...
 
MStatus polygonSetVertexUVs (MUint64 polyId, const MDoubleArray &uValues, const MDoubleArray &vValues)
 Set the UV values on the polygon. More...
 
MStatus polygonGetCenterUV (MUint64 polyId, double &u, double &v) const
 Return the UV values in the "center" of this polygon. More...
 
MStatus evaluatePosition (MUint64 polyId, double u, double v, bool uvNormalized, MPoint &) const
 Evaluate the surface position at the given parameter point on the polygon. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
MObject tessellateViaNurbs (MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Performs tesselation on this surface and create a new mesh in the DAG. More...
 
MStatus convertToNurbs (MObjectArray &newNurbsSurfaces)
 Converts this surface to a set of nurbs surfaces. More...
 
MStatus updateSubdSurface ()
 Signal that this subdivision surface has changed and needs to redraw itself. More...
 
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. More...
 
 MFnSubd (const MObject &object, MStatus *ret=NULL)
 Constructor. More...
 
bool getCubicSpline (MUint64 polyId, MPoint vertices[16], MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT. More...
 
- Public Member Functions inherited from MFnDagNode
virtual ~MFnDagNode ()
 Destructor. More...
 
 MFnDagNode ()
 Class Constructor. More...
 
 MFnDagNode (MObject &object, MStatus *ret=NULL)
 This method is not available in Python. More...
 
 MFnDagNode (const MDagPath &object, MStatus *ret=NULL)
 Class Constructor. More...
 
MObject create (const MTypeId &typeId, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new DAG node with the given type tag. More...
 
MObject create (const MTypeId &typeId, const MString &name, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new DAG node with the given type tag. More...
 
MObject create (const MString &type, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new DAG node with the given type tag. More...
 
MObject create (const MString &type, const MString &name, MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a new DAG node with the given type tag. More...
 
unsigned int parentCount (MStatus *ReturnStatus=NULL) const
 Determines the number of parent Nodes of the Node. More...
 
MObject parent (unsigned int i, MStatus *ReturnStatus=NULL) const
 Queries the DAG Node attached to the Function Set for the parent Node corresponding to the given index. More...
 
MStatus addChild (MObject &child, unsigned int index=kNextPos, bool keepExistingParents=false)
 Makes the given DAG Node a child of the DAG Node to which this instance of the Function Set is attached. More...
 
MStatus removeChild (MObject &child)
 Removes the given DAG Node from the parent. More...
 
MStatus removeChildAt (unsigned int index)
 Removes the child at the given index from the parent. More...
 
unsigned int childCount (MStatus *ReturnStatus=NULL) const
 Determines the number of child Nodes of the Node. More...
 
MObject child (unsigned int i, MStatus *ReturnStatus=NULL) const
 Queries the DAG Node attached to the Function Set for the child Node corresponding to the given index. More...
 
MObject dagRoot (MStatus *ReturnStatus=NULL)
 Determines the root of the first DAG Path to the DAG Node attached to the Function Set. More...
 
bool hasParent (const MObject &node, MStatus *ReturnStatus=NULL) const
 Determines whether or not the given Node is a parent of the DAG Node attached to the Function Set. More...
 
bool hasChild (const MObject &node, MStatus *ReturnStatus=NULL) const
 Determines whether or not the given Node is a child of the DAG Node attached to the Function Set. More...
 
bool isChildOf (const MObject &node, MStatus *ReturnStatus=NULL) const
 Determines whether or not the DAG Node attached to the Function Set is a child of the given node. More...
 
bool isParentOf (const MObject &node, MStatus *ReturnStatus=NULL) const
 Determines whether or not the DAG Node attached to the Function Set is a parent of the given node. More...
 
bool inUnderWorld (MStatus *ReturnStatus=NULL) const
 Determines whether or not the DAG Node is an underworld node. More...
 
bool inModel (MStatus *ReturnStatus=NULL) const
 Determines whether or not the DAG Node is in the model. More...
 
bool isInstanceable (MStatus *ReturnStatus=NULL) const
 Returns true if the DAG node can be instanced, and false otherwise. More...
 
MStatus setInstanceable (const bool how)
 Sets whether or not the DAG node is instanceable. More...
 
bool isInstanced (bool indirect=true, MStatus *ReturnStatus=NULL) const
 Determines whether the DAG Node attached to the Function Set is directly or indirectly instanced. More...
 
bool isInstancedAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Returns true if the specified attribute is instanced. More...
 
unsigned int instanceCount (bool total, MStatus *ReturnStatus=NULL) const
 Determines the number of times the Node attached to the Function Set is instanced. More...
 
MObject duplicate (bool instance=false, bool instanceLeaf=false, MStatus *ReturnStatus=NULL) const
 This method duplicates the DAG hierarchy rooted at the current node. More...
 
MStatus getPath (MDagPath &path) const
 Returns a DAG Path to the DAG Node attached to the Function Set. More...
 
MStatus getAllPaths (MDagPathArray &paths) const
 Determines all DAG Paths to the DAG Node attached to the Function Set. More...
 
MString fullPathName (MStatus *ReturnStatus=NULL) const
 Return a string representing the full path from the root of the dag to this object. More...
 
MString partialPathName (MStatus *ReturnStatus=NULL) const
 Return a string representing the partial path from the root of the dag to this object. More...
 
MMatrix transformationMatrix (MStatus *ReturnStatus=NULL) const
 Returns the object space transformation matrix for this DAG node. More...
 
bool isIntermediateObject (MStatus *ReturnStatus=NULL) const
 Returns true if this object is an intermediate in a geometry calculation. More...
 
MStatus setIntermediateObject (bool isIntermediate)
 Sets whether this object is an intermediate in a geometry calculation. More...
 
int objectColor (MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MStatus setObjectColor (int color)
 Sets the index for the current user defined inactive color used by the node. More...
 
bool usingObjectColor (MStatus *ReturnStatus=NULL) const
 
MStatus setUseObjectColor (bool useObjectColor)
 This method is obsolete. More...
 
MObjectColorType objectColorType (MStatus *ReturnStatus=NULL) const
 Determines whether or not the user defined inactive color will be used for the node, or whether the default inactive color will be used. More...
 
MStatus setObjectColorType (MObjectColorType type)
 Sets whether or not the user defined inactive object color will be used. More...
 
MStatus setObjectColor (const MColor &color)
 Sets the color value for the current user defined inactive color used by the node. More...
 
MColor objectColorRGB (MStatus *ReturnStatus=NULL) const
 Determines the RGB color for the current user defined inactive color used by the node. More...
 
int objectColorIndex (MStatus *ReturnStatus=NULL) const
 Determines the index for the current user defined inactive color used by the node. More...
 
MColor hiliteColor (MStatus *ReturnStatus=NULL) const
 Determines the current hilite color used by the node. More...
 
bool usingHiliteColor (MStatus *ReturnStatus=NULL) const
 Determines whether or not the hilite color will be used for the node. More...
 
MColor dormantColor (MStatus *ReturnStatus=NULL) const
 Determines the dormant color used by this node. More...
 
MColor activeColor (MStatus *ReturnStatus=NULL) const
 Determines the active color used by this node. More...
 
bool drawOverrideEnabled (MStatus *ReturnStatus=NULL) const
 Determines whether or not draw override is turned on for this node. More...
 
bool drawOverrideIsReference (MStatus *ReturnStatus=NULL) const
 Determines whether or not Display Type of the draw override is Reference for this node. More...
 
bool drawOverrideIsTemplate (MStatus *ReturnStatus=NULL) const
 Determines whether or not Display Type of the draw override is Template for this node. More...
 
bool drawOverrideColor (MColor &color, MStatus *ReturnStatus=NULL) const
 Determines the draw override color used by this node. More...
 
MStatus getConnectedSetsAndMembers (unsigned int instanceNumber, MObjectArray &sets, MObjectArray &comps, bool renderableSetsOnly) const
 Returns all the sets connected to the specified instance of this DAG object. More...
 
MBoundingBox boundingBox (MStatus *ReturnStatus=NULL) const
 Returns the bounding box for the dag node in object space. More...
 
MDagPath dagPath (MStatus *ReturnStatus=NULL) const
 Returns the DagPath to which the Function Set is attached. More...
 
virtual MStatus setObject (const MDagPath &path)
 Attaches Function Set to the DAG Node that has the given DAG Path. More...
 
virtual MStatus setObject (MObject &object)
 Attaches Function Set to given DAG Node. More...
 
MObject model (MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
 MFnDagNode (const MObject &object, MStatus *ret=NULL)
 No script support. More...
 
virtual MStatus setObject (const MObject &object)
 No script support. More...
 
- Public Member Functions inherited from MFnDependencyNode
virtual ~MFnDependencyNode ()
 Destructor.
 
 MFnDependencyNode ()
 Default constructor.
 
 MFnDependencyNode (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
MObject create (const MTypeId &typeId, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type tag. More...
 
MObject create (const MTypeId &typeId, const MString &name, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type tag. More...
 
MObject create (const MString &type, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type. More...
 
MObject create (const MString &type, const MString &name, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type. More...
 
MTypeId typeId (MStatus *ReturnStatus=NULL) const
 Returns the type id of this node. More...
 
MString typeName (MStatus *ReturnStatus=NULL) const
 Returns the type name of this node. More...
 
MString name (MStatus *ReturnStatus=NULL) const
 Returns the name of this node. More...
 
MString absoluteName (MStatus *ReturnStatus=NULL) const
 Returns the absolute name of this node. More...
 
MString pluginName (MStatus *ReturnStatus=NULL) const
 Returns the name of the plug-in this MFnDependendencyNode was defined in. More...
 
MString setName (const MString &name, bool createNamespace=false, MStatus *ReturnStatus=NULL)
 Sets the name of this node. More...
 
MUuid uuid (MStatus *ReturnStatus=NULL) const
 Returns the node's UUID. More...
 
void setUuid (const MUuid &uuid, MStatus *ReturnStatus=NULL)
 Sets the node's UUID. More...
 
MStatus getConnections (MPlugArray &array) const
 Get all of the current connections to this node as an array of plugs. More...
 
unsigned int attributeCount (MStatus *ReturnStatus=NULL) const
 Returns the number of attributes that this node has. More...
 
MObject attribute (unsigned int index, MStatus *ReturnStatus=NULL) const
 Finds the attribute of this node at the given index. More...
 
MObject reorderedAttribute (unsigned int index, MStatus *ReturnStatus=NULL) const
 Some nodes, such as the various animCurve nodes, require that their attributes be set in a specific order for proper operation. More...
 
MObject attribute (const MString &attrName, MStatus *ReturnStatus=NULL) const
 Finds the attribute of this node that has the given name. More...
 
MAttrClass attributeClass (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Returns the class (normal, dynamic, extension) of the specified attribute. More...
 
MStatus getAffectedAttributes (const MObject &attr, MObjectArray &affectedAttributes) const
 Returns an array of attributes that are affected by the attribute passed in. More...
 
MStatus getAffectedByAttributes (const MObject &attr, MObjectArray &affectedByAttributes) const
 Returns an array of attributes that affect the attribute passed in, attr. More...
 
MPlug findPlug (const MObject &attr, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const
 Attempt to find a plug for the given attribute. More...
 
MPlug findPlug (const MString &attrName, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const
 Attempt to find a plug for the given attribute. More...
 
MPlug findPlug (const MObject &attr, MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MPlug findPlug (const MString &attrName, MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MStatus addAttribute (const MObject &attr)
 Add a new dynamic attibute to this node. More...
 
MStatus removeAttribute (const MObject &attr)
 Remove a dynamic attribute from a node. More...
 
MPxNodeuserNode (MStatus *ReturnStatus=NULL) const
 If the function set's node is a plug-in node, then this method will extract the MPxNode pointer from it. More...
 
bool isFromReferencedFile (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node came from a referenced file. More...
 
bool isShared (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is shared. More...
 
bool isTrackingEdits (MStatus *ReturnStatus=NULL) const
 Returns whether or not edits on the given node are being tracked by the generalized edit system. More...
 
bool hasUniqueName (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node's name is unique within the scene. More...
 
MString parentNamespace (MStatus *ReturnStatus=NULL) const
 Returns the name of the namespace in which this node resides. More...
 
bool isLocked (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is locked. More...
 
MStatus setLocked (bool locked)
 Locks or unlocks this node. More...
 
bool isNewAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Indicates whether or not the specified attribute was added to this node within the current scene. More...
 
MStatus setFlag (unsigned int flag, bool state)
 Sets the state of the specified flag for the node. More...
 
bool isFlagSet (unsigned int flag, MStatus *ReturnStatus=NULL) const
 Retrieves the current state of the specified flag for a node. More...
 
bool isDefaultNode (MStatus *ReturnStatus=NULL) const
 Returns true if the node is a default node. More...
 
MStatus setDoNotWrite (bool flag)
 Use this method to mark the "do not write" state of this node. More...
 
bool canBeWritten (MStatus *ReturnStatus=NULL) const
 Returns the do not write state of the node. More...
 
bool hasAttribute (const MString &name, MStatus *ReturnStatus=NULL) const
 Returns true if the node already has an attribute with the given name. More...
 
MObject getAliasAttr (bool force, MStatus *ReturnStatus=NULL)
 Returns the node's alias attribute, which is a special attribute used to store information about the node's attribute aliases. More...
 
bool setAlias (const MString &alias, const MString &name, const MPlug &plug, bool add=true, MStatus *ReturnStatus=NULL)
 Sets or removes an alias (i.e. More...
 
bool findAlias (const MString &alias, MObject &attrObj, MStatus *ReturnStatus=NULL) const
 Retrieves the attribute with the given alias. More...
 
bool getAliasList (MStringArray &strArray, MStatus *ReturnStatus=NULL)
 Returns a list of all attribute aliases for this node. More...
 
MString plugsAlias (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Returns the alias for the plug's attribute or the empty string if that attribute has no alias. More...
 
MStatus setIcon (const MString &filename)
 Associates a custom icon with the node for display in the Maya UI. More...
 
MString icon (MStatus *ReturnStatus=NULL) const
 Returns the custom icon filename associated with the node. More...
 
MStatus getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
MStatus addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
MStatus setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table)
 Sets content info in the specified attribute from the table. More...
 
MStatus setExternalContent (const MExternalContentLocationTable &table)
 Changes the location of external content. More...
 
bool affectsAnimation (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is allowed to animate. More...
 
MStatus setAffectsAnimation ()
 Define a node can affect animation. More...
 
MString setName (const MString &name, MStatus *ReturnStatus)
 NO SCRIPT SUPPORT. More...
 
 MFnDependencyNode (const MObject &object, MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT. More...
 
bool getPlugsAlias (const MPlug &plug, MString &aliasName, MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT. More...
 
virtual const adsk::Data::Associationsmetadata (MStatus *ReturnStatus=NULL) const
 This method is not available in Python. More...
 
virtual MStatus setMetadata (const adsk::Data::Associations &)
 This method is not available in Python. More...
 
virtual MStatus deleteMetadata ()
 This method is not available in Python. More...
 
virtual MStatus validateMetadata (MString &errors) const
 This method is not available in Python. More...
 
MStatus dgTimerOn ()
 Indicates that this node should collect DG timing data whenever DG timing is enabled. More...
 
MStatus dgTimerOff ()
 Indicates that this node should no longer collect DG timing data when DG timing is enabled. More...
 
MdgTimerState dgTimerQueryState (MStatus *ReturnStatus=NULL)
 The function returns the current on/off state of the node's timer. More...
 
MStatus dgTimerReset ()
 The function resets the dependency graph timers and counters for this node to zero. More...
 
double dgTimer (const MdgTimerMetric timerMetric, const MdgTimerType timerType, MStatus *ReturnStatus=NULL) const
 The function returns the specified timer value for the current node. More...
 
MStatus dgCallbacks (const MdgTimerType type, MStringArray &callbackName, MDoubleArray &value)
 Node callbacks that occur when timing is enabled get logged with the node and can be queried via this method. More...
 
MStatus dgCallbackIds (const MdgTimerType type, const MString &callbackName, MCallbackIdArray &callbackId, MDoubleArray &value)
 This method provides a further breakdown of the per-callback time returned via dgCallbacks() by returning the data on a per-callbackId basis. More...
 
MStatus addAttribute (const MObject &attr, MAttrClass type)
 This method is obsolete. More...
 
MStatus removeAttribute (const MObject &attr, MAttrClass type)
 This method is obsolete. More...
 
- Public Member Functions inherited from MFnBase
virtual ~MFnBase ()
 Class Destructor. More...
 
bool hasObj (MFn::Type) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
bool hasObj (const MObject &) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
MObject object (MStatus *ReturnStatus=NULL) const
 Returns the MObject that is attached to the Function Set. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MFnDagNode
static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MFnDependencyNode
static const char * className ()
 Returns the name of this class. More...
 
static MString classification (const MString &nodeTypeName)
 Retrieves the classification string for a node type. More...
 
static unsigned int allocateFlag (const MString pluginName, MStatus *ReturnStatus=NULL)
 Allocates a node flag for sole use by the caller. More...
 
static MStatus deallocateFlag (const MString pluginName, unsigned int flag)
 Deallocates a node flag which was previously allocated by a call to allocateFlag. More...
 
static MStatus deallocateAllFlags (const MString pluginName)
 Deallocates all of the node flags which are currently allocated to the specified plugin. More...
 
static void enableDGTiming (bool enable)
 Globally enables or disables the DG node timing mechanism. More...
 
- Static Public Member Functions inherited from MFnBase
static const char * className ()
 Returns the name of this class. More...
 
static const char * typeString (MFn::Type)
 Returns the type string for a given type. More...
 
static bool isValid (MFn::Type)
 Returns true if type is in the range of valid types. More...
 

Additional Inherited Members

- Public Types inherited from MFnDagNode
enum  { kNextPos = 0xff }
 Anonymous enum to store constant values. More...
 
enum  MObjectColorType { kUseDefaultColor = 0, kUseIndexColor, kUseRGBColor }
 Enum to set how an object is colored. More...
 
- Public Types inherited from MFnDependencyNode
enum  MAttrClass { kLocalDynamicAttr = 1, kNormalAttr, kExtensionAttr, kInvalidAttr }
 Specifies the scope of the attribute. More...
 
enum  MdgTimerState { kTimerOff, kTimerOn, kTimerUninitialized, kTimerInvalidState }
 Possible states for the node's timer. More...
 
enum  MdgTimerMetric {
  kTimerMetric_callback, kTimerMetric_compute, kTimerMetric_dirty, kTimerMetric_draw,
  kTimerMetric_fetch, kTimerMetric_callbackViaAPI, kTimerMetric_callbackNotViaAPI, kTimerMetric_computeDuringCallback,
  kTimerMetric_computeNotDuringCallback, kTimerMetrics
}
 The different timer metrics which can be queried. More...
 
enum  MdgTimerType { kTimerType_self, kTimerType_inclusive, kTimerType_count, kTimerTypes }
 The types of timers which can be queried. More...
 

Detailed Description

Subdivision surface function set.

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

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

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

Please consult Maya documentation on subdivision surfaces for more details.

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

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

  • non manifold geometry The polygons must be manifold; i.e., an edge has at most two incident faces.
  • vertex valence A vertex must have valence of at least 3, unless it's a boundary vertex in which case it needs the valence of at least 2.
  • polygon vertex count Maximal vertex count in a single polygon is 256.
  • total vertex count Maximal vertex count in a base mesh is ~8,000,000 (2^23).

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

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

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

  • vertex list All of the vertices for the subdivision surface are stored in a master vertex list which is an array indexed from 0 to numVertices()-1. Vertices in this list can be shared among polygons.
  • polygon count list This is a list containing the number of vertices for each polygon. Each polygon in the mesh would have an entry in this list containing its number of vertices.
  • vertex connection list This is a list of the vertex id's for each polygon. Since polygons can have different numbers of vertices, the polygon count list is used to determine which polygons are represented by the various sections of this list.

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

Subdivision Surface Component API Names

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

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

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

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

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

  • base face name Each component API name is "rooted" at one of the faces in the original, coarsest (level 0, "base") mesh. These faces are numbered 0, 1, etc.
  • level Each component exists only at a single level. The value ranges from 0 to 12.
  • level 1 choice Coarsest faces can have up to 256 sides. Finer faces are always four sided. This portion of the name lets us decide which of the possibly 256 level 1 faces we are choosing.
  • path from level 1 Once we are at a level 1 face, we go down to a finer face by choosing one of the four children. This is recorded as two bits per level, giving us a "path" down to the desired level.
  • vertex/edge choice For all but level 0 faces, once we know the face, we just have to choose one of the four edges or vertices. This value is usually 0 for the faces (it is ignored). In the case of the level 0 faces, this contains the full index of the vertex within that face
  • storage Subdivision surface components (vertex, faces, names) are stored as single unsigned 64 bit integers (MUint64 type is defined in MTypes.h). The above 5 values are compressed into the 64 bit int storage. For those that want the gory details, the following is the way the components are currently organized within the 64 bits of data. However you should use the 5 values above and not this 64 bit value as the way these 5 values are packed into the 64 bit value may change in future. The contents of the 64 bits are presented here from the highest value bit down to the lowest:
  • {1} - unused
  • {23} - base face name
  • {8} - level 1 choice
  • {2} - unused
  • {4} - level
  • {24} - path
  • {2} - unused

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

Examples:
gpuCache/gpuCacheCmd.cpp, and pointOnSubdNode/pointOnSubdNode.cpp.

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:
  • MS::kSuccess if the function set is successfully attached
  • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject
MFnSubd ( const MDagPath object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters
[in]objectThe const MDagPath to attach the function set to
[out]ReturnStatusThe return status
Status Codes:
  • MS::kSuccess if the function set is successfully attached
  • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject
MFnSubd ( const MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
  • MS::kSuccess if the function set is successfully attached
  • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

Member Function Documentation

MFn::Type type ( ) const
virtual

Function set type.

Return the class type : MFn::kSubdiv.

Returns
the class type.

Reimplemented from MFnDagNode.

OPENMAYA_MAJOR_NAMESPACE_OPEN const char * className ( )
static

Returns the name of this class.

Return the class name : "MFnSubd".

Returns
Name of this class.
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:
  • MS::kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter Array length does not match given item count, or parentOrOwner was not valid, or there was no model present to add the object to.
  • MS::kFailure An object error has occurred.
  • MS::kInsufficientMemory Insufficient memory to complete this method
MObject copy ( const MObject source,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kInvalidParameter One of the following parameter errors
  • MS::kFailure An object error has occurred.
int vertexBaseMeshAdd ( double  x,
double  y,
double  z,
MStatus ReturnStatus = NULL 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MUint64 polygonBaseMeshAddWithUVs ( int  vertexCount,
const int  vertexIds[],
const double  uValues[],
const double  vValues[],
MStatus ReturnStatus = NULL 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexEditsGetAllNonBase ( MUint64Array vertexIds,
MVectorArray edits,
MSpace::Space  space = MSpace::kObject 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexEditsSetAllNonBase ( const MUint64Array vertexIds,
const MVectorArray edits,
MSpace::Space  space = MSpace::kObject 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexEditsClearAllNonBase ( )

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

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexPositionGet ( MUint64  vertexId,
MPoint position,
MSpace::Space  space = MSpace::kObject 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexEditGet ( MUint64  vertexId,
MVector edit,
MSpace::Space  space = MSpace::kObject 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexPositionGetNoEdit ( MUint64  vertexId,
MPoint position,
MSpace::Space  space = MSpace::kObject 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexPositionSet ( MUint64  vertexId,
const MPoint position,
bool  updateEdits,
MSpace::Space  space = MSpace::kObject 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexEditSet ( MUint64  vertexId,
const MVector edit,
bool  updateEdits,
MSpace::Space  space = MSpace::kObject 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexBaseMeshGetWithId ( MPointArray positions,
MUint64Array vertexIds,
MSpace::Space  space = MSpace::kObject 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexBaseMeshSetWithId ( const MPointArray positions,
const MUint64Array vertexIds,
MSpace::Space  space = MSpace::kObject 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus evaluatePosition ( MUint64  polyId,
double  u,
double  v,
bool  uvNormalized,
MPoint pos 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus evaluateNormal ( MUint64  polyId,
double  u,
double  v,
bool  uvNormalized,
MVector nrml 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus evaluatePositionAndNormal ( MUint64  polyId,
double  u,
double  v,
bool  uvNormalized,
MPoint pos,
MVector nrml 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getConnectedShaders ( unsigned int  instanceNumber,
MObjectArray shaders,
MUint64Array faces,
MIntArray indices 
) const

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MObject tesselate ( bool  uniform,
int  depth,
int  sample,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus updateSubdSurface ( )

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

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus vertexBaseMeshAddWithIndex ( double  x,
double  y,
double  z,
int  index 
)

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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
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:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

The documentation for this class was generated from the following files: