#include <MFnSubd.h>
Subdivision surface function set.
This function set provides access to subdivision surfaces. Objects of type MFn::kSubdiv, MFn::kSubdivData, and MFn::kSubdivGeom are supported. MFn::kSubdiv objects are shapes in the DAG, MFn::kSubdivGeom objects are the raw geometry that the shapes use, and MFn::kSubdivData objects are the data that is passed through dependency graph connections.
Maya implements fully hierarchical Catmull-Clark quad based subdivision surfaces. You can use them without any hierarchical edits, but their full power is only realized when you do use the hierarchy. Using the hierarchy lets you access additional vertices on the existing faces. For example, a single 4 vertex plane can give you access, through hierarchy, to over 16,000,000 points at the finest level of the hierarchy (please don't try it). Additionally, the points at the finer levels are created only as you need them and only in the areas where you need them, giving you an implied level of detail workflow.
The "base" mesh is sometimes used to describe the coarsest level of the hierarchy. Once we go one level finer (to level "1") all faces are four sided (though not all vertices are of valence 4). At that point, each face can be considered to have 4 "children" faces. Starting with a 4 vertex single face plane, there will be 4 faces (and 9 vertices) at level 1, 16 faces (and 25 vertices) at level 2, etc. You can go as deep as level 12.
Please consult Maya documentation on subdivision surfaces for more details.
Subdivision Surface Construction Subdivision surfaces are created by specifying a base polygonal mesh, hierarchical edits (optional) and creases (optional).
The base mesh contains a vertex list, a list of vertex counts per-polygon, and a list of vertices that make up the polygons. If you are familiar with the creation of polygonal meshes, this is exactly equivalent to that setup. With a small set of limitations, any polygonal object can be converted into a subdivision surface. The current limitations are:
The easiest way to create a subdivision surface is probably to use polyToSubdiv MEL command to create it from a polygon. Alternativelly, the same functionality is available through the API using createFromPolygon method.
Alternatively, you can create a subdivision surface either by converting an existing NURBS surface with createFromNurbsSurface or directly, by specifying vertex lists, vertex connections lists, etc. The last method will look familiar to those that have used MFnMesh::create method to create a polygon.
The following lists are used by the create method to construct a subdivision surface:
Texture Coordinates (UV's) You can optionally specify texture (uv) coordinates. UV coordinates are 2-d coordinates used for mapping textures to the polygons of a surface. Each polygon contains as many UV's as it has vertices. The UV values are not shared and you can think of them as "owned" by a polygon, rather than each vertex in that polygon.
Subdivision Surface Component API Names
In order to successfully use the subdivision surface API, you need to familiarize yourself with the naming convention used for its components within the API.
In the polygon case, we simply number the vertices 0, 1, ... N-1. The faces and the edges and the faces are numbered similarly.
For the subdivision surfaces, this is not the case, mostly because of the hierarchical approach we took. Since it would be prohibitive to instantiate all the faces all the time (think of those 16M that can from just one original face) the names have to be order of creation independent.
The simplest way to think about each API name is "start with a face and follow a path into the finer levels of the hierarchy recording each turn along the way".
Here's some details. You should also consult MFnSubdNames class which contains a number of helpful methods for interpreting, creating and modifying the component API names. While this will take some getting used to, the good news is that instantiating more vertices does not change the names of the existing ones (unless you're adding more level 0 vertices) so any vertex animation, etc. will not be affected by a need to model more detail into another part of the surface.
For the subdivision surfaces, the most important names are those of the faces. Given a face name, each vertex on that face is named based on that face. That does mean that each vertex will typically have more than one name. Maya will always give you a unique name by choosing the one that is numerically the smallest (in the 64 bit sense).
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) |
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... | |
MPxNode * | userNode (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... | |
MString | setName (const MString &name, MStatus *ReturnStatus) |
OBSOLETE FUNCTION, 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::Associations * | metadata (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... | |
Protected Member Functions | |
virtual const char * | className () const |
Class name. 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... | |
Static Public Member Functions inherited from MFnDependencyNode | |
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... | |
|
virtual |
Destructor.
Class destructor.
|
virtual |
|
protectedvirtual |
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.
[in] | reverseNormal | Not currently used |
[in] | numVertices | number of vertices |
[in] | numPolygons | number of polygons |
[in] | vertexArray | point (vertex) array |
[in] | polygonCounts | array of vertex counts for each polygon |
[in] | polygonConnects | array of vertex connections for each polygon |
[in] | parentOrOwner | parent of the polygon that will be created |
[out] | ReturnStatus | Status code |
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.
[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 |
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 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.
[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 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).
[in] | vertexCount | Number of vertices in the polygon |
[in] | vertexIndex | The vertex indices (0, 1, 2, ...) |
[out] | ReturnStatus | Status code |
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.
[in] | vertexCount | Number of vertices in the polygon |
[in] | vertexIds | The vertex indices (0, 1, 2, ...) |
[in] | uValues | U values for each vertex |
[in] | vValues | V values for each vertex |
[out] | ReturnStatus | Status code |
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.
[out] | ReturnStatus | Status code |
void 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 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 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 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 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 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.
[in] | baseVertexIndex | The index in the base mesh vertex array of this vertex |
[out] | ReturnStatus | Status code |
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.
[in] | vertexId | The 64-bit name of the vertex |
[out] | ReturnStatus | Status code |
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.
[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 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 vertexEditsClearAllNonBase | ( | ) |
Find all vertices with edits and remove those edits, setting them back to their original position.
MStatus 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 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 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 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 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 |
[in] | edit | The offset to set |
[in] | updateEdits | If false, you will need to call updateSubdSurface() before any change would be applied. Further, you must set this to true before you start calling the same function on the vertices of the finer levels. |
[in] | space | Specifies the coordinate system for this operation |
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).
[out] | positions | The array of point positions |
[in] | space | Specifies the coordinate system for this operation |
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.
[out] | positions | The positions for the vertices |
[in] | space | Specifies the coordinate system for this operation |
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.
[out] | positions | The array of point positions |
[out] | vertexIds | The vertex 64-bit ids |
[in] | space | The space we are working in |
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).
[out] | positions | The positions for the vertices |
[out] | vertexIds | The vertex 64-bit ids |
[in] | space | The space we are working in |
int vertexValence | ( | MUint64 | vertexId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Returns the valence (number of incident edges) of the given vertex.
[in] | vertexId | The vertex 64-bit id |
[out] | ReturnStatus | Status code |
Returns the normal at the vertex.
[in] | vertexId | The vertex 64-bit ID. |
[out] | normal | The value of the normal |
MStatus vertexAdjacentVertices | ( | MUint64 | vertexId, |
MUint64Array & | vertList | ||
) | const |
Return the list of adjacent vertices as their 64-bit ids.
[in] | vertexId | The vertex 64-bit name |
[out] | vertList | The resulting list of adjacent vertices |
MStatus vertexIncidentEdges | ( | MUint64 | vertexId, |
MUint64Array & | edgeList | ||
) | const |
Return the list of incident edges as their 64-bit ids.
[in] | vertexId | The vertex 64-bit name |
[out] | edgeList | The resulting list of incident edges |
MStatus vertexIncidentPolygons | ( | MUint64 | vertexId, |
MUint64Array & | polyList | ||
) | const |
Return the list of incident polygons as their 64-bit ids.
[in] | vertexId | The vertex 64-bit name |
[out] | polyList | The resulting list of incident polygons |
bool vertexIsBoundary | ( | MUint64 | vertexId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Return true if the vertex is a boundary vertex.
[in] | vertexId | The vertex 64-bit name |
[out] | ReturnStatus | Status code |
bool vertexIsValid | ( | MUint64 | vertexId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Return true if the vertex is a valid vertex.
[in] | vertexId | The vertex 64-bit name |
[out] | ReturnStatus | Status code |
bool vertexIsCreased | ( | MUint64 | vertexId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Return true if the vertex is creased.
[in] | vertexId | The vertex 64-bit name |
[out] | ReturnStatus | Status code |
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).
[in] | vertexId | The vertex 64-bit name |
[out] | ReturnStatus | Status code |
MStatus vertexSetCrease | ( | MUint64 | vertexId, |
bool | creased | ||
) | const |
Set the particular vertex' crease state.
[in] | vertexId | The 64-bit name of the vertex |
[in] | creased | Crease (true) or smooth (false) |
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.
[in] | vertexId | 64-bit name of the vertex |
[out] | children | 64-bit names of the children of this vertex |
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.
[out] | vertexIds | The ids of the vertices that are creased |
[out] | edgeIds | The ids of the edges that are creased |
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.
[in] | vertexIds | The ids of the vertices that are creased |
[in] | edgeIds | The ids of the edges that are creased |
MStatus creasesClearAll | ( | ) | const |
Clear all crease information from this surface.
No vertices or edges will be creased after this function completes.
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.
unsigned int 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 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 edgeVertices | ( | MUint64 | edgeId, |
MUint64 & | v1, | ||
MUint64 & | v2 | ||
) | const |
Given an edge, return the two vertices at its ends.
[in] | edgeId | The 64-bit edge name |
[out] | v1 | First vertex on the edge |
[out] | v2 | Second vertex on the edge |
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.
[in] | edgeId | The 64-bit edge name |
[out] | polys | The 64-bit names of the polygons (1 or 2) |
bool edgeIsBoundary | ( | MUint64 | edgeId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Test if the edge specified is a boundary edge or not.
[in] | edgeId | The 64-bit edge name |
[out] | ReturnStatus | Status code |
bool edgeIsValid | ( | MUint64 | edgeId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Returns true if the specified edge name is valid.
[in] | edgeId | The 64-bit edge name |
[out] | ReturnStatus | Status code |
bool edgeIsCreased | ( | MUint64 | edgeId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Return true if the edge is creased.
[in] | edgeId | The 64-bit name of the edge |
[out] | ReturnStatus | Status code |
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).
[in] | edgeId | The edge 64-bit name |
[out] | ReturnStatus | Status code |
MStatus edgeSetCrease | ( | MUint64 | edgeId, |
bool | creased | ||
) | const |
Set the particular edge's crease state.
[in] | edgeId | The 64-bit name of the edge |
[in] | creased | Crease (true) or smooth (false) |
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.
[in] | edgeId | 64-bit name of the edge |
[out] | children | 64-bit names of the children of this edge |
unsigned int polygonCount | ( | int | level = 0 , |
MStatus * | ReturnStatus = NULL |
||
) | const |
Returns the number of polygons currently existing at the specified level of the hierarchy.
[in] | level | Level at which we're counting |
[out] | ReturnStatus | Status code |
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.
[in] | level | The level where you would be counting |
[out] | ReturnStatus | Status code |
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.
[in] | polyId | The 64-bit name of the polygon |
[out] | ReturnStatus | Status code |
MStatus 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 64-bit name of the polygon |
[out] | vertexIds | The 64-bit names of the vertices |
unsigned int polygonEdgeCount | ( | MUint64 | polyId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
The number of edges on the given polygon.
[in] | polyId | The 64-bit name of the polygon |
[out] | ReturnStatus | Status code |
MStatus 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 64-bit name of the polygon |
[out] | edgeIds | The 64-bit names of the edges |
bool polygonIsValid | ( | MUint64 | polygonId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Return true if the polygon is a valid polygon.
[in] | polygonId | The polygon 64-bit name |
[out] | ReturnStatus | Status code |
bool polygonHasChildren | ( | MUint64 | polyId, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Returns whether or not the given polygon has children.
[in] | polyId | The polygon 64-bit name |
[out] | ReturnStatus | Status code |
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.
[in] | polyId | The 64-bit name of the original polygon |
[out] | children | The 64-bit name of the child polygons |
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).
[in] | polyId | The 64-bit name of the polygon |
MStatus polygonSetUseUVs | ( | MUint64 | polyId, |
bool | useThem | ||
) |
If this is set, the polygon will use the user specified UVs.
[in] | polyId | The 64-bit polygon name |
[in] | useThem | Use the user set UVs |
bool polygonHasVertexUVs | ( | MUint64 | polyId, |
MStatus * | ReturnStatus = NULL |
||
) |
Returns true if there are user specified UVs on this polygon.
[in] | polyId | The 64-bit polygon name |
[out] | ReturnStatus | Status code |
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.
[in] | polyId | The 64-bit polygon name |
[out] | uValues | Array of U values |
[out] | vValues | Array of V values |
MStatus polygonSetVertexUVs | ( | MUint64 | polyId, |
const MDoubleArray & | uValues, | ||
const MDoubleArray & | vValues | ||
) |
Set the UV values on the polygon.
[in] | polyId | The 64-bit polygon name |
[in] | uValues | Array of U values |
[in] | vValues | Array of V values |
MStatus polygonGetCenterUV | ( | MUint64 | polyId, |
double & | u, | ||
double & | v | ||
) | const |
Return the UV values in the "center" of this polygon.
[in] | polyId | The 64-bit polygon name |
[out] | u | The resulting U value |
[out] | v | The resulting V value |
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.
[in] | polyId | The 64-bit polygon name |
[in] | u | U value on the face |
[in] | v | V value on the face |
[in] | uvNormalized | If true, its as if U, V are in [0,1] |
[out] | pos | The resulting 3d position |
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.
[in] | polyId | The 64-bit polygon name |
[in] | u | U value on the face |
[in] | v | V value on the face |
[in] | uvNormalized | If true, its as if U, V are in [0,1] |
[out] | nrml | The resulting surface normal |
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.
[in] | polyId | The 64-bit polygon name |
[in] | u | U value on the face |
[in] | v | V value on the face |
[in] | uvNormalized | If true, its as if U, V are in [0,1] |
[out] | pos | The resulting 3d position |
[out] | nrml | The resulting surface normal |
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.
[in] | polyId | The 64-bit polygon name |
[out] | vertices | point array |
[out] | ReturnStatus | Status code |
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.
[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 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.
[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 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.
[in] | parentOrOwner | the DAG parent or kMeshData the new Mesh will belong to |
[out] | ReturnStatus | Status Code |
MStatus convertToNurbs | ( | MObjectArray & | newNurbsSurfaces | ) |
Converts this surface to a set of nurbs surfaces.
[out] | newNurbsSurfaces | Storage for the arary of NURBS |
MStatus updateSubdSurface | ( | ) |
Signal that this subdivision surface has changed and needs to redraw itself.
MStatus vertexBaseMeshAddWithIndex | ( | double | x, |
double | y, | ||
double | z, | ||
int | index | ||
) |
Very similar to vertexBaseMeshAdd, this gives you an advanced option of specifying the index for the new vertex to be created.
You have to be extremelly careful to end up with the indices 0, 1, ... N-1 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 bi-cubic B-splines.
This routine will return the 16 points that define such spline.
[in] | polyId | The 64-bit polygon name |
[out] | vertices | 16 vertices that define the cubic spline |
[out] | ReturnStatus | Status code |