class MFnSubd

Jump to documentation

: public MFnDagNode Subdivision surface function set. (OpenMaya) (OpenMaya.py)

Inheritance:

MFnSubd < MFnDagNode < MFnDependencyNode < MFnBase

public members:

MFnSubd ( const MObject & object, MStatus * ReturnStatus = NULL )
MObject createBaseMesh ( bool reverseNormal, int numVertices, int numPolygons, const MPointArray & vertexArray, const MIntArray & polygonCounts, const MIntArray & polygonConnects, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject copy ( const MObject & source, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject collapse ( const int level, bool makeNewNodeInvisible, MStatus * ReturnStatus = NULL )
int vertexBaseMeshAdd ( double x, double y, double z, MStatus * ReturnStatus = NULL )
MUint64 polygonBaseMeshAdd ( int vertexCount , const int vertexIds[], MStatus * ReturnStatus = NULL )
MUint64 polygonBaseMeshAddWithUVs ( int vertexCount , const int vertexIds[], const double uValues[], const double vValues[], MStatus * ReturnStatus = NULL )
int editsPending ( MStatus * ReturnStatus = NULL ) const
void editsUpdateAll ( MStatus * ReturnStatus = NULL )
unsigned int levelMaxCurrent ( MStatus * ReturnStatus = NULL ) const
unsigned int levelMaxAllowed ( MStatus * ReturnStatus = NULL ) const
void levelFullySubdivideTo ( int level, MStatus * ReturnStatus = NULL )
unsigned int vertexCount ( int level = 0, MStatus * ReturnStatus = NULL) const
MUint64 vertexIdFromBaseVertexIndex ( int baseVertexIndex, MStatus * ReturnStatus = NULL) const
int vertexBaseIndexFromVertexId ( MUint64 vertexId, MStatus * ReturnStatus = NULL) const
MStatus vertexEditsGetAllNonBase ( MUint64Array & vertexIds, MVectorArray & edits, MSpace::Space space = MSpace::kObject ) const
MStatus vertexEditsSetAllNonBase ( const MUint64Array & vertexIds, const MVectorArray & edits, MSpace::Space space = MSpace::kObject )
MStatus vertexEditsClearAllNonBase ()
MStatus vertexPositionGet ( MUint64 vertId, MPoint & position, MSpace::Space space = MSpace::kObject )const
MStatus vertexEditGet ( MUint64 vertId, MVector & edit, MSpace::Space space = MSpace::kObject ) const
MStatus vertexPositionGetNoEdit ( MUint64 vertId, MPoint & position, MSpace::Space space = MSpace::kObject )const
MStatus vertexPositionSet ( MUint64 vertId, const MPoint & position, bool updateEdits, MSpace::Space space = MSpace::kObject )
MStatus vertexEditSet ( MUint64 vertId, const MVector & edit, bool updateEdits, MSpace::Space space = MSpace::kObject )
MStatus vertexBaseMeshGet ( MPointArray & positions, MSpace::Space space = MSpace::kObject ) const
MStatus vertexBaseMeshSet ( const MPointArray & positions, MSpace::Space space = MSpace::kObject )
MStatus vertexBaseMeshGetWithId ( MPointArray & positions, MUint64Array & vertexIds, MSpace::Space space = MSpace::kObject ) const
MStatus vertexBaseMeshSetWithId ( const MPointArray & positions, const MUint64Array & vertexIds, MSpace::Space space = MSpace::kObject )
int vertexValence ( MUint64 vertId, MStatus * ReturnStatus = NULL ) const
MStatus vertexNormal ( MUint64 vertId, MVector & normal ) const
MStatus vertexAdjacentVertices ( MUint64 vertId, MUint64Array & vertList ) const
MStatus vertexIncidentEdges ( MUint64 vertId, MUint64Array & edgeList ) const
MStatus vertexIncidentPolygons ( MUint64 vertId, MUint64Array & polyList ) const
bool vertexIsBoundary ( MUint64 vertId, MStatus * ReturnStatus = NULL ) const
bool vertexIsValid ( MUint64 vertId, MStatus * ReturnStatus = NULL ) const
bool vertexIsCreased ( MUint64 vertId, MStatus * ReturnStatus = NULL ) const
bool vertexCreaseRelevant ( MUint64 vertId, MStatus * ReturnStatus = NULL ) const
MStatus vertexSetCrease ( MUint64 vertId, bool creased ) const
MStatus vertexChildren ( MUint64 vertId, MUint64Array & children ) const
MStatus creasesGetAll ( MUint64Array & vertexIds, MUint64Array & edgeIds ) const
MStatus creasesSetAll ( const MUint64Array & vertexIds, const MUint64Array & edgeIds )
MStatus creasesClearAll () const
MStatus updateAllEditsAndCreases ()
unsigned int edgeCount ( int level = 0, MStatus * ReturnStatus = NULL ) const
MUint64 edgeBetween ( MUint64 vertex1, MUint64 vertex2, MStatus * ReturnStatus = NULL ) const
MStatus edgeVertices ( MUint64 edge, MUint64& v1, MUint64& v2 ) const
MStatus edgeAdjacentPolygon ( MUint64 edge, MUint64Array & polys ) const
bool edgeIsBoundary ( MUint64 edge, MStatus * ReturnStatus = NULL ) const
bool edgeIsValid ( MUint64 edgeId, MStatus * ReturnStatus = NULL ) const
bool edgeIsCreased ( MUint64 edgeId, MStatus * ReturnStatus = NULL ) const
bool edgeCreaseRelevant ( MUint64 edgeId, MStatus * ReturnStatus = NULL ) const
MStatus edgeSetCrease ( MUint64 edgeId, bool creased ) const
MStatus edgeChildren ( MUint64 edgeId, MUint64Array & children ) const
unsigned int polygonCount ( int level = 0, MStatus * ReturnStatus = NULL ) const
int polygonCountMaxWithGivenBaseMesh ( int level = 1, MStatus * ReturnStatus = NULL ) const
unsigned int polygonVertexCount ( MUint64 polyId, MStatus * ReturnStatus = NULL ) const
MStatus polygonVertices ( MUint64 polyId, MUint64Array & vertIds ) const
unsigned int polygonEdgeCount ( MUint64 polyId, MStatus * ReturnStatus = NULL ) const
MStatus polygonEdges ( MUint64 polyId, MUint64Array & edgeIds ) const
bool polygonIsValid ( MUint64 polyId, MStatus * ReturnStatus = NULL ) const
bool polygonHasChildren ( MUint64 polyId, MStatus * ReturnStatus = NULL ) const
MStatus polygonChildren ( MUint64 polyId, MUint64Array & children ) const
MStatus polygonSubdivide ( MUint64 polyId )
MStatus polygonSetUseUVs ( MUint64 polyId, bool useThem )
bool polygonHasVertexUVs ( MUint64 polyId, MStatus * ReturnStatus = NULL )
MStatus polygonGetVertexUVs ( MUint64 polyId, MDoubleArray & uValues, MDoubleArray & vValues ) const
MStatus polygonSetVertexUVs ( MUint64 polyId, const MDoubleArray & uValues, const MDoubleArray & vValues )
MStatus polygonGetCenterUV ( MUint64 polyId, double& u, double& v ) const
MStatus evaluatePosition ( MUint64 polyId, double u, double v, bool uvNormalized, MPoint & ) const
MStatus evaluateNormal ( MUint64 polyId, double u, double v, bool uvNormalized, MVector & nrml ) const
MStatus evaluatePositionAndNormal ( MUint64 polyId, double u, double v, bool uvNormalized, MPoint & pos, MVector & nrml ) const
bool getCubicSpline ( MUint64 polyId, MPointArray vertices, MStatus * ReturnStatus = NULL )
MStatus getConnectedSetsAndMembers ( unsigned int instanceNumber, MObjectArray & sets, MObjectArray & comps, bool renderableSetsOnly ) const
MStatus getConnectedShaders ( unsigned int instanceNumber, MObjectArray & shaders, MUint64Array & faces, MIntArray & indices ) const
MObject tesselate ( bool uniform, int depth, int sample, MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject tessellateViaNurbs ( MObject parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MStatus convertToNurbs ( MObjectArray & newNurbsSurfaces )
MStatus updateSubdSurface ()
MStatus vertexBaseMeshAddWithIndex ( double x, double y, double z, int index )
bool getCubicSpline ( MUint64 polyId, MPoint vertices[16], MStatus * ReturnStatus = NULL )
NO SCRIPT SUPPORT

Inherited from MFnDagNode:

public members:

kNextPos
MObject create ( const MTypeId &typeId, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId &typeId, const MString &name, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MString &type, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MString &type, const MString &name, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
unsigned int parentCount ( MStatus * ReturnStatus = NULL ) const
MObject parent ( unsigned int i, MStatus * ReturnStatus = NULL ) const
MStatus addChild ( MObject & child , unsigned int index = kNextPos , bool keepExistingParents = false )
MStatus removeChild ( MObject & child )
MStatus removeChildAt ( unsigned int index )
unsigned int childCount ( MStatus * ReturnStatus = NULL ) const
MObject child ( unsigned int i, MStatus * ReturnStatus = NULL ) const
MObject dagRoot ( MStatus * ReturnStatus = NULL )
bool hasParent ( const MObject & node, MStatus * ReturnStatus = NULL ) const
bool hasChild (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool isChildOf (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool isParentOf (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool inUnderWorld ( MStatus * ReturnStatus = NULL ) const
bool inModel ( MStatus * ReturnStatus = NULL ) const
bool isInstanceable ( MStatus * ReturnStatus=NULL ) const
MStatus setInstanceable ( const bool how )
bool isInstanced ( bool indirect = true, MStatus * ReturnStatus = NULL ) const
bool isInstancedAttribute ( const MObject & attr, MStatus * ReturnStatus = NULL ) const
unsigned int instanceCount ( bool total, MStatus * ReturnStatus = NULL ) const
MObject duplicate ( bool instance = false, bool instanceLeaf = false, MStatus * ReturnStatus = NULL ) const
MStatus getPath ( MDagPath & path )
MStatus getAllPaths ( MDagPathArray & paths )
MString fullPathName ( MStatus *ReturnStatus = NULL)
MString partialPathName ( MStatus *ReturnStatus = NULL)
MMatrix transformationMatrix ( MStatus * ReturnStatus = NULL ) const
bool isIntermediateObject ( MStatus * ReturnStatus = NULL ) const
MStatus setIntermediateObject ( bool isIntermediate )
int objectColor ( MStatus * ReturnStatus = NULL ) const
MStatus setObjectColor ( int color )
bool usingObjectColor ( MStatus * ReturnStatus = NULL ) const
MStatus setUseObjectColor ( bool useObjectColor )
MBoundingBox boundingBox ( MStatus * ReturnStatus = NULL ) const
MDagPath dagPath ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( const MDagPath & path )
virtual MStatus setObject ( MObject & object )
MObject model ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( const MObject & object )

Inherited from MFnDependencyNode:

public members:

virtual MFn::Type type () const
enum MAttrClass
kGlobalDynamicAttr
kLocalDynamicAttr
MObject create ( const MTypeId & typeId , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId & typeId , const MString & name , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , const MString & name , MStatus * ReturnStatus = NULL )
MTypeId typeId ( MStatus * ReturnStatus = NULL ) const
MString typeName ( MStatus * ReturnStatus = NULL ) const
MString name ( MStatus * ReturnStatus = NULL ) const
MString setName ( const MString & name , MStatus * ReturnStatus = NULL )
MStatus getConnections ( MPlugArray & array ) const
unsigned int attributeCount ( MStatus * ReturnStatus=NULL) const
MObject attribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject reorderedAttribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject attribute ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MAttrClass attributeClass ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MStatus getAffectedAttributes ( const MObject & attr, MObjectArray & affectedAttributes ) const
MStatus getAffectedByAttributes ( const MObject & attr, MObjectArray & affectedByAttributes ) const
MPlug findPlug ( const MObject & attr, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MStatus addAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MStatus removeAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MPxNode * userNode ( MStatus * ReturnStatus=NULL ) const
bool isFromReferencedFile ( MStatus * ReturnStatus=NULL) const
bool isShared ( MStatus * ReturnStatus=NULL) const
bool hasUniqueName ( MStatus * ReturnStatus=NULL) const
MString parentNamespace ( MStatus * ReturnStatus=NULL) const
bool isLocked ( MStatus * ReturnStatus=NULL) const
MStatus setLocked ( bool locked )
static MString classification ( const MString & nodeTypeName )
bool isNewAttribute ( const MObject & attr, MStatus * ReturnStatus=NULL) const
static unsigned int allocateFlag ( const MString pluginName, MStatus * ReturnStatus=NULL )
static MStatus deallocateFlag (const MString pluginName, unsigned int flag)
static MStatus deallocateAllFlags (const MString pluginName)
MStatus setFlag (unsigned int flag, bool state)
bool isFlagSet (unsigned int flag, MStatus * ReturnStatus=NULL) const
bool isDefaultNode ( MStatus * ReturnStatus=NULL) const
MStatus setDoNotWrite ( bool flag )
bool canBeWritten ( MStatus * ReturnStatus=NULL) const
bool hasAttribute (const MString & name , MStatus * ReturnStatus=NULL) const
MObject getAliasAttr (bool force, MStatus * ReturnStatus=NULL)
bool setAlias (const MString & alias,const MString & name , const MPlug & plug, bool add=true, MStatus * ReturnStatus=NULL)
bool findAlias (const MString & alias, MObject & attrObj, MStatus * ReturnStatus=NULL) const
bool getAliasList ( MStringArray & strArray, MStatus * ReturnStatus=NULL)
MString plugsAlias (const MPlug & plug, MStatus * ReturnStatus=NULL)
public
bool getPlugsAlias (const MPlug & plug, MString & aliasName, MStatus * ReturnStatus=NULL)

Inherited from MFnBase:

public members:

virtual MFn::Type type () const
bool hasObj ( MFn::Type ) const
bool hasObj ( const MObject & ) const
MObject object ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( MObject & object )
virtual MStatus setObject ( const MObject & object )

Documentation

Description

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).

Functions

MFnSubd:: MFnSubd ()

Description

Default class constructor. The function set is not attached to an MObject.

MFnSubd:: MFnSubd ( MObject & object, MStatus * ReturnStatus )

Description

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

Arguments

  • object the MObject to attach the function set to
  • ReturnStatus the return status
    • 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:: MFnSubd ( const MObject & object, MStatus * ReturnStatus )

Description

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

Arguments

  • object the const MObject to attach the function set to
  • ReturnStatus the return status
    • 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:: MFnSubd ( const MDagPath & object, MStatus * ReturnStatus )

Description

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

Arguments

  • object the const MDagPath to attach the function set to
  • ReturnStatus the return status
    • 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

MFn::Type MFnSubd:: type () const

Description

Return the type of this function set.

Return Value

  • the constant MFn::kSubdiv

MFnSubd:: ~MFnSubd ()

Description

Class destructor.

MObject MFnSubd:: createBaseMesh ( bool reverseNormal, int numVertices, int numPolygons, const MPointArray & vertexArray, const MIntArray & polygonCounts, const MIntArray & polygonConnects, MObject parentOrOwner, MStatus * ReturnStatus )

Description

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.

Arguments

  • numVertices number of vertices
  • numPolygons number of polygons
  • vertexArray point (vertex) array
  • polygonCounts array of vertex counts for each polygon
  • polygonConnects array of vertex connections for each polygon
  • parentOrOwner parent of the polygon that will be created
  • ReturnStatus Status code

Return Value

  • 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 One of the following parameter errors
    • Array length does not match given item count
    • ParentOrOwner was not valid
    • 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 MFnSubd:: copy ( const MObject & source, MObject parentOrOwner, MStatus * ReturnStatus )

Description

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.

Arguments

  • source the subdivision surface to be copied
  • parentOrOwner the DAG parent or kSubdivData the new subdivision surface will belong to
  • ReturnStatus Status code

Return Value

  • 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 One of the following parameter errors
    • parentOrOwner was not valid
    • if the source object is not one of kSubdivGeom, kSubdivData, kSubdiv
    • dataSubdiv or underlying geometry was null
    • Source object was null
    • 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 MFnSubd:: collapse ( const int level, bool makeNewNodeInvisible, MStatus * ReturnStatus )

Description

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.

Arguments

  • level the number of levels of the hierarchy to collapse
  • makeNewNodeInvisible sets the invisible attribute of the new node
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: vertexBaseMeshAdd ( double x, double y, double z, MStatus * ReturnStatus )

Description

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.

Arguments

  • x X location of the vertex
  • y Y location of the vertex
  • z Z location of the vertex
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: polygonBaseMeshAdd ( int vertexCount , const int vertexIndex[], MStatus * ReturnStatus )

Description

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).

Arguments

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

Return Value

  • The name of the newly created polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MUint64 MFnSubd:: polygonBaseMeshAddWithUVs ( int vertexCount , const int vertexIds[], const double uValues[], const double vValues[], MStatus * ReturnStatus )

Description

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.

Arguments

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

Return Value

  • The name of the newly created polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnSubd:: editsPending ( MStatus * ReturnStatus ) const

Description

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.

Arguments

  • ReturnStatus Status code

Return Value

  • Edits pending (1) or not (0).

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

void MFnSubd:: editsUpdateAll ( MStatus * ReturnStatus )

Description

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

Arguments

  • ReturnStatus Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

unsigned int MFnSubd:: levelMaxCurrent ( MStatus * ReturnStatus ) const

Description

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.

Arguments

  • ReturnStatus Status code

Return Value

  • The finest level in the hierarchy

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

unsigned int MFnSubd:: levelMaxAllowed ( MStatus * ReturnStatus ) const

Description

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.

Arguments

  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: levelFullySubdivideTo ( int level, MStatus * ReturnStatus )

Description

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.

Arguments

  • level The level to which to fully subdivide
  • ReturnStatus Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

unsigned int MFnSubd:: vertexCount ( int level, MStatus * ReturnStatus ) const

Description

Returns the finest vertex count at a particular level. These are the vertices that are currently instantiated.

Arguments

  • level The level we are interested in
  • ReturnStatus Status code

Return Value

  • The number of vertices at the given level

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MUint64 MFnSubd:: vertexIdFromBaseVertexIndex ( int baseVertexIndex, MStatus * ReturnStatus ) const

Description

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.

Arguments

  • The index in the base mesh vertex array of this vertex
  • ReturnStatus Status code

Return Value

  • vertexId The 64-bit name of the vertex

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnSubd:: vertexBaseIndexFromVertexId ( MUint64 vertexId, MStatus * ReturnStatus ) const

Description

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.

Arguments

  • vertexId The 64-bit name of the vertex
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: vertexEditsGetAllNonBase ( MUint64Array & vertexIds, MVectorArray & edits, MSpace::Space space ) const

Description

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.

Arguments

  • vertexIds The names of the vertices
  • edits The offsets from the original position
  • space Specifies the coordinate system for this operation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexEditsSetAllNonBase ( const MUint64Array & vertexIds, const MVectorArray & edits, MSpace::Space space )

Description

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

Arguments

  • vertexIds The names of the vertices
  • edits The offsets from the original positions
  • space Specifies the coordinate system for this operation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexEditsClearAllNonBase ()

Description

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

Arguments

  • none

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexPositionGet ( MUint64 vertexId, MPoint & position, MSpace::Space space )const

Description

Get the position of the vertex with a given name.

Arguments

  • vertexId The name of the vertex
  • position The vertex position in the appropriate space
  • space Specifies the coordinate system for this operation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexEditGet ( MUint64 vertexId, MVector & edit, MSpace::Space space ) const

Description

Get the offset of the specified vertex from its original position. This vector really is vertexPositionGet() - vertexPositionGetNoEdit().

Arguments

  • vertexId The name of the vertex
  • edit The offset in object space
  • space Specifies the coordinate system for this operation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexPositionGetNoEdit ( MUint64 vertexId, MPoint & position, MSpace::Space space )const

Description

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

Arguments

  • vertexId The name of the vertex
  • position The original position
  • space Specifies the coordinate system for this operation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexPositionSet ( MUint64 vertexId, const MPoint & position, bool updateEdits, MSpace::Space space )

Description

Set the position of the vertex with a given name.

Arguments

  • vertexId The vertex name
  • position The new vertex position
  • 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.
  • space Specifies the coordinate system for this operation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexEditSet ( MUint64 vertexId, const MVector & edit, bool updateEdits, MSpace::Space space )

Description

Set the original position offset for the given vertex.

Arguments

  • vertexId The name of the vertex
  • edit The offset from the original position
  • 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.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexBaseMeshGet ( MPointArray & positions, MSpace::Space space ) const

Description

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

Arguments

  • positions The array of point positions
  • space Specifies the coordinate system for this operation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexBaseMeshSet ( const MPointArray & positions, MSpace::Space space )

Description

Set the positions for the base mesh vertices using the 0, 1,... indexing instead of the 64-bit vertex names.

Arguments

  • positions The positions for the vertices
  • space Specifies the coordinate system for this operation

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexBaseMeshGetWithId ( MPointArray & positions, MUint64Array & vertexIds, MSpace::Space space ) const

Description

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

Arguments

  • positions The array of point positions
  • vertexIds The vertex 64-bit ids
  • space The space we are working in

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexBaseMeshSetWithId ( const MPointArray & positions, const MUint64Array & vertexIds, MSpace::Space space )

Description

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).

Arguments

  • positions The positions for the vertices
  • vertexIds The vertex 64-bit ids
  • space The space we are working in

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnSubd:: vertexValence ( MUint64 vertexId, MStatus * ReturnStatus ) const

Description

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

Arguments

  • vertexId The vertex 64-bit id
  • ReturnStatus Status code

Return Value

  • The finest level in the hierarchy

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexNormal ( MUint64 vertexId, MVector & normal ) const

Description

Returns the normal at the vertex

Arguments

  • vertexId The vertex 64-bit ID.
  • normal The value of the normal

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexAdjacentVertices ( MUint64 vertexId, MUint64Array & vertList ) const

Description

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

Arguments

  • vertexId The vertex 64-bit name
  • vertList The resulting list of adjacent vertices

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexIncidentEdges ( MUint64 vertexId, MUint64Array & edgeList ) const

Description

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

Arguments

  • vertexId The vertex 64-bit name
  • edgeList The resulting list of incident edges

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexIncidentPolygons ( MUint64 vertexId, MUint64Array & polyList ) const

Description

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

Arguments

  • vertexId The vertex 64-bit name
  • polyList The resulting list of incident polygons

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: vertexIsBoundary ( MUint64 vertexId, MStatus * ReturnStatus ) const

Description

Return true if the vertex is a boundary vertex.

Arguments

  • vertexId The vertex 64-bit name
  • ReturnStatus Status code

Return Value

  • Whether the vertex is boundary or not

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: vertexIsValid ( MUint64 vertexId, MStatus * ReturnStatus ) const

Description

Return true if the vertex is a valid vertex.

Arguments

  • vertexId The vertex 64-bit name
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: vertexIsCreased ( MUint64 vertexId, MStatus * ReturnStatus ) const

Description

Return true if the vertex is creased.

Arguments

  • vertexId The vertex 64-bit name
  • ReturnStatus Status code

Return Value

  • Whether the vertex is creased or not

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: vertexCreaseRelevant ( MUint64 vertexId, MStatus * ReturnStatus ) const

Description

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).

Arguments

  • vertexId The vertex 64-bit name
  • ReturnStatus Status code

Return Value

  • Whether the vertex has relevant crease information

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexSetCrease ( MUint64 vertexId, bool creased ) const

Description

Set the particular vertex' crease state.

Arguments

  • vertexId The 64-bit name of the vertex
  • creased Crease (true) or smooth (false)

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexChildren ( MUint64 vertexId, MUint64Array & children ) const

Description

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.

Arguments

  • vertexId 64-bit name of the vertex
  • children 64-bit names of the children of this vertex

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: creasesGetAll ( MUint64Array & vertexIds, MUint64Array & edgeIds ) const

Description

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.

Arguments

  • vertexIds The ids of the vertices that are creased
  • edgeIds The ids of the edges that are creased

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: creasesSetAll ( const MUint64Array & vertexIds, const MUint64Array & edgeIds )

Description

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.

Arguments

  • vertexIds The ids of the vertices that are creased
  • edgeIds The ids of the edges that are creased

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: creasesClearAll () const

Description

Clear all crease information from this surface. No vertices or edges will be creased after this function completes.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MObject MFnSubd:: tesselate ( bool uniform, int depth, int sample, MObject parentOrOwner, MStatus * ReturnStatus )

Description

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.

Arguments

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

Return Value

  • 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 MFnSubd:: tessellateViaNurbs ( MObject parentOrOwner, MStatus * ReturnStatus )

Description

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.

Arguments

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

Return Value

  • 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 MFnSubd:: convertToNurbs ( MObjectArray & newNurbsSurfaces )

Description

Converts this surface to a set of nurbs surfaces.

Arguments

  • ReturnStatus Status Code

Return Value

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: updateAllEditsAndCreases ()

Description

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.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

unsigned int MFnSubd:: edgeCount ( int level, MStatus * ReturnStatus ) const

Description

Returns the number of edges at a level.

Arguments

  • level The level where we're counting the edges
  • ReturnStatus Status code

Return Value

  • Number of edges at the given level

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MUint64 MFnSubd:: edgeBetween ( MUint64 vertex1, MUint64 vertex2, MStatus * ReturnStatus ) const

Description

Return the name of the edge that connects the two vertices. If the edge doesn't exist, it will be created.

Arguments

  • vertex1 The name of the first vertex
  • vertex2 The name of the second vertex
  • ReturnStatus Status code

Return Value

  • The name of the edge between the two

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: edgeVertices ( MUint64 edgeId, MUint64& v1, MUint64& v2 ) const

Description

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

Arguments

  • edgeId The 64-bit edge name
  • v1 First vertex on the edge
  • v2 Second vertex on the edge

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: edgeAdjacentPolygon ( MUint64 edgeId, MUint64Array & polys ) const

Description

Return the polygons adjacent to this edge. There can be at most two, as non-manifold topology is not allowed.

Arguments

  • edgeId The 64-bit edge name
  • polys The 64-bit names of the polygons (1 or 2)

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: edgeIsBoundary ( MUint64 edgeId, MStatus * ReturnStatus ) const

Description

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

Arguments

  • edgeId The 64-bit edge name
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: edgeIsValid ( MUint64 edgeId, MStatus * ReturnStatus ) const

Description

Returns true if the specified edge name is valid.

Arguments

  • edgeId The 64-bit edge name
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: edgeIsCreased ( MUint64 edgeId, MStatus * ReturnStatus ) const

Description

Return true if the edge is creased.

Arguments

  • edgeId The 64-bit name of the edge
  • ReturnStatus Status code

Return Value

  • True if the edge is creased, false otherwise

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: edgeCreaseRelevant ( MUint64 edgeId, MStatus * ReturnStatus ) const

Description

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).

Arguments

  • edgeId The edge 64-bit name
  • ReturnStatus Status code

Return Value

  • Whether the edge has relevant crease information

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: edgeSetCrease ( MUint64 edgeId, bool creased ) const

Description

Set the particular edge's crease state.

Arguments

  • edgeId The 64-bit name of the edge
  • creased Crease (true) or smooth (false)

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: edgeChildren ( MUint64 edgeId, MUint64Array & children ) const

Description

Returns the "children" of the particular edge. If the edge has children, there will always be two child edges.

Arguments

  • edgeId 64-bit name of the edge
  • children 64-bit names of the children of this edge

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

unsigned int MFnSubd:: polygonCount ( int level, MStatus * ReturnStatus ) const

Description

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

Arguments

  • level Level at which we're counting
  • ReturnStatus Status code

Return Value

  • The number of polygons at the specified level

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnSubd:: polygonCountMaxWithGivenBaseMesh ( int level, MStatus * ReturnStatus ) const

Description

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.

Arguments

  • level The level where you would be counting
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: polygonVertexCount ( MUint64 polyId, MStatus * ReturnStatus ) const

Description

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

Arguments

  • polyId The 64-bit name of the polygon
  • ReturnStatus Status code

Return Value

  • The number of vertices on this polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: polygonVertices ( MUint64 polyId, MUint64Array & vertexIds ) const

Description

Given the polygon, return its vertices. The vertices are at the same level as the polygon.

Arguments

  • polyId The 64-bit name of the polygon
  • vertexIds The 64-bit names of the vertices

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

unsigned int MFnSubd:: polygonEdgeCount ( MUint64 polyId, MStatus * ReturnStatus ) const

Description

The number of edges on the given polygon.

Arguments

  • polyId The 64-bit name of the polygon
  • ReturnStatus Status code

Return Value

  • The number of edges on this polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: polygonEdges ( MUint64 polyId, MUint64Array & edgeIds ) const

Description

Given the polygon, return its edges. The edges are at the same level as the polygon.

Arguments

  • polyId The 64-bit name of the polygon
  • vertexIds The 64-bit names of the edges

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: polygonIsValid ( MUint64 polygonId, MStatus * ReturnStatus ) const

Description

Return true if the polygon is a valid polygon.

Arguments

  • polygonId The polygon 64-bit name
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: polygonHasChildren ( MUint64 polyId, MStatus * ReturnStatus ) const

Description

Returns whether or not the given polygon has children.

Arguments

  • polyId The polygon 64-bit name

Return Value

  • 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 MFnSubd:: polygonChildren ( MUint64 polyId, MUint64Array & children ) const

Description

Returns the list of children polygons on the given polygon. If the children array is not empty, we will just append to it.

Arguments

  • polyId The 64-bit name of the original polygon
  • children The 64-bit name of the child polygons

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 MFnSubd:: polygonSubdivide ( MUint64 polyId )

Description

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).

Arguments

  • polyId The 64-bit name of the polygon

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: polygonSetUseUVs ( MUint64 polyId, bool useThem )

Description

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

Arguments

  • polyId The 64-bit polygon name
  • useThem Use the user set UVs

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: polygonHasVertexUVs ( MUint64 polyId, MStatus * ReturnStatus )

Description

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

Arguments

  • polyId The 64-bit polygon name
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: polygonGetVertexUVs ( MUint64 polyId, MDoubleArray & uValues, MDoubleArray & vValues ) const

Description

Get the vertex UVs from the polygon. The values come back in exactly the same order as the polygon vertices do.

Arguments

  • polyId The 64-bit polygon name
  • uValues Array of U values
  • vValues Array of V values

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

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

Description

Set the UV values on the polygon.

Arguments

  • polyId The 64-bit polygon name
  • uValues Array of U values
  • vValues Array of V values

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

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

Description

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

Arguments

  • polyId The 64-bit polygon name
  • u The resulting U value
  • v The resulting V value

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

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

Description

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. Arguments

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

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

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

Description

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.

Arguments

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

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

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

Description

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.

Arguments

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

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: getCubicSpline ( MUint64 polyId, MPointArray vertices, MStatus * ReturnStatus )

Description

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.

Arguments

  • polyId The 64-bit polygon name
  • vertices point array
  • ReturnStatus Status code

Return Value

  • True if we can make the conversion, false otherwise

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnSubd:: getCubicSpline ( MUint64 polyId, MPoint vertices[16], MStatus * ReturnStatus )

Description

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.

Arguments

  • polyId The 64-bit polygon name
  • vertices 16 vertices that define the cubic spline
  • ReturnStatus Status code

Return Value

  • 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 MFnSubd:: getConnectedSetsAndMembers ( unsigned int instanceNumber, MObjectArray & sets, MObjectArray & comps, bool renderableSetsOnly ) const

Description

Returns all the sets connected to the specified instance of this mesh. For each set in the "sets" array there is a corresponding entry in the "comps" array which are all the components in that set. If the entire object is in a set, then the corresponding entry in the comps array will have no elements in it.

Arguments

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

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

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

Description

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.

Arguments

  • instanceNumber The instance number of the subdivision surface to query
  • shaders Storage for set objects (shader objects)
  • faces Storage for indices matching faces to indices
  • indices Storage for indices matching indices to shaders

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: updateSubdSurface ()

Description

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

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnSubd:: vertexBaseMeshAddWithIndex ( double x, double y, double z, int index )

Description

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.

Arguments

  • x X location of the vertex
  • y Y location of the vertex
  • z Z location of the vertex
  • index The index the vertex is to take
  • ReturnStatus Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright