MFnNurbsSurface Class Reference

#include <MFnNurbsSurface.h>

Class Description

NURBS surface function set.

This is the function set for NURBS (Non-Uniform Rational B-spline) surfaces.

The shape of a NURBS surface is defined by an array of CVs (control vertices), an array of knot values in the U direction and an array of knot values in the V direction, a degree in U and in V, and a form in U and in V.

The U and V knot vectors for NURBS surfaces are of size (spansInU + 2*degreeInU -1) and (spansInV + 2*degreeInV -1). Note: spans = numCVs - degree.

There are 3 possible "forms" for the surface in the U and V directions: open, closed and periodic. These forms are described below. Note that the descriptions below apply to both the U and V directions.

The open and closed forms are quite similar, and in fact a closed surface will become an open surface if either the first or last CV is moved so that they are no longer coincident. To create an open or closed surface, of degree N, with M spans, you must provide M+N CVs. This implies that for a degree N surface, you must specify at least N+1 CVs to get a surface with a single span.

The number of knots required for the surface is M + 2N - 1. If you want the surface to start exactly at the first CV and end exactly at the last CV, then the knot vector must be structured to have degree N "multiplicity" at the beginning and end. This means that the first N knots must be identical, and the last N knots must be identical.

A periodic surface is a special case of a closed surface. Instead of having just the first and last CVs coincident, the last N CVs in the surface, where N is equal to the degree, overlap the first N CVs. This results in a surface with no tangent break where the ends meet. The last N CVs in a periodic surface are permanently bound to the first N CVs, and Maya will not allow those last N CVs to be repositioned. If one or more of the first N CVs of the surface are repositioned, the overlapping CV's will remain bound, and will also be moved.

In order to create a periodic surface, you must specify at least 2N+1 CVs, so that that last N can overlap the first N and you still have 1 non-overlapping CV left. The number of CVs required to create a periodic surface is still N+M (with a lower limit of 2N+1), but you must ensure that the positions of the last N CVs are identical to the positions of the first N.

You still need M + 2N - 1 knots for a periodic surface, but the knot values required are more restrictive than for open or closed surfaces because of the overlap of the last N CVs. The first N knots should be specified at the beginning of the knot array as values { -(N-1), -(N-2), ... 0 } in order to implement the overlap. Additionally there can be no knot multiplicity at the end of the surface, because that would compromise the tangent continuity property.

Managing different knot representations in external applications

Note that some third party applications use a different format for knots, where the number of knots required for a surface is M+2N+1 rather than M+2N-1 as used in Maya. Both knot representations are equivalent mathematically. To convert from one of these external representations into the Maya representation, simply omit the first and last knots from the external representation when creating the Maya representation. To convert from the Maya representation into the external representation, add two new knots at the beginning and end of the Maya knot sequence. The value of these new knots depends on the existing knot sequence. For a knot sequence with multiple end knots, simply duplicate the existing first and last knots once more, for example:

Maya representation: {0,0,0,...,N,N,N} External representation: {0,0,0,0,...,N,N,N,N}

For a knot sequence with uniform end knots, create the new knots offset at an interval equal to the existing first and last knot intervals, for example:

Maya representation: {0,1,2,...,N,N+1,N+2} External representation: {-1,0,1,2,...,N,N+1,N+2,N+3}

+ Examples:
+ Inheritance diagram for MFnNurbsSurface:

Public Types

enum  Form {
  kInvalid =0, kOpen, kClosed, kPeriodic,
  kLast
}
 Forms that a surface may take in a given parametric direction. More...
 
enum  BoundaryType {
  kInvalidBoundary =0, kOuter, kInner, kSegment,
  kClosedSegment
}
 Boundary types for trimmed surfaces. More...
 
- 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...
 

Public Member Functions

virtual MFn::Type type () const
 Function set type. More...
 
virtual ~MFnNurbsSurface ()
 Destructor.
 
 MFnNurbsSurface ()
 Default constructor.
 
 MFnNurbsSurface (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MFnNurbsSurface (const MDagPath &object, MStatus *ret=NULL)
 Constructor. More...
 
MObject create (const MPointArray &controlVertices, const MDoubleArray &uKnotSequences, const MDoubleArray &vKnotSequences, unsigned int degreeInU, unsigned int degreeInV, Form formU, Form formV, bool createRational, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Creates a nurbs surface from the specified data 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 nurbs surface. More...
 
MObject getDataObject () const
 Returns an MObject if the class has been constructed with an MFn::kNurbsSurfaceData entity, otherwise MObject::kNullObj is returned. More...
 
MObject cv (unsigned int indexU, unsigned int indexV, MStatus *ReturnStatus=NULL)
 Returns a component for the specified CV. More...
 
MObject cvsInU (unsigned int startIndex, unsigned int endIndex, unsigned int rowIndex, MStatus *ReturnStatus=NULL)
 Returns a component for the specified CVs. More...
 
MObject cvsInV (unsigned int startIndex, unsigned int endIndex, unsigned int rowIndex, MStatus *ReturnStatus=NULL)
 Returns a component for the specified CVs on the given V direction. More...
 
MStatus getCVs (MPointArray &array, MSpace::Space space=MSpace::kObject) const
 Get the positions of the CVs on this surface. More...
 
MStatus setCVs (const MPointArray &array, MSpace::Space space=MSpace::kObject)
 Set the CVs for this surface to the given points. More...
 
MStatus getCV (unsigned int indexU, unsigned int indexV, MPoint &pnt, MSpace::Space space=MSpace::kObject) const
 Get the location of the specified CV. More...
 
MStatus setCV (unsigned int indexU, unsigned int indexV, MPoint &pnt, MSpace::Space space=MSpace::kObject) const
 Set the location of the specified CV. More...
 
Form formInU (MStatus *ReturnStatus=NULL) const
 Return the form of this surface in U. More...
 
Form formInV (MStatus *ReturnStatus=NULL) const
 Return the form of this surface in V. More...
 
bool isBezier (MStatus *ReturnStatus=NULL) const
 Determine if the knot spacing gives us Bezier surface. More...
 
bool isUniform (MStatus *ReturnStatus=NULL) const
 Determine if the knot spacing is uniform. More...
 
bool isKnotU (double param, MStatus *ReturnStatus=NULL) const
 Check if the specified parameter value is a knot value. More...
 
bool isKnotV (double param, MStatus *ReturnStatus=NULL) const
 Check if the specified parameter value is a knot value. More...
 
bool isParamOnSurface (double paramU, double paramV, MStatus *ReturnStatus=NULL) const
 Check if the specified parameter is on this surface. More...
 
MStatus getKnotDomain (double &startU, double &endU, double &startV, double &endV) const
 Returns the maximum and minimum U and V paramter values for this surface. More...
 
int degreeU (MStatus *ReturnStatus=NULL) const
 Returns the degree of the surface in U (1 - 3). More...
 
int degreeV (MStatus *ReturnStatus=NULL) const
 Returns the degree of the surface in V (1 - 3). More...
 
int numSpansInU (MStatus *ReturnStatus=NULL) const
 Returns the number of spans in the u direction. More...
 
int numSpansInV (MStatus *ReturnStatus=NULL) const
 Returns the number of spans in the v direction. More...
 
int numNonZeroSpansInU (MStatus *ReturnStatus=NULL) const
 Returns the number of non-zero spans in the U direction. More...
 
int numNonZeroSpansInV (MStatus *ReturnStatus=NULL) const
 Returns the number of non-zero spans in the V direction. More...
 
int numCVsInU (MStatus *ReturnStatus=NULL) const
 Returns the number of CVs in the U direction (degree + spans). More...
 
int numCVsInV (MStatus *ReturnStatus=NULL) const
 Returns the number of CVs in the V direction (degree + spans). More...
 
int numKnotsInU (MStatus *ReturnStatus=NULL) const
 Returns the number of knots in U including multiple end knots (spans + 2 * degree - 1). More...
 
int numKnotsInV (MStatus *ReturnStatus=NULL) const
 Returns the number of knots in V including multiple end knots (spans + 2 * degree - 1). More...
 
MStatus getKnotsInU (MDoubleArray &array) const
 Get the knots along the U direction for this surface. More...
 
MStatus getKnotsInV (MDoubleArray &array) const
 Get the knots along the V direction for this surface. More...
 
MStatus setKnotsInU (const MDoubleArray &array, unsigned int startIndex, unsigned int endIndex)
 Set the specified U knot values for this surface. More...
 
MStatus setKnotsInV (const MDoubleArray &array, unsigned int startIndex, unsigned int endIndex)
 Set the specified V knot values for this surface. More...
 
double knotInU (unsigned int index, MStatus *ReturnStatus=NULL) const
 Retrieve the given knot value from this surface at the specified U index. More...
 
double knotInV (unsigned int index, MStatus *ReturnStatus=NULL) const
 Retrieve the given knot value from this surface at the specified V index. More...
 
MStatus setKnotInU (unsigned int index, double param)
 Set the value of the given existing knot at the specified U index. More...
 
MStatus setKnotInV (unsigned int index, double param)
 Set the value of the given existing knot at the specified V index. More...
 
MStatus removeKnotInU (double atThisParam, bool removeAll=false)
 Remove the U knot(s) at the specified parameter value from this surface. More...
 
MStatus removeKnotInV (double atThisParam, bool removeAll=false)
 Remove the V knot(s) at the specified parameter value from this surface. More...
 
MStatus removeOneKnotInU (double atThisParam)
 Remove one U knot at the specified parameter value from this surface. More...
 
MStatus removeOneKnotInV (double atThisParam)
 Remove one V knot at the specified parameter value from this surface. More...
 
MVector normal (double paramInU, double paramInV, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 Retrieve the normal at the given parameter value on the surface. More...
 
MStatus getTangents (double paramInU, double paramInV, MVector &vectorInU, MVector &vectorInV, MSpace::Space space=MSpace::kObject) const
 Retrieve the tangents in the U and V directions at the given parameter value on the surface. More...
 
MStatus getDerivativesAtParm (double paramInU, double paramInV, MPoint &pos, MVector &dU, MVector &dV, MSpace::Space space, MVector *dUU=NULL, MVector *dVV=NULL, MVector *dUV=NULL) const
 Evaluate the surface at the given (u,v) coordinate returning position, first derivatives and optionally second derivative information. More...
 
bool isFoldedOnBispan () const
 Evaluate the surface to determine if it contains any folds or creases. More...
 
double area (double tolerance=kMFnNurbsEpsilon, MStatus *ReturnStatus=NULL) const
 Calculates the surface area of this nurbs surface. More...
 
double area (MSpace::Space space, double tolerance=kMFnNurbsEpsilon, MStatus *ReturnStatus=NULL) const
 Calculates the surface area of this nurbs surface in world or local space. More...
 
MPoint closestPoint (const MPoint &toThisPoint, double *paramU=NULL, double *paramV=NULL, bool ignoreTrimBoundaries=false, double tolerance=kMFnNurbsEpsilon, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 Return the closest point on this surface to the given point. More...
 
MPoint closestPoint (const MPoint &toThisPoint, bool paramAsStart, double *paramU, double *paramV, bool ignoreTrimBoundaries=false, double tolerance=kMFnNurbsEpsilon, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 Return the closest point on this surface to the given point. More...
 
bool isPointOnSurface (const MPoint &point, double tolerance=kMFnNurbsEpsilon, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 Check if the given point is on this surface. More...
 
MStatus getParamAtPoint (const MPoint &atThisPoint, double &paramU, double &paramV, bool ignoreTrimBoundaries, MSpace::Space space=MSpace::kObject, double tolerance=kMFnNurbsEpsilon) const
 Get the parameter value corresponding to the given point on the surface (or underlying surface). More...
 
MStatus getPointAtParam (double paramU, double paramV, MPoint &point, MSpace::Space space=MSpace::kObject) const
 Finds the point corresponding to the given parameter value on the surface. More...
 
double distanceToPoint (const MPoint &pt, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 Returns the distance from the given point to the closest point on the surface. More...
 
MObject tesselate (MTesselationParams &parms=MTesselationParams::fsDefaultTesselationParams, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Performs tesselation on this surface and create a new mesh in the DAG. More...
 
bool intersect (const MPoint &rayStartingPoint, const MVector &alongThisDirection, double &u, double &v, MPoint &intersectionData, double tolerance=kMFnNurbsEpsilon, MSpace::Space space=MSpace::kObject, bool calculateDistance=false, double *distance=NULL, bool calculateExactHit=false, bool *wasExactHit=NULL, MStatus *ReturnStatus=NULL) const
 This function determines the closest point of intersection of this spline surface with a ray (a vector at a point). More...
 
bool intersect (const MPoint &rayStartingPoint, const MVector &alongThisDirection, MDoubleArray &u, MDoubleArray &v, MPointArray &intersectionData, double tolerance=kMFnNurbsEpsilon, MSpace::Space space=MSpace::kObject, bool calculateDistance=false, MDoubleArray *distances=NULL, bool calculateExactHit=false, bool *wasExactHit=NULL, MStatus *ReturnStatus=NULL) const
 This function determines all the points of intersection of this spline surface with a ray (a vector at a point). More...
 
bool hasHistoryOnCreate (MStatus *ReturnStatus=NULL) const
 This method determines if the shape was created with history. More...
 
MStatus updateSurface ()
 This method signals that this surface has changed and needs to be recalculated. More...
 
bool isTrimmedSurface (MStatus *ReturnStatus=NULL) const
 This method determines if this surface is a trimmed surface. More...
 
unsigned int numRegions (MStatus *ReturnStatus=NULL) const
 Returns the number of trimmed regions for this surface or 0 if the surface is not a trimmed surface. More...
 
bool isFlipNorm (unsigned int region, MStatus *ReturnStatus=NULL) const
 Determines whether the normal for the specified region is flipped. More...
 
unsigned int numBoundaries (unsigned int region, MStatus *ReturnStatus=NULL)
 Returns the number of boundaries for the specified region. More...
 
BoundaryType boundaryType (unsigned int region, unsigned int boundary, MStatus *ReturnStatus=NULL)
 Returns the type of the specified boundary. More...
 
unsigned int numEdges (unsigned int region, unsigned int boundary, MStatus *ReturnStatus=NULL)
 Return the number of edges for the specified trim boundary. More...
 
MObjectArray edge (unsigned int region, unsigned int boundary, unsigned int edge, bool paramEdge=false, MStatus *ReturnStatus=NULL)
 Return the specified edge of a trim boundary. More...
 
bool isPointInTrimmedRegion (double u, double v, MStatus *ReturnStatus=NULL)
 Returns true if the given point is in a trimmed away region of a trimmed surface. More...
 
MStatus getTrimBoundaries (MTrimBoundaryArray &result, unsigned int region, bool paramEdge=true)
 Returns all trim boundaries of a region on this surface. More...
 
MStatus trimWithBoundaries (const MTrimBoundaryArray &mBoundaries, bool flipNormal=false, double e_tol=1e-3, double pe_tol=1e-5, bool createNewRegion=false)
 This function trims this surface with given trim boundaries. More...
 
MStatus projectCurve (const MDagPath &curve, const MVector *direction=NULL, bool constructionHistory=false)
 Project the given curve onto this surface creating a curve on surface. More...
 
MStatus trim (const MDoubleArray &locatorU, const MDoubleArray &locatorV, bool constructionHistory=false)
 Trim this surface to its curves on surface. More...
 
unsigned int numPatches (MStatus *ReturnStatus=NULL) const
 Returns the number of non-zero patches in this surface. More...
 
unsigned int numPatchesInU (MStatus *ReturnStatus=NULL) const
 Returns the number of non-zero patches along u, in this surface. More...
 
unsigned int numPatchesInV (MStatus *ReturnStatus=NULL) const
 Returns the number of non-zero patches along v, in this surface. More...
 
int numUVs (MStatus *ReturnStatus=NULL) const
 Returns the number of texture (uv) coordinates for this surface. More...
 
MStatus setUVs (const MFloatArray &uArray, const MFloatArray &vArray)
 Sets all of the texture coordinates (uvs) for this surface. More...
 
MStatus getUVs (MFloatArray &uArray, MFloatArray &vArray) const
 This method copies the texture coordinate list for this surface into the given uv arrays. More...
 
MStatus setUV (int uvId, float u, float v)
 Sets the specified texture coordinate. More...
 
MStatus getUV (int uvId, float &u, float &v) const
 Get the value of the specified texture coordinate from this surface's uv list. More...
 
MStatus getPatchUV (int patchId, int cornerIndex, float &u, float &v) const
 Get the value of the specified texture coordinate for a patch corner in a patch. More...
 
MStatus getPatchUVs (int patchId, MFloatArray &uArray, MFloatArray &vArray) const
 Get the values of the texture coordinate on a specified patch. More...
 
MStatus getPatchUVid (int patchId, int cornerIndex, int &uvId) const
 Get the id of the specified texture coordinate for a corner in a patch. More...
 
MStatus assignUV (int patchId, int cornerIndex, int uvId)
 Maps a texture coordinate to a the specified corner of a patch. More...
 
MStatus assignUVs (const MIntArray &uvCounts, const MIntArray &uvIds)
 This method maps all texture coordinates for the surface. More...
 
MStatus clearUVs ()
 This method clears out all texture coordinates for the nurbsSurface, and leaves behind an empty UVset. More...
 
MStatus getAssignedUVs (MIntArray &uvCounts, MIntArray &uvIds) const
 Get assigned UVs. More...
 
MStatus getConnectedShaders (unsigned int instanceNumber, MObjectArray &shaders, MIntArray &indices) const
 Returns all the shaders (sets) connected to the specified instance of this surface, as well as an array of patch/shader assignments. More...
 
MStatus getParamAtPoint (const MPoint &atThisPoint, double &paramU, double &paramV, MSpace::Space space=MSpace::kObject) const
 This method is obsolete. More...
 
MObject tesselate (MTesselationParams &parms, MStatus *ReturnStatus)
 This method is obsolete. More...
 
 MFnNurbsSurface (const MObject &object, MStatus *ret=NULL)
 Constructor. 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...
 
MPxNodeuserNode (MStatus *ReturnStatus=NULL) const
 If the function set's node is a plug-in node, then this method will extract the MPxNode pointer from it. More...
 
bool isFromReferencedFile (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node came from a referenced file. More...
 
bool isShared (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is shared. More...
 
bool isTrackingEdits (MStatus *ReturnStatus=NULL) const
 Returns whether or not edits on the given node are being tracked by the generalized edit system. More...
 
bool hasUniqueName (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node's name is unique within the scene. More...
 
MString parentNamespace (MStatus *ReturnStatus=NULL) const
 Returns the name of the namespace in which this node resides. More...
 
bool isLocked (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is locked. More...
 
MStatus setLocked (bool locked)
 Locks or unlocks this node. More...
 
bool isNewAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Indicates whether or not the specified attribute was added to this node within the current scene. More...
 
MStatus setFlag (unsigned int flag, bool state)
 Sets the state of the specified flag for the node. More...
 
bool isFlagSet (unsigned int flag, MStatus *ReturnStatus=NULL) const
 Retrieves the current state of the specified flag for a node. More...
 
bool isDefaultNode (MStatus *ReturnStatus=NULL) const
 Returns true if the node is a default node. More...
 
MStatus setDoNotWrite (bool flag)
 Use this method to mark the "do not write" state of this node. More...
 
bool canBeWritten (MStatus *ReturnStatus=NULL) const
 Returns the do not write state of the node. More...
 
bool hasAttribute (const MString &name, MStatus *ReturnStatus=NULL) const
 Returns true if the node already has an attribute with the given name. More...
 
MObject getAliasAttr (bool force, MStatus *ReturnStatus=NULL)
 Returns the node's alias attribute, which is a special attribute used to store information about the node's attribute aliases. More...
 
bool setAlias (const MString &alias, const MString &name, const MPlug &plug, bool add=true, MStatus *ReturnStatus=NULL)
 Sets or removes an alias (i.e. More...
 
bool findAlias (const MString &alias, MObject &attrObj, MStatus *ReturnStatus=NULL) const
 Retrieves the attribute with the given alias. More...
 
bool getAliasList (MStringArray &strArray, MStatus *ReturnStatus=NULL)
 Returns a list of all attribute aliases for this node. More...
 
MString plugsAlias (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Returns the alias for the plug's attribute or the empty string if that attribute has no alias. More...
 
MStatus setIcon (const MString &filename)
 Associates a custom icon with the node for display in the Maya UI. More...
 
MString icon (MStatus *ReturnStatus=NULL) const
 Returns the custom icon filename associated with the node. More...
 
MStatus getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
MStatus addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
MStatus setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table)
 Sets content info in the specified attribute from the table. More...
 
MStatus setExternalContent (const MExternalContentLocationTable &table)
 Changes the location of external content. More...
 
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::Associationsmetadata (MStatus *ReturnStatus=NULL) const
 This method is not available in Python. More...
 
virtual MStatus setMetadata (const adsk::Data::Associations &)
 This method is not available in Python. More...
 
virtual MStatus deleteMetadata ()
 This method is not available in Python. More...
 
virtual MStatus validateMetadata (MString &errors) const
 This method is not available in Python. More...
 
MStatus dgTimerOn ()
 Indicates that this node should collect DG timing data whenever DG timing is enabled. More...
 
MStatus dgTimerOff ()
 Indicates that this node should no longer collect DG timing data when DG timing is enabled. More...
 
MdgTimerState dgTimerQueryState (MStatus *ReturnStatus=NULL)
 The function returns the current on/off state of the node's timer. More...
 
MStatus dgTimerReset ()
 The function resets the dependency graph timers and counters for this node to zero. More...
 
double dgTimer (const MdgTimerMetric timerMetric, const MdgTimerType timerType, MStatus *ReturnStatus=NULL) const
 The function returns the specified timer value for the current node. More...
 
MStatus dgCallbacks (const MdgTimerType type, MStringArray &callbackName, MDoubleArray &value)
 Node callbacks that occur when timing is enabled get logged with the node and can be queried via this method. More...
 
MStatus dgCallbackIds (const MdgTimerType type, const MString &callbackName, MCallbackIdArray &callbackId, MDoubleArray &value)
 This method provides a further breakdown of the per-callback time returned via dgCallbacks() by returning the data on a per-callbackId basis. More...
 
MStatus addAttribute (const MObject &attr, MAttrClass type)
 This method is obsolete. More...
 
MStatus removeAttribute (const MObject &attr, MAttrClass type)
 This method is obsolete. More...
 
- Public Member Functions inherited from MFnBase
virtual ~MFnBase ()
 Class Destructor. More...
 
bool hasObj (MFn::Type) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
bool hasObj (const MObject &) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
MObject object (MStatus *ReturnStatus=NULL) const
 Returns the MObject that is attached to the Function Set. More...
 

Protected Member Functions

virtual const char * className () const
 Class name. More...
 

Additional Inherited Members

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

Member Enumeration Documentation

enum Form

Forms that a surface may take in a given parametric direction.

Enumerator
kInvalid 

 

kOpen 

Edges are independent.

kClosed 

Edges are coincident.

kPeriodic 

Edges overlap such that there is no break in tangency.

kLast 

 

Boundary types for trimmed surfaces.

Enumerator
kInvalidBoundary 

 

kOuter 

Outer boundary, counter clockwise.

kInner 

Inner boundary, clockwise.

kSegment 

Curve on a face.

kClosedSegment 

Closed curve on a face.

Constructor & Destructor Documentation

MFnNurbsSurface ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

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

Constructor.

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

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

Constructor.

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

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

Member Function Documentation

MFn::Type type ( ) const
virtual

Function set type.

Return the class type : MFn::kNurbsSurface.

Reimplemented from MFnDagNode.

const char * className ( ) const
protectedvirtual

Class name.

Return the class name : "MFnNurbsSurface".

Reimplemented from MFnDagNode.

MObject create ( const MPointArray controlVertices,
const MDoubleArray uKnotSequences,
const MDoubleArray vKnotSequences,
unsigned int  degreeInU,
unsigned int  degreeInV,
MFnNurbsSurface::Form  formU,
MFnNurbsSurface::Form  formV,
bool  createRational,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Creates a nurbs surface from the specified data and sets this function set to operate on the new surface.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kNurbsSurfaceData then the created surface will be of type kNurbsSurfaceGeom and will be returned. The parentOrOwner will become the owner of the new surface.

If parentOrOwner is nullptr then a new transform will be created and returned which will be the parent for the surface. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new surface will be returned and the parentOrOwner will become its parent.

Note that the knot vectors must be of length spans + 2*degree - 1.

Parameters
[in]controlVerticesan array of control vertices
[in]uKnotSequencesan array of U knot values
[in]vKnotSequencesan array of V knot values
[in]degreeInUdegree of first set of basis functions
[in]degreeInVdegree of second set of basis functions
[in]formUopen, closed, periodic in U
[in]formVopen, closed, periodic in V
[in]createRationalcreate as rational (true) or non-rational (false) surface
[in]parentOrOwnerspecifies what to do with the surface. If a DAG object or nullptr is given then a transform will be created for the new surface and placed under the specified (optional)parent. If kNurbsSurfaceData is given then the surface will become its data.
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is nullptr 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 kNurbsSurfaceData
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid parameters were specified.
  • MS::kInsufficientMemory No memory available.
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure An object error has occurred.
  • MS::kInvalidForm Form was not one of the MFnNurbsSurface::Form types
  • MS::kInvalidNumberOfCVs Number of CVs doesn't match the number of knots. The number of CVs must be (numberOfUSpans+degreeInU)*(numberOfVSpans+degreeInV)
  • MS::kInvalidNumberOfKnots Number of knots in one direction is zero.
  • MS::kNotEnoughSpans Number of spans in one direction is zero. It should be (numberOfKnotsInU-(2*degreeInU)+1) or (numberOfKnotsInV-(2*degreeInV)+1)
  • MS::kDecreasingKnots Knot vector was found to be decreasing. eg. (0,0,0,1,1,0.9) It should be non-decreasing, ie. same or increasing is okay, eg. (0,0,0,1,1,1.1)
  • MS::kKnotMultiplicityTooHigh Knot vector has more than more than "degree" knots that are the same. It should have at most "degree" knots that are the same.
+ Examples:
MObject copy ( const MObject source,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method creates a copy of a nurbs surface.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kNurbsSurfaceData then the created surface will be of type kNurbsSurfaceGeom and will be returned. The parentOrOwner will become the owner of the new surface.

If parentOrOwner is nullptr then a new transform will be created and returned which will be the parent for the surface. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new surface will be returned and the parentOrOwner will become its parent.

Parameters
[in]sourcethe surface to be copied
[in]parentOrOwnerthe DAG parent or kNurbsSurfaceData the new surface will belong to
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is nullptr 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 kNurbsSurfaceData
Status Codes:
  • MS::kSuccess Surface was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Error creating surface
MObject getDataObject ( ) const

Returns an MObject if the class has been constructed with an MFn::kNurbsSurfaceData entity, otherwise MObject::kNullObj is returned.

Returns
An MObject
MObject cv ( unsigned int  indexU,
unsigned int  indexV,
MStatus ReturnStatus = NULL 
)

Returns a component for the specified CV.

Components are used to specify one or more CVs and are usefull in operating on groups of non-contiguous CVs for a curve or surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters
[in]indexUU index of CV
[in]indexVV index of CV
[out]ReturnStatusStatus code
Returns
The cv component
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid CV indicies specified.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.
MObject cvsInU ( unsigned int  startIndex,
unsigned int  endIndex,
unsigned int  rowIndex,
MStatus ReturnStatus = NULL 
)

Returns a component for the specified CVs.

Components are used to specify one or more CVs and are usefull in operating on groups of non-contiguous CVs for a curve or surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters
[in]startIndexstart CV index in U
[in]endIndexend CV index in U
[in]rowIndexrow index
[out]ReturnStatusStatus code
Returns
The component for the CVs on the given U direction.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid CV indicies specified.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.
MObject cvsInV ( unsigned int  startIndex,
unsigned int  endIndex,
unsigned int  rowIndex,
MStatus ReturnStatus = NULL 
)

Returns a component for the specified CVs on the given V direction.

Components are used to specify one or more CVs and are usefull in operating on groups of non-contiguous CVs for a curve or surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters
[in]startIndexstart CV index in V
[in]endIndexend CV index in V
[in]rowIndexrow index
[out]ReturnStatusStatus code
Returns
The component for the CVs
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid CV indicies specified.
  • MS::kInsufficientMemory No memory available.
  • MS::kFailure An object error has occurred.
MStatus getCVs ( MPointArray array,
MSpace::Space  space = MSpace::kObject 
) const

Get the positions of the CVs on this surface.

The returned group can be accessed via the MPointArray class. numCVsInU() * numCVsInV() points will be returned. Converting from uIndex, vIndex is done by "index = numCVsInV() * uIndex + vIndex".

Any modifications to these CVs will not affect this surface. setCVs should be called to modify the original surface. updateSurface should be called to cause the surface to redraw itself.

Parameters
[out]arraythe array of point values for the CVs
[in]spacespecifies the coordinate system for this operation
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.
MStatus setCVs ( const MPointArray array,
MSpace::Space  space = MSpace::kObject 
)

Set the CVs for this surface to the given points.

numCVsInU() * numCVsInV() points must be provided. Converting from uIndex, vIndex is done by "index = numCVsInV() * uIndex + vIndex".

To keep this method as fast as possible, no checking of the data is performed beyond ensuring that the total number of CVs passed in is correct. It is up to the caller to ensure that the CVs provide a valid surface, for example by ensuring that overlapping CVs in periodic surfaces have the same positions.

Parameters
[in]arrayThe array of point values of the CVs
[in]spacespecifies the coordinate system for this operation
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.
MStatus getCV ( unsigned int  indexU,
unsigned int  indexV,
MPoint pnt,
MSpace::Space  space = MSpace::kObject 
) const

Get the location of the specified CV.

Parameters
[in]indexUU index of CV
[in]indexVV index of CV
[out]pntstorage for the CV location
[in]spacecoordinate space for the CV
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.
MStatus setCV ( unsigned int  indexU,
unsigned int  indexV,
MPoint pt,
MSpace::Space  space = MSpace::kObject 
) const

Set the location of the specified CV.

If the surface is periodic then overlapping CVs will be ignored, that is, only indices in U and V that are less that the number of spans in U and V respectively will be considered.

Parameters
[in]indexUU index of CV
[in]indexVV index of CV
[in]ptnew location for the CV
[in]spacecoordinate space for the CV
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid parameter specified.
  • MS::kFailure An object error has occurred.
MFnNurbsSurface::Form formInU ( MStatus ReturnStatus = NULL) const

Return the form of this surface in U.

Form can be kOpen, kClosed, kPeriodic, or kUnknownForm.

Parameters
[out]ReturnStatusStatus code
Returns
The form of this surface in U
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MFnNurbsSurface::Form formInV ( MStatus ReturnStatus = NULL) const

Return the form of this surface in V.

Form can be kOpen, kClosed, kPeriodic, or kUnknownForm.

Parameters
[out]ReturnStatusStatus code
Returns
The form of this surface in V
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
bool isBezier ( MStatus ReturnStatus = NULL) const

Determine if the knot spacing gives us Bezier surface.

Parameters
[out]ReturnStatusStatus code
Returns
  • true Bezier surface
  • false B-spline surface
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
bool isUniform ( MStatus ReturnStatus = NULL) const

Determine if the knot spacing is uniform.

Parameters
[out]ReturnStatusStatus code
Returns
  • true Uniform knot spacing
  • false Non-uniform knot spacing
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
bool isKnotU ( double  param,
MStatus ReturnStatus = NULL 
) const

Check if the specified parameter value is a knot value.

Parameters
[in]paramparameter value to test
[out]ReturnStatusStatus code
Returns
Boolean value: true if the parameter value is a knot value, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Knot value is out of range.
  • MS::kFailure An object error has occurred.
bool isKnotV ( double  param,
MStatus ReturnStatus = NULL 
) const

Check if the specified parameter value is a knot value.

Parameters
[in]paramparameter value to test
[out]ReturnStatusStatus code
Returns
Boolean value: true if the parameter value is a knot value, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Knot value is out of range.
  • MS::kFailure An object error has occurred.
bool isParamOnSurface ( double  paramU,
double  paramV,
MStatus ReturnStatus = NULL 
) const

Check if the specified parameter is on this surface.

Parameters
[in]paramUU parameter value
[in]paramVV parameter value
[out]ReturnStatusStatus code
Returns
Boolean value: true if the parameter value on this surface, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getKnotDomain ( double &  startU,
double &  endU,
double &  startV,
double &  endV 
) const

Returns the maximum and minimum U and V paramter values for this surface.

Parameters
[out]startUStart U parameter value
[out]endUEnd U parameter value
[out]startVStart V parameter value
[out]endVEnd V parameter value
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
+ Examples:
int degreeU ( MStatus ReturnStatus = NULL) const

Returns the degree of the surface in U (1 - 3).

Parameters
[out]ReturnStatusStatus code
Returns
The degree in U
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int degreeV ( MStatus ReturnStatus = NULL) const

Returns the degree of the surface in V (1 - 3).

Parameters
[out]ReturnStatusStatus code
Returns
The degree in V
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numSpansInU ( MStatus ReturnStatus = NULL) const

Returns the number of spans in the u direction.

Parameters
[out]ReturnStatusStatus code
Returns
The number of spans in U
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numSpansInV ( MStatus ReturnStatus = NULL) const

Returns the number of spans in the v direction.

Parameters
[out]ReturnStatusStatus code
Returns
The number of spans in V
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numNonZeroSpansInU ( MStatus ReturnStatus = NULL) const

Returns the number of non-zero spans in the U direction.

This value will be equivalent to the value returned by numSpansInU() if all of the internal (non-end) knots are of multiplicity 1. If some of the internal knots have higher multiplicity, this value will be lower than that returned by numSpansInU(). You can use the number of non-zero spans to count the number of visual spans on the surface in the U direction, since the empty (zero) spans do not appear as a separate span/patch in the display.

Further, the NURBS face components have the valid index range bounded by this value in U direction (i.e., the NURBS face component index runs from 0 to numNonZeroSpansInU()-1 inclusivelly.)

Parameters
[out]ReturnStatusStatus code
Returns
The number of non-empty (non-zero, visual) spans in U
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numNonZeroSpansInV ( MStatus ReturnStatus = NULL) const

Returns the number of non-zero spans in the V direction.

This value will be equivalent to the value returned by numSpansInV() if all of the internal (non-end) knots are of multiplicity 1. If some of the internal knots have higher multiplicity, this value will be lower than that returned by numSpansInV(). You can use the number of non-zero spans to count the number of visual spans on the surface in the V direction, since the empty (zero) spans do not appear as a separate span/patch in the display.

Further, the NURBS face components have the valid index range bounded by this value in V direction (i.e., the NURBS face component index runs from 0 to numNonZeroSpansInV()-1 inclusivelly.)

Parameters
[out]ReturnStatusStatus code
Returns
The number of non-empty (non-zero, visual) spans in V
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numCVsInU ( MStatus ReturnStatus = NULL) const

Returns the number of CVs in the U direction (degree + spans).

Parameters
[out]ReturnStatusStatus code
Returns
The number of CVs in U
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numCVsInV ( MStatus ReturnStatus = NULL) const

Returns the number of CVs in the V direction (degree + spans).

Parameters
[out]ReturnStatusStatus code
Returns
The number of CVs in V
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numKnotsInU ( MStatus ReturnStatus = NULL) const

Returns the number of knots in U including multiple end knots (spans + 2 * degree - 1).

Parameters
[out]ReturnStatusStatus code
Returns
The number of knots in U
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numKnotsInV ( MStatus ReturnStatus = NULL) const

Returns the number of knots in V including multiple end knots (spans + 2 * degree - 1).

Parameters
[out]ReturnStatusStatus code
Returns
The number of knots in V
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getKnotsInU ( MDoubleArray array) const

Get the knots along the U direction for this surface.

Parameters
[out]arrayStorage for the knot values
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getKnotsInV ( MDoubleArray array) const

Get the knots along the V direction for this surface.

Parameters
[out]arrayStorage for the knot values
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setKnotsInU ( const MDoubleArray array,
unsigned int  startIndex,
unsigned int  endIndex 
)

Set the specified U knot values for this surface.

Parameters
[in]arrayThe knot values to be set
[in]startIndexThe start knot index
[in]endIndexThe end knot index
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Knots are in decreasing order or the knot index values are invalid.
  • MS::kFailure An object error has occurred.
MStatus setKnotsInV ( const MDoubleArray array,
unsigned int  startIndex,
unsigned int  endIndex 
)

Set the specified V knot values for this surface.

Parameters
[in]arrayThe knot values to be set
[in]startIndexThe start knot index
[in]endIndexThe end knot index
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Knots are in decreasing order or the knot index values are invalid.
  • MS::kFailure An object error has occurred.
double knotInU ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Retrieve the given knot value from this surface at the specified U index.

U knots are indexed from 0 to numKnotsInU()-1.

Parameters
[in]indexThe U index of the knot value to get
[out]ReturnStatusStatus code
Returns
The knot value
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
double knotInV ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Retrieve the given knot value from this surface at the specified V index.

V knots are indexed from 0 to numKnotsInV()-1.

Parameters
[in]indexThe V index of the knot value to get
[out]ReturnStatusStatus code
Returns
The knot value
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setKnotInU ( unsigned int  index,
double  param 
)

Set the value of the given existing knot at the specified U index.

U knots are indexed from 0 to numKnotsInU()-1. Note that this method does not insert a new knot, it simply changes the value of a knot that already exists.

If a knot value is set that breaks the non-decreasing requirement for the knot array, the knot value will be changed and a kInvalidParameter error will be returned.

Parameters
[in]indexThe U index of the existing knot to be set
[out]paramThe new parameter value for the knot
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Knot index out of range or new knot value breaks the non-decreasing requirement for the knot array.
  • MS::kFailure An object error has occurred.
MStatus setKnotInV ( unsigned int  index,
double  param 
)

Set the value of the given existing knot at the specified V index.

V knots are indexed from 0 to numKnotsInV()-1. Note that this routine does not insert a new knot, it simply changes the value of a knot that already exists.

If a knot value is set that breaks the non-decreasing requirement for the knot array, the knot value will be changed and a kInvalidParameter error will be returned.

Parameters
[in]indexThe V index of the existing knot to be set
[in]paramThe new value for the knot
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Knot index out of range or new knot value breaks the non-decreasing requirement for the knot array.
  • MS::kFailure An object error has occurred.
MStatus removeKnotInU ( double  atThisParam,
bool  removeAll = false 
)

Remove the U knot(s) at the specified parameter value from this surface.

If there are multiple knots at this parameter then removeAll is used to specify how to do the removal.

Parameters
[in]atThisParamParameter of knot to be removed
[in]removeAllIf true then remove all the knots at the given parameter, otherwise remove all except one knot
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus removeKnotInV ( double  atThisParam,
bool  removeAll = false 
)

Remove the V knot(s) at the specified parameter value from this surface.

If there are multiple knots at this parameter then removeAll is used to specify how to do the removal.

Parameters
[in]atThisParamParameter of knot to be removed
[in]removeAllIf true then remove all the knots at the given parameter, otherwise remove all except one knot
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus removeOneKnotInU ( double  atThisParam)

Remove one U knot at the specified parameter value from this surface.

Parameters
[in]atThisParamParameter of knot to be removed
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus removeOneKnotInV ( double  atThisParam)

Remove one V knot at the specified parameter value from this surface.

Parameters
[in]atThisParamParameter of knot to be removed
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MVector normal ( double  paramInU,
double  paramInV,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

Retrieve the normal at the given parameter value on the surface.

Parameters
[in]paramInUU parameter at which to obtain normal
[in]paramInVV parameter at which to obtain normal
[in]spaceCoordinate space for the returned vector
[out]ReturnStatusStatus code
Returns
The normal vector
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Error getting normal.
  • MS::kFailure An object error has occurred.
MStatus getTangents ( double  paramInU,
double  paramInV,
MVector vectorInU,
MVector vectorInV,
MSpace::Space  space = MSpace::kObject 
) const

Retrieve the tangents in the U and V directions at the given parameter value on the surface.

The returned tangent vectors are normalized.

This method does not fail if the given parameter lies within a trimmed away region of a trimmed surface. Use the 'isPointInTrimmedRegion' method to determine if the uv point lies within such a region.

Parameters
[in]paramInUU parameter value at which to obtain tangents
[in]paramInVV parameter value at which to obtain tangents
[out]vectorInUStorage for the U tangent vector
[out]vectorInVStorage for the V tangent vector
[in]spaceCoordinate space for the returned vectors
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Error getting tangents.
  • MS::kFailure An object error has occurred.
MStatus getDerivativesAtParm ( double  paramInU,
double  paramInV,
MPoint pos,
MVector dU,
MVector dV,
MSpace::Space  space,
MVector dUU = NULL,
MVector dVV = NULL,
MVector dUV = NULL 
) const

Evaluate the surface at the given (u,v) coordinate returning position, first derivatives and optionally second derivative information.

The returned derivative vectors are not normalized. If either dUU, dVV, or dUV is set to nullptr, the second derivatives will not be computed and execution time wil be faster.

Parameters
[in]paramInUU parameter value to evaluate
[in]paramInVV parameter value to evaluate
[out]posStorage for the XYZ position of (u,v)
[out]dUStorage for the first order partial derivative with respect to u
[out]dVStorage for the first order partial derivative with respect to v
[in]spaceCoordinate space for the returned vectors
[out]dUUPointer to storage for the second order partial derivative with respect to u
[out]dVVPointer to storage for the second order partial derivative with respect to v
[out]dUVPointer to storage for the second order partial derivative with respect to u then v
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Parameters do not define a point on the surface
  • MS::kFailure An object error has occurred.
bool isFoldedOnBispan ( ) const

Evaluate the surface to determine if it contains any folds or creases.

The entire surface including trimmed regions is examined. This function will only check for folds on bispan boundaries and thus will not catch all cases.

Returns
  • true There are folds or creases detected
  • false The surface is believed to have continuous curvature
double area ( double  tolerance = kMFnNurbsEpsilon,
MStatus ReturnStatus = NULL 
) const

Calculates the surface area of this nurbs surface.

A value of 0.0 will be returned if the area cannot be determined successfully.

Parameters
[in]tolerancetolerance value to be used for computations
[out]ReturnStatusStatus code
Returns
The area of this surface
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
double area ( MSpace::Space  space,
double  tolerance = kMFnNurbsEpsilon,
MStatus ReturnStatus = NULL 
) const

Calculates the surface area of this nurbs surface in world or local space.

A value of 0.0 will be returned if the area cannot be determined successfully.

Parameters
[in]spaceCoordinate space for the returned vectors
[in]toleranceTolerance value to be used for computations
[out]ReturnStatusStatus code
Returns
The area of this surface
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MPoint closestPoint ( const MPoint toThisPoint,
double *  paramU = NULL,
double *  paramV = NULL,
bool  ignoreTrimBoundaries = false,
double  tolerance = kMFnNurbsEpsilon,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

Return the closest point on this surface to the given point.

Parameters
[in]toThisPointPoint to be compared.
[out]paramUU parameter value of the closest point. Ignored if null.
[out]paramVV parameter value of the closest point. Ignored if null.
[in]ignoreTrimBoundariesIf this is true and the surface is trimmed, look for the point on the entire, untrimmed surface ignoring any trim curves.
[in]toleranceTolerance value to be used for computations.
[in]spaceCoordinate space in which perform this operation,
[out]ReturnStatusStatus code.
Returns
The closest point on this surface to the given point
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.
MPoint closestPoint ( const MPoint toThisPoint,
bool  paramAsStart,
double *  paramU,
double *  paramV,
bool  ignoreTrimBoundaries = false,
double  tolerance = kMFnNurbsEpsilon,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

Return the closest point on this surface to the given point.

Performance can be greatly increased by supplying a starting parameter value that is reasonably close to the final point and setting 'paramAsStart' to true. However great care must be taken with the use of this parameter and the choice of starting value.

If 'paramAsStart' is true, the algorithm will begin to search for the closest point at the given parameter value, and will check the local surface to see which direction will bring it closer to the given point. It then offsets in this direction and repeats the process, iteratively traversing the surface until it finds the closest point.

This algorithm will fail if it encounters a seam before reaching the closest point, or if it finds a local closest point, such as a bulge on a mesh where an offset in any direction will take it further from the given point, even if that is not the true closest point on the mesh. For this reason it is advisable to avoid using this option unless absolutely sure that the initial point will be a good enough approximation to the final point that these conditions will not occur.

Parameters
[in]toThisPointPoint to be compared
[in]paramAsStartIf true use the value pointed to by paramU and paramV as a starting point for the search
[in,out]paramUReturns the U parameter value of the closest point. if 'paramAsStart' is true then the value initially passed in by the caller will be used as the starting U value for the search. Ignored if null.
[in,out]paramVReturns the V parameter value of the closest point. if 'paramAsStart' is true then the value initially passed in by the caller will be used as the starting V value for the search. Ignored if null.
[in]ignoreTrimBoundariesif this is true and the surface is trimmed, look for the point on the entire, untrimmed surface ignoring any trim curves.
[in]tolerancetolerance value to be used for computations
[in]spaceCoordinate space in which perform this operation
[out]ReturnStatusStatus code
Returns
The closest point on this surface to the given point
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.
bool isPointOnSurface ( const MPoint point,
double  tolerance = kMFnNurbsEpsilon,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

Check if the given point is on this surface.

Parameters
[in]pointPoint to test
[in]tolerancetolerance value to be used for computations
[in]spaceCoordinate space for this operation
[out]ReturnStatusStatus code
Returns
Boolean value: true if the given point is on this surface, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.
MStatus getParamAtPoint ( const MPoint atThisPoint,
double &  paramU,
double &  paramV,
bool  ignoreTrimBoundaries,
MSpace::Space  space = MSpace::kObject,
double  tolerance = kMFnNurbsEpsilon 
) const

Get the parameter value corresponding to the given point on the surface (or underlying surface).

Note, when ignoreTrimBoundaries if false, the UV parameters will still be returned if found on the untrimmed surface even though MS::kFailure is returned. This may be useful in cases where you are walking a trim edge and points are determined to be trimmed away because of slight differences between the trim edge and the actual trimmed surface.

Parameters
[in]atThisPointLocation of parameter to obtain
[out]paramUstorage for the U parameter value
[out]paramVstorage for the V parameter value
[in]ignoreTrimBoundariesif this is true and the surface is trimmed, look for the param on the entire, untrimmed surface ignoring any trim curves.
[in]spaceCoordinate space in which to perform this operation
[in]tolerancetolerance used in this operation
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid parameter specified.
  • MS::kFailure An object error has occurred.
MStatus getPointAtParam ( double  paramU,
double  paramV,
MPoint point,
MSpace::Space  space = MSpace::kObject 
) const

Finds the point corresponding to the given parameter value on the surface.

This method does not fail if the given parameter lies within a trimmed away region of a trimmed surface. Use the 'isPointInTrimmedRegion' method to determine if the uv point lies within such a region.

Parameters
[in]paramUU parameter value
[in]paramVV parameter value
[out]pointstorage for the found point
[in]spaceCoordinate space in which to perform this operation
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid parameter specified.
  • MS::kFailure An object error has occurred.
double distanceToPoint ( const MPoint pt,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

Returns the distance from the given point to the closest point on the surface.

Parameters
[in]ptPoint to calculate distance from
[in]spaceCoordinate space for which to perform operation
[out]ReturnStatusStatus code
Returns
The distance to the given point from this surface
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.
MObject tesselate ( MTesselationParams parms = MTesselationParams::fsDefaultTesselationParams,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Performs tesselation on this surface and create a new mesh in the DAG.

The type of tesselation can be controlled by providing the tesselation parameters (see MTesselationParams).

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

Parameters
[in]parmsTesselation parameters
[in]parentOrOwnerthe DAG parent or kMeshData the new mesh will belong to
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is nullptr 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 Method successful
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Object error
bool intersect ( const MPoint rayStartingPoint,
const MVector alongThisDirection,
double &  u,
double &  v,
MPoint pntOfIntersection,
double  tolerance = kMFnNurbsEpsilon,
MSpace::Space  space = MSpace::kObject,
bool  calculateDistance = false,
double *  distance = NULL,
bool  calculateExactHit = false,
bool *  wasExactHit = NULL,
MStatus ReturnStatus = NULL 
) const

This function determines the closest point of intersection of this spline surface with a ray (a vector at a point).

Parameters
[in]rayStartingPointStarting location of ray to test.
[in]alongThisDirectionDirection of ray to test.
[out]uU parameter of intersection (if any).
[out]vV parameter of intersection (if any).
[out]pntOfIntersectionClosest point of intersection (if any).
[in]toleranceThe epsilon value in the calculation.
[in]spaceSpecifies the coordinate system for this operation.
[in]calculateDistanceSpecifies whether to calculate the distance of the startPoint to the point of intersection
[out]distanceDistance of intersection point from startPoint. Ignored if 'calculateDistance' is false.
[in]calculateExactHitSpecifies whether to determine if the point of intersection actually hit the object or just came within tolerance of it.
[out]wasExactHitReturns true if the point of intersection is an exact hit, false otherwise. Ignored if 'calculateExactHit' if false.
[out]ReturnStatusStatus code.
Returns
Boolean value: true if an intersection point has been found, false otherwise.
Status Codes:
  • MS::kSuccess Method successful
  • MS::kFailure Object error
bool intersect ( const MPoint rayStartingPoint,
const MVector alongThisDirection,
MDoubleArray uArray,
MDoubleArray vArray,
MPointArray points,
double  tolerance = kMFnNurbsEpsilon,
MSpace::Space  space = MSpace::kObject,
bool  calculateDistance = false,
MDoubleArray distances = NULL,
bool  calculateExactHit = false,
bool *  wasExactHit = NULL,
MStatus ReturnStatus = NULL 
) const

This function determines all the points of intersection of this spline surface with a ray (a vector at a point).

Parameters
[in]rayStartingPointStarting location of ray to test.
[in]alongThisDirectionDirection of ray to test.
[out]uArrayU parameters of intersections.
[out]vArrayV parameters of intersections.
[out]pointsPoints of intersection.
[in]toleranceThe epsilon value in the calculation.
[in]spaceSpecifies the coordinate system for this operation.
[in]calculateDistanceSpecifies whether to calculate the distances of the startPoint to the all the points of intersection.
[out]distancesDistances of intersection points from startPoint. Ignored if 'calculateDistance' is false.
[in]calculateExactHitSpecifies whether to determine if the point of intersection actually hit the object or just came within tolerance of it.
[out]wasExactHitReturns true if the point of intersection is an exact hit, false otherwise. Ignored if 'calculateExactHit' if false.
[out]ReturnStatusStatus code.
Returns
Boolean value: true if an intersection point has been found, false otherwise.
Status Codes:
  • MS::kSuccess Method successful
  • MS::kFailure Object error
bool hasHistoryOnCreate ( MStatus ReturnStatus = NULL) const

This method determines if the shape was created with history.

If the object that this function set is attached to is not a shape then this method will fail.

Parameters
[out]ReturnStatus
Returns
Boolean value: true if the shape has history, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus updateSurface ( )

This method signals that this surface has changed and needs to be recalculated.

This method is useful when a large number of CVs for the surface are being modified. Instead of updating the surface every time a CV is changed it is more efficient to call this method once after updating all of the CVs.

Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
bool isTrimmedSurface ( MStatus ReturnStatus = NULL) const

This method determines if this surface is a trimmed surface.

Parameters
[out]ReturnStatus
Returns
Boolean value: true if the surface is trimmed, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
+ Examples:
unsigned int numRegions ( MStatus ReturnStatus = NULL) const

Returns the number of trimmed regions for this surface or 0 if the surface is not a trimmed surface.

For each region there may be several boundary curves, an outer curve and possibly several inner boundary curves which define holes. These boundary curves are made up of one or more curves called edges.

Parameters
[out]ReturnStatus
Returns
The number of regions for this surface
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
bool isFlipNorm ( unsigned int  region,
MStatus ReturnStatus = NULL 
) const

Determines whether the normal for the specified region is flipped.

This method is only valid for trimmed surfaces.

Parameters
[in]regionTrimmed region to check. Must be in the range 0 to numRegions() - 1.
[out]ReturnStatusStatus code
Returns
  • true normal = -dS/du X dS/dv
  • false normal = dS/du X dS/dv
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
unsigned int numBoundaries ( unsigned int  region,
MStatus ReturnStatus = NULL 
)

Returns the number of boundaries for the specified region.

The surface must be a trimmed surface.

For each region there may be several boundary curves, an outer curve and possibly several inner boundary curves which define holes. These boundary curves are made up of one or more curves called edges.

Parameters
[in]regionThe trimmed region to examine
[out]ReturnStatusstatus code
Returns
The number of boundaries for the specified region
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MFnNurbsSurface::BoundaryType boundaryType ( unsigned int  region,
unsigned int  boundary,
MStatus ReturnStatus = NULL 
)

Returns the type of the specified boundary.

The surface must be a trimmed surface.

Possible boundary types are Inner, kOuter, kSegment, kClosedSegment, and kInvalidBoundary

Parameters
[in]regionthe region to examine
[in]boundarythe boundary to examine
[out]ReturnStatusstatus code
Returns
The boundary type:
  • kInner an inner boundary, clockwise
  • kOuter an outer boundary, counter clockwise
  • kSegment a boundary segment (a curve on face)
  • kClosedSegment a closed boundary segment (a closed curve on face)
  • kInvalidBoundary an invalid boundary type
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
unsigned int numEdges ( unsigned int  region,
unsigned int  boundary,
MStatus ReturnStatus = NULL 
)

Return the number of edges for the specified trim boundary.

For each region there may be several boundary curves, an outer curve and possibly several inner boundary curves which define holes. These boundary curves are made up of one or more curves called edges.

Parameters
[in]regionRegion to examine
[in]boundaryBoundary to examine
[out]ReturnStatusStatus code
Returns
The number of edges for the specified boundary
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MObjectArray edge ( unsigned int  region,
unsigned int  boundary,
unsigned int  edge,
bool  paramEdge = false,
MStatus ReturnStatus = NULL 
)

Return the specified edge of a trim boundary.

For each region of a trimmed surface there may be several boundary curves: an outer curve and possibly several inner boundary curves (which define holes). These boundary curves are made up of one or more curves called edges. The edge is returned as an MObjectArray as the edge may consist of more than one curve. The returned edge, or trim curve, can be a 2D parameter edge or a 3D edge curve. To identify an edge you must specify the trimmed region, the boundary of that region, and the edge of that boundary.

Note that for closed surfaces some of the 3d edges may be 0 length in which case an empty MObjectArray is returned. An example of this is the poles of a sphere.

Parameters
[in]regionthe trimmed region containing the edge
[in]boundarythe boundary to examine
[in]edgethe boundary edge to examine
[in]paramEdgeif true then 2D param edges are returned, otherwise a 3D edge is returned.
[out]ReturnStatusstatus code
Returns
A curve for the specified edge
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
  • MS::kInvalidParameter Invalid region, boundary or edge
  • MS::kInsufficientMemory Out of memory.
bool isPointInTrimmedRegion ( double  u,
double  v,
MStatus ReturnStatus = NULL 
)

Returns true if the given point is in a trimmed away region of a trimmed surface.

A trimmed away region is the part of the surface that is cut away as a result of a trim operation.

Parameters
[in]uu parameter of point on surface to test
[in]vv parameter of point on surface to test
[out]ReturnStatusstatus code
Returns
Boolean value: true if the point on surface is within a trimmed away region, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid parameters were specified.
  • MS::kFailure An object error has occurred.
MStatus getTrimBoundaries ( MTrimBoundaryArray result,
unsigned int  region,
bool  paramEdge = true 
)

Returns all trim boundaries of a region on this surface.

Parameters
[out]resultAll trim boundaries of the given region in this surface.
[in]regionthe trimmed region containing the boundaries
[in]paramEdgeIf true, then 2D curves are returned, otherwise 3D curves.
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus trimWithBoundaries ( const MTrimBoundaryArray mBoundaries,
bool  flipNormal = false,
double  e_tol = 1e-3,
double  pe_tol = 1e-5,
bool  createNewRegion = false 
)

This function trims this surface with given trim boundaries.

NOTE: The curves specified in the MTrimBoundaryArray are in UV space. As a result, they must be 2D curves. The MFnNurbsCurve functionset provides a method for creating 2D curves.

Parameters
[in]mBoundariesThe boundaries used for the trim. A boundary may consist of several curves. They must present a closed boundary, must be in UV (parameter) space, and must be on the surface. Boundaries[0] is the outer boundary which goes counterclockwise around the surface normal. All other boundaries must be inner boundaries inside the outer boundary defined region. A clockwise inner boundary defines a hole. Boundaries[0] can be empty. In this case, the native boundary is used as outer boundary. The boundaries should not intersect each other or themselves.
[in]flipNormalWhether to flip the trimmed surface normal
[in]e_tolThe 3d edge tolerance with which to trim
[in]pe_tolThe parameter edge tolerance with which to trim
[in]createNewRegionWhether to create a new region on the trimmed surface. A region is a disjoint area of a trimmed surface.
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
+ Examples:
MStatus projectCurve ( const MDagPath curve,
const MVector direction = NULL,
bool  constructionHistory = false 
)

Project the given curve onto this surface creating a curve on surface.

Projection will be done using the surface normals unless a direction vector to project along is given.

Parameters
[in]curvecurve to be projected
[in]directiondirection of projection. If this is null then the surface normals is used
[in]constructionHistorykeep construction history
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus trim ( const MDoubleArray locatorU,
const MDoubleArray locatorV,
bool  constructionHistory = false 
)

Trim this surface to its curves on surface.

Regions which are kept are specified by passing in two arrays of u,v parameters.

This method will create a new trimmed surface in the DAG. The surface attached to this function set will remain unchanged.

Parameters
[in]locatorUarray of U parameters indicating regions to keep
[in]locatorVarray of V parameters indicating regions to keep
[in]constructionHistorykeep construction history
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
unsigned int numPatches ( MStatus ReturnStatus = NULL) const

Returns the number of non-zero patches in this surface.

Parameters
[out]ReturnStatusStatus code
Returns
The number of non-zero patches in this surface.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
unsigned int numPatchesInU ( MStatus ReturnStatus = NULL) const

Returns the number of non-zero patches along u, in this surface.

Parameters
[out]ReturnStatusStatus code
Returns
The number of non-zero patches along u, in this surface.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
unsigned int numPatchesInV ( MStatus ReturnStatus = NULL) const

Returns the number of non-zero patches along v, in this surface.

Parameters
[out]ReturnStatusStatus code
Returns
The number of non-zero patches along v, in this surface.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
int numUVs ( MStatus ReturnStatus = NULL) const

Returns the number of texture (uv) coordinates for this surface.

The uv's are stored in a list which is referenced by patches requiring textures on a per-patch per-patchCorner basis. This method returns the number of elements in this list.

Parameters
[out]ReturnStatusStatus code
Returns
The number of texture coordinates
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setUVs ( const MFloatArray uArray,
const MFloatArray vArray 
)

Sets all of the texture coordinates (uvs) for this surface.

The uv arrays must be of equal size and must be at least of length numUVs(). If the arrays are larger than numUVs() then the uv list for this surface will be grown to accommodate the new uv values.

After using this method to set the UV values, you can call assignUVs to assign the corresponding UVids to the geometry.

Also, note that API methods that modify uv data, work correctly either when called through a plug-in node that is in the history of the shape, or when used on a surface shape that does not have history. Modifying uvs directly on a shape with history will result in the modifications getting over-written by the next evaluation of the history attached to the shape.

Parameters
[in]uArrayThe array of u values to be set
[in]vArrayThe array of v values to be set
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter uArray and vArray lengths do not match or the arrays are smaller than numUVs().
  • MS::kFailure An object error has occurred.
MStatus getUVs ( MFloatArray uArray,
MFloatArray vArray 
) const

This method copies the texture coordinate list for this surface into the given uv arrays.

Parameters
[out]uArrayStorage for the u texture coordinate list
[out]vArrayStorage for the v texture coordinate list
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus setUV ( int  uvId,
float  u,
float  v 
)

Sets the specified texture coordinate.

The uvId is the element in the uv list that will be set. If the uvId is greater than or equal to numUVs() then the uv list will be grown to accommodate the specified uv.

Also, note that API methods that modify uv data, work correctly either when called through a plug-in node that is in the history of the shape, or when used on a surface shape that does not have history. Modifying uvs directly on a shape with history will result in the modifications getting over-written by the next evaluation of the history attached to the shape.

Parameters
[in]uvIdthe element in the uv list to be set
[in]uthe new u value that is to be set
[in]vthe new v value that is to be set
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getUV ( int  uvId,
float &  u,
float &  v 
) const

Get the value of the specified texture coordinate from this surface's uv list.

The uvId is the element in the uv list that will be retrieved.

Parameters
[in]uvIdthe element in the uv list to examine
[out]ustorage for the u value
[out]vstorage for the v value
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid uvId. The uvId should be less than numUVs().
  • MS::kFailure An object error has occurred.
MStatus getPatchUV ( int  patchId,
int  cornerIndex,
float &  u,
float &  v 
) const

Get the value of the specified texture coordinate for a patch corner in a patch.

Since texture coordinates (uv's) are stored per-patch per-corner you must specify both the patch and the corner that the u and v values are mapped to.

Parameters
[in]patchIdThe patch to examine
[in]cornerIndexThe patch-relative corner to examine
[out]ustorage for the u value
[out]vstorage for the v value
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid patchId or cornerIndex specified.
  • MS::kFailure An object error has occurred.
MStatus getPatchUVs ( int  patchId,
MFloatArray uArray,
MFloatArray vArray 
) const

Get the values of the texture coordinate on a specified patch.

Since texture coordinates (uvs) are stored per-patch per-corner, the u and v values mapped to all corners of the specified patch are returned.

Parameters
[in]patchIdThe patch to examine
[out]uArraystorage for u values
[out]vArraystorage for v values
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid patchId specified.
  • MS::kFailure An object error has occurred.
MStatus getPatchUVid ( int  patchId,
int  cornerIndex,
int &  uvId 
) const

Get the id of the specified texture coordinate for a corner in a patch.

Parameters
[in]patchIdThe patch to examine
[in]cornerIndexThe patch-relative corner to examine (local index)
[out]uvIdstorage for the uv index
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid patchId or cornerIndex specified.
  • MS::kFailure An object error has occurred.
MStatus assignUV ( int  patchId,
int  cornerIndex,
int  uvId 
)

Maps a texture coordinate to a the specified corner of a patch.

Since texture coordinates (uvs) are stored per-patch per-patchCorner you must specify both the patch and the patchCorner that the uv entry is mapped to.

The cornerIndex is the corner within the patch that the uv will be mapped to. This index must be in the range 0 to patchCornerCount(patchId).

Also, note that API methods that modify uv data, work correctly either when called through a plug-in node that is in the history of the shape, or when used on a surface shape that does not have history. Modifying uvs directly on a shape with history will result in the modifications getting over-written by the next evaluation of the history attached to the shape.

Parameters
[in]patchIdThe patch to map to
[in]cornerIndexThe corner of the patch to map to
[in]uvIdThe uv entry from the uv list that will be mapped
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid patchId, cornerIndex, or uvId specified.
  • MS::kFailure An object error has occurred.
MStatus assignUVs ( const MIntArray uvCounts,
const MIntArray uvIds 
)

This method maps all texture coordinates for the surface.

The setUV/setUVs method is used to create the texture coordinate table for the surface. After the table is created, this method is used to map those values to each patch on a per-corner basis. The setUV/setUVs method should be called before the assignUVs method.

The uvCounts array should contain the number of uvs per patch. Since uvs are mapped per-patch per-corner, the entries in this array should match the corner counts for each patch in the surface.

If an entry in this array is '0' then the corresponding patch will not be mapped. The sum of all the entries in the uvCounts array must be equal to the size of the uvIds array or this method will fail.

The uvIds array should contain the UV indices that will be mapped to each patch-corner in the surface. The entries in this array specify which uvs in the surface's uv table are mapped to each patch-corner. Each entry in the uvIds array must be less than numUVs(). The size of the uvIds array is equivalent to adding up all of the entries in the uvCounts array, so for a cube with all patches mapped there would be 24 entries.

Also, note that API methods that modify uv data, work correctly either when called through a plug-in node that is in the history of the shape, or when used on a surface shape that does not have history. Modifying uvs directly on a shape with history will result in the modifications getting over-written by the next evaluation of the history attached to the shape.

Parameters
[in]uvCountsThe uv counts for each patch in the surface
[in]uvIdsThe uv indices to be mapped to each patch-corner
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid uvCounts array or invalid uvIds array.
  • MS::kFailure An object error has occurred.
MStatus clearUVs ( )

This method clears out all texture coordinates for the nurbsSurface, and leaves behind an empty UVset.

This method should be used if it is needed to shrink the actual size of the UV table. In this case, the user should call clearUVs, setUVs and then assignUVs to rebuild the mapping info.

When called on a dataNurbsSurface, the UVs are removed. When called on a shape with no history, the UVs are removed and the attributes are set on the shape. When called on a shape with history, the polyDelMap command is invoked and a polyMapDel node is created.

Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid uvCounts array or invalid uvIds array.
  • MS::kInvalidIndex Invalid uvSet was specified
  • MS::kFailure An object error has occurred.
MStatus getAssignedUVs ( MIntArray uvCounts,
MIntArray uvIds 
) const

Get assigned UVs.

This method finds all texture coordinates for the surface that have been mapped, and returns them in the same format as assignUVs. The setUV/setUVs method is used to create the texture coordinate table for the surface and this method is used to map those values to each patch on a per-corner basis.

The uvCounts array should contain the number of uv's per patch. Since uvs are mapped per-patch per-corner, the entries returned in this array will match the corner counts for each patch in the surface. For example, suppose that we have a cube with 2 of the faces mapped: the array for this cube would be { 4, 4, 0, 0, 0, 0 } since there are 6 patches each with 4 vertices. A face either has all its vertives mapped, or none

The uvIds array will contain the UV indices that will be mapped to each patch-corner in the surface. Use the getUV method to get the actual uv values for these id's.

Parameters
[out]uvCountsThe uv counts for each patch in the surface
[out]uvIdsThe uv indices to be mapped to each patch-corner
Returns
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid uvCounts array or invalid uvIds array.
  • MS::kFailure An object error has occurred.
MStatus getConnectedShaders ( unsigned int  instanceNumber,
MObjectArray shaders,
MIntArray indices 
) const

Returns all the shaders (sets) connected to the specified instance of this surface, as well as an array of patch/shader assignments.

The indices array will hold, for each patch in the surface, an index into the shaders array. If a patch 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.

Note: This method will only work with a MFnNurbsSurface function set which has been initialized with an MFn::kNurbsSurface.

See also getConnectedSetsAndMembers.

Parameters
[in]instanceNumberThe instance number of the surface to query
[out]shadersStorage for set objects (shader objects)
[out]indicesStorage for indices matching patches to shaders. For each patch, this array contains the index into the shaders array for the shader assigned to the patch.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getParamAtPoint ( const MPoint atThisPoint,
double &  paramU,
double &  paramV,
MSpace::Space  space = MSpace::kObject 
) const

This method is obsolete.

Deprecated:
This method is obsolete and simply calls the overloaded MFnNurbsSurface::getParamAtPoint method with ignoreTrimBoundaries set to false.
Parameters
[in]atThisPoint
[out]paramU
[out]paramV
[in]space
Returns
Status code
MObject tesselate ( MTesselationParams parms,
MStatus ReturnStatus 
)

This method is obsolete.

Deprecated:

Performs tesselation on this surface and returns the tesselated polygonal object. The type of tesselation can be controlled by providing the tesselation parameters (see MTesselationParams).

Parameters
[in]parmsTesselation parameters
[out]ReturnStatusStatus code
Returns
A polygonal representation of this surface
Status Codes:
  • MS::kSuccess Method successful
  • MS::kFailure Object error

The documentation for this class was generated from the following files:
  • MFnNurbsSurface.h
  • MFnNurbsSurface.cpp