C++ API Reference

NURBS curve function set. More...

#include <MFnNurbsCurve.h>

+ Inheritance diagram for MFnNurbsCurve:

Public Types

enum  Form {
  kInvalid, kOpen, kClosed, kPeriodic,
  kLast
}
 Forms that a curve may take. 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 ~MFnNurbsCurve ()
 Destructor. More...
 
 MFnNurbsCurve ()
 Default constructor.
 
 MFnNurbsCurve (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MFnNurbsCurve (const MDagPath &object, MStatus *ret=NULL)
 Constructor. More...
 
MObject create (const MPointArray &controlVertices, const MDoubleArray &knotSequences, unsigned int degree, Form agForm, bool create2D, bool createRational, MObject &parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method creates a nurbs curve from the given control vertices and knot vector and sets this function set to operate on the new curve. More...
 
MObject createWithEditPoints (const MPointArray &editPoints, unsigned int degree, Form agForm, bool create2D, bool createRational, bool uniformParam, MObject &parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method creates a nurbs curve from the given edit points and sets this function set to operate on the new curve. More...
 
MObject create (const MObjectArray &sources, MObject &parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method creates a single curve that combines all the curves in the MObjectArray. More...
 
MObject copy (const MObject &source, MObject &parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method creates a copy of a nurbs curve. More...
 
MStatus reverse (bool constructionHistory=false)
 This method reverse the curve direction. More...
 
MStatus makeMultipleEndKnots ()
 This method gives end knots full multiplicity. More...
 
MObject cv (unsigned int index, MStatus *ReturnStatus=NULL) const
 Returns a CV as a component. More...
 
MStatus getCV (unsigned int index, MPoint &pt, MSpace::Space space=MSpace::kObject) const
 Get the CV at the given index. More...
 
MStatus setCV (unsigned int index, const MPoint &pt, MSpace::Space space=MSpace::kObject)
 Set the CV at the given index to the given point. More...
 
Form form (MStatus *ReturnStatus=NULL) const
 This method returns the form of the curve. More...
 
int degree (MStatus *ReturnStatus=NULL) const
 Return the degree of this curve. More...
 
int numCVs (MStatus *ReturnStatus=NULL) const
 Return the number of CVs for this curve. More...
 
int numSpans (MStatus *ReturnStatus=NULL) const
 Return the number of spans for this curve. More...
 
int numKnots (MStatus *ReturnStatus=NULL) const
 Return the number of knots for this curve. More...
 
MStatus getKnotDomain (double &start, double &end) const
 Return the range corresponding to the maximum and minimum parameter values for this curve. More...
 
MStatus getKnots (MDoubleArray &array) const
 This method retrieves a copy of the knot array for this curve. More...
 
MStatus setKnots (const MDoubleArray &array, unsigned int startIndex, unsigned int endIndex)
 This method is used to set the values of a contiguous group of knots of the curve. More...
 
MStatus setKnot (unsigned int index, double param)
 Set the given knot's parameter value. More...
 
MObject cvs (unsigned int startIndex, unsigned int endIndex, MStatus *ReturnStatus=NULL) const
 Returns a contiguous group of CVs as a component. More...
 
MStatus getCVs (MPointArray &array, MSpace::Space space=MSpace::kObject) const
 Get the positions of the CVs of this curve. More...
 
MStatus setCVs (const MPointArray &array, MSpace::Space space=MSpace::kObject)
 Set the CVs for this curve to the given points. More...
 
double knot (unsigned int index, MStatus *ReturnStatus=NULL) const
 Get the parameter value of the specified knot for this curve. More...
 
MStatus removeKnot (double atThisParam, bool removeAll=false)
 Remove one or more knots at the given parameter. More...
 
bool isPointOnCurve (const MPoint &point, double tolerance=kMFnNurbsEpsilon, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 Determines whether the given point is on this curve. More...
 
MStatus getPointAtParam (double param, MPoint &point, MSpace::Space space=MSpace::kObject) const
 Returns the point in space that is at the given parameter value of the curve. More...
 
MStatus getParamAtPoint (const MPoint &atThisPoint, double &param, MSpace::Space space=MSpace::kObject) const
 This method retrieves the parameter value corresponding to the given point on the curve. More...
 
MStatus getParamAtPoint (const MPoint &atThisPoint, double &param, double tolerance, MSpace::Space space=MSpace::kObject) const
 This method retrieves the parameter value corresponding to the given point on the curve. More...
 
bool isParamOnCurve (double param, MStatus *ReturnStatus=NULL) const
 Determines whether the specified parameter value is within the bounds of the knot vector of this curve. More...
 
MVector normal (double param, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 This method returns the normal at the given parameter value on the curve. More...
 
MVector tangent (double param, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 This method returns the tangent at the given parameter value on the curve. More...
 
MStatus getDerivativesAtParm (double param, MPoint &pos, MVector &dU, MSpace::Space space, MVector *dUU=NULL) const
 Evaluate the curve at the given parameter returning the position, first derivative and optionally the second derivative. More...
 
bool isPlanar (MVector *planeNormal=NULL, MStatus *ReturnStatus=NULL) const
 This method determines if this curve is a planar curve. More...
 
MPoint closestPoint (const MPoint &toThisPoint, double *param=NULL, double tolerance=kMFnNurbsEpsilon, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 This method determines the closest point on the curve to the given point. More...
 
MPoint closestPoint (const MPoint &toThisPoint, bool paramAsGuess, double *param=NULL, double tolerance=kMFnNurbsEpsilon, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 This method determines the closest point on the curve to the given point. More...
 
double distanceToPoint (const MPoint &pt, MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
 Returns the distance from the given point to the point on the curve which is closest to it. More...
 
double area (double tolerance=kMFnNurbsEpsilon, MStatus *ReturnStatus=NULL) const
 This method returns the area bounded by this curve. More...
 
double length (double tolerance=kMFnNurbsEpsilon, MStatus *ReturnStatus=NULL) const
 Return the arc length of this curve or 0.0 if it cannot be computed. More...
 
double findParamFromLength (double partLength, MStatus *ReturnStatus=NULL) const
 Returns the parameter value corresponding to a given length along the curve. More...
 
double findParamFromLength (double partLength, double tolerance, MStatus *ReturnStatus=NULL) const
 Returns the parameter value corresponding to a given length along the curve with the given tolerance. More...
 
double findLengthFromParam (double param, MStatus *ReturnStatus=NULL) const
 Returns the length along the curve corresponding to a given parameter value on the curve. More...
 
bool hasHistoryOnCreate (MStatus *ReturnStatus=NULL) const
 This method determines if the shape was created with history. More...
 
MStatus updateCurve ()
 This method signals that this curve has changed and needs to be recalculated. More...
 
MObject rebuild (unsigned int spans, unsigned int degree=3, unsigned int keepRange=1, unsigned int endKnots=0, bool keepEndPoints=true, bool keepTangents=true, bool keepControlPoints=false, float tolerance=0.01f, MStatus *ReturnStatus=NULL) const
 This method rebuilds a new curve based on the current curve and parameters. More...
 
 MFnNurbsCurve (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
 This method is obsolete. More...
 
MStatus setUseObjectColor (bool useObjectColor)
 This method is obsolete. More...
 
MObjectColorType objectColorType (MStatus *ReturnStatus=NULL) const
 Determines whether or not the user defined inactive color will be used for the node, or whether the default inactive color will be used. More...
 
MStatus setObjectColorType (MObjectColorType type)
 Sets whether or not the user defined inactive object color will be used. More...
 
MStatus setObjectColor (const MColor &color)
 Sets the color value for the current user defined inactive color used by the node. More...
 
MColor objectColorRGB (MStatus *ReturnStatus=NULL) const
 Determines the RGB color for the current user defined inactive color used by the node. More...
 
int objectColorIndex (MStatus *ReturnStatus=NULL) const
 Determines the index for the current user defined inactive color used by the node. More...
 
MColor hiliteColor (MStatus *ReturnStatus=NULL) const
 Determines the current hilite color used by the node. More...
 
bool usingHiliteColor (MStatus *ReturnStatus=NULL) const
 Determines whether or not the hilite color will be used for the node. More...
 
MColor dormantColor (MStatus *ReturnStatus=NULL) const
 Determines the dormant color used by this node. More...
 
MColor activeColor (MStatus *ReturnStatus=NULL) const
 Determines the active color used by this node. More...
 
bool drawOverrideEnabled (MStatus *ReturnStatus=NULL) const
 Determines whether or not draw override is turned on for this node. More...
 
bool drawOverrideIsReference (MStatus *ReturnStatus=NULL) const
 Determines whether or not Display Type of the draw override is Reference for this node. More...
 
bool drawOverrideIsTemplate (MStatus *ReturnStatus=NULL) const
 Determines whether or not Display Type of the draw override is Template for this node. More...
 
bool drawOverrideColor (MColor &color, MStatus *ReturnStatus=NULL) const
 Determines the draw override color used by this node. More...
 
MStatus getConnectedSetsAndMembers (unsigned int instanceNumber, MObjectArray &sets, MObjectArray &comps, bool renderableSetsOnly) const
 Returns all the sets connected to the specified instance of this DAG object. More...
 
MBoundingBox boundingBox (MStatus *ReturnStatus=NULL) const
 Returns the bounding box for the dag node in object space. More...
 
MDagPath dagPath (MStatus *ReturnStatus=NULL) const
 Returns the DagPath to which the Function Set is attached. More...
 
virtual MStatus setObject (const MDagPath &path)
 Attaches Function Set to the DAG Node that has the given DAG Path. More...
 
MStatus setObject (MObject &object) override
 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...
 
MStatus setObject (const MObject &object) override
 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 uniqueName (MStatus *ReturnStatus=NULL) const
 Returns the unique name of this node. More...
 
MString pluginName (MStatus *ReturnStatus=NULL) const
 Returns the name of the plug-in this MFnDependendencyNode was defined in. More...
 
MString setName (const MString &name, bool createNamespace=false, MStatus *ReturnStatus=NULL)
 Sets the name of this node. More...
 
MUuid uuid (MStatus *ReturnStatus=NULL) const
 Returns the node's UUID. More...
 
void setUuid (const MUuid &uuid, MStatus *ReturnStatus=NULL)
 Sets the node's UUID. More...
 
MStatus getConnections (MPlugArray &array) const
 Get all of the current connections to this node as an array of plugs. More...
 
unsigned int attributeCount (MStatus *ReturnStatus=NULL) const
 Returns the number of attributes that this node has. More...
 
MObject attribute (unsigned int index, MStatus *ReturnStatus=NULL) const
 Finds the attribute of this node at the given index. More...
 
MObject reorderedAttribute (unsigned int index, MStatus *ReturnStatus=NULL) const
 Some nodes, such as the various animCurve nodes, require that their attributes be set in a specific order for proper operation. More...
 
MObject attribute (const MString &attrName, MStatus *ReturnStatus=NULL) const
 Finds the attribute of this node that has the given name. More...
 
MAttrClass attributeClass (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Returns the class (normal, dynamic, extension) of the specified attribute. More...
 
MStatus getAffectedAttributes (const MObject &attr, MObjectArray &affectedAttributes) const
 Returns an array of attributes that are affected by the attribute passed in. More...
 
MStatus getAffectedByAttributes (const MObject &attr, MObjectArray &affectedByAttributes) const
 Returns an array of attributes that affect the attribute passed in, attr. More...
 
MPlug findPlug (const MObject &attr, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const
 Attempt to find a plug for the given attribute. More...
 
MPlug findPlug (const MString &attrName, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const
 Attempt to find a plug for the given attribute. More...
 
MPlug findPlug (const MObject &attr, MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MPlug findPlug (const MString &attrName, MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MStatus addAttribute (const MObject &attr)
 Add a new dynamic attibute to this node. More...
 
MStatus removeAttribute (const MObject &attr)
 Remove a dynamic attribute from a node. More...
 
MPxNodeuserNode (MStatus *ReturnStatus=NULL) const
 If the function set's node is a plug-in node, then this method will extract the MPxNode pointer from it. More...
 
bool isFromReferencedFile (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node came from a referenced file. More...
 
bool isShared (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is shared. More...
 
bool isTrackingEdits (MStatus *ReturnStatus=NULL) const
 Returns whether or not edits on the given node are being tracked by the generalized edit system. More...
 
bool hasUniqueName (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node's name is unique within the scene. More...
 
MString parentNamespace (MStatus *ReturnStatus=NULL) const
 Returns the name of the namespace in which this node resides. More...
 
bool isLocked (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is locked. More...
 
MStatus setLocked (bool locked)
 Locks or unlocks this node. More...
 
bool isNewAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Indicates whether or not the specified attribute was added to this node within the current scene. More...
 
MStatus setFlag (unsigned int flag, bool state)
 Sets the state of the specified flag for the node. More...
 
bool isFlagSet (unsigned int flag, MStatus *ReturnStatus=NULL) const
 Retrieves the current state of the specified flag for a node. More...
 
bool isDefaultNode (MStatus *ReturnStatus=NULL) const
 Returns true if the node is a default node. More...
 
MStatus setDoNotWrite (bool flag)
 Use this method to mark the "do not write" state of this node. More...
 
bool canBeWritten (MStatus *ReturnStatus=NULL) const
 Returns the do not write state of the node. More...
 
bool hasAttribute (const MString &name, MStatus *ReturnStatus=NULL) const
 Returns true if the node already has an attribute with the given name. More...
 
MObject getAliasAttr (bool force, MStatus *ReturnStatus=NULL)
 Returns the node's alias attribute, which is a special attribute used to store information about the node's attribute aliases. More...
 
bool setAlias (const MString &alias, const MString &name, const MPlug &plug, bool add=true, MStatus *ReturnStatus=NULL)
 Sets or removes an alias (i.e. More...
 
bool findAlias (const MString &alias, MObject &attrObj, MStatus *ReturnStatus=NULL) const
 Retrieves the attribute with the given alias. More...
 
bool getAliasList (MStringArray &strArray, MStatus *ReturnStatus=NULL)
 Returns a list of all attribute aliases for this node. More...
 
MString plugsAlias (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Returns the alias for the plug's attribute or the empty string if that attribute has no alias. More...
 
MStatus setIcon (const MString &filename)
 Associates a custom icon with the node for display in the Maya UI. More...
 
MString icon (MStatus *ReturnStatus=NULL) const
 Returns the custom icon filename associated with the node. More...
 
MStatus getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
MStatus addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
MStatus setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table)
 Sets content info in the specified attribute from the table. More...
 
MStatus setExternalContent (const MExternalContentLocationTable &table)
 Changes the location of external content. More...
 
bool affectsAnimation (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is allowed to animate. More...
 
MStatus setAffectsAnimation ()
 Define a node can affect animation. More...
 
MString setName (const MString &name, MStatus *ReturnStatus)
 This method is obsolete. More...
 
 MFnDependencyNode (const MObject &object, MStatus *ReturnStatus=NULL)
 This method is not available in Python. More...
 
bool getPlugsAlias (const MPlug &plug, MString &aliasName, MStatus *ReturnStatus=NULL)
 This method is not available in Python. 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=nullptr) const
 Returns the MObject that is attached to the Function Set. More...
 

Static Public Member Functions

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

Detailed Description

NURBS curve function set.

This is the function set for NURBS (Non-Uniform Rational B-Spline) curves.

The shape of a NURBS curve is defined by an array of CVs (control vertices), an array of knot values, a degree, and a form. There are 3 possible "forms" for the curve: open, closed and periodic.

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

The number of knots required for a curve is M + 2N - 1. If you want the curve 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 curve is a special case of a closed curve. Instead of having just the first and last CVs coincident, the last N CVs in the curve must overlap the first N CVs. This results in a curve with no tangent break at the seam where the ends meet. The last N CVs in a periodic curve 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 curve are repositioned, the overlapping CV's will remain bound, and will also be moved.

In order to create a periodic curve, 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 curve 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 curve, but the knot values required are more restrictive than for open or closed curves because of the overlap at the ends, The difference between the first N pairs of knots values should be equal to the difference between the last N pairs. Additionally there can be no knot multiplicity at the ends of the curve, because that would compromise the tangent continuity property. So an example knot sequence could begin with knots at { -(N-2), -(N-1), ... , 0}.

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 curve 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:
AbcExport/AbcWriteJob.cpp, AbcExport/MayaNurbsCurveWriter.cpp, AbcExport/MayaNurbsSurfaceWriter.cpp, AbcImport/CreateSceneHelper.cpp, AbcImport/NodeIteratorVisitorHelper.cpp, AbcImport/NurbsCurveHelper.cpp, AbcImport/NurbsSurfaceHelper.cpp, arcLenNode/arcLenNode.cpp, closestPointOnCurve/closestTangentUAndDistance.cpp, customComponentTagNode/customComponentTagNode.cpp, fullLoftNode/fullLoftNode.cpp, geometrytools.cpp, gpuCache/CacheReaderAlembic.cpp, helix2Cmd/helix2Cmd.cpp, helixCmd/helixCmd.cpp, helixQtCmd.cpp, helixTool/helixTool.cpp, instanceCallbackCmd/instanceCallbackCmd.cpp, motionTraceCmd/motionTraceCmd.cpp, multiCurveNode/multiCurveNode.cpp, particlePathsCmd/particlePathsCmd.cpp, and simpleLoftNode/simpleLoftNode.cpp.

Member Enumeration Documentation

enum Form

Forms that a curve may take.

Enumerator
kInvalid 

 

kOpen 

Ends are independent.

kClosed 

Endpoints are coincident.

kPeriodic 

Ends overlap such that there is no break in tangency.

kLast 

 

Constructor & Destructor Documentation

~MFnNurbsCurve ( )
virtual

Destructor.

Class desctructor.

MFnNurbsCurve ( 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
MFnNurbsCurve ( 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
MFnNurbsCurve ( 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::kNurbsCurve.

Returns
the class type.

Reimplemented from MFnDagNode.

const char * className ( )
static

Returns the name of this class.

Return the class name : "MFnNurbsCurve".

Returns
Name of this class.
MObject create ( const MPointArray controlVertices,
const MDoubleArray knots,
unsigned int  degree,
Form  form,
bool  create2D,
bool  createRational,
MObject parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method creates a nurbs curve from the given control vertices and knot vector and sets this function set to operate on the new curve.

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

If the parentOrOwner is kNurbsCurveData then the created curve will be of type kNurbsCurveGeom and will be returned. The parentOrOwner will become the owner of the new curve.

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

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

The knot vector is valid if it is non-decreasing and of length spans + 2 * degree - 1. The cvs are assumed to be in rational form (as opposed to homogeneous)

If the form specified is kClosed and the endpoints are not close then a new span will be created inorder to close the curve.

Parameters
[in]controlVerticesan array of control vertices
[in]knotsan array of knots
[in]degreethe degree to create the curve with
[in]formeither kOpen, kClosed, kPeriodic
[in]create2Dtrue means that the Z-coordinates of the controlVertices will be ignored, giving a curve in the local XY plane
[in]createRationaltrue means curve being created will be rational
[in]parentOrOwnerthe DAG parent or kNurbsCurveData the new curve will belong to
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this curve is returned
  • If parentOrOwner is a DAG object then the curve shape is returned
  • The curve geometry is returned if parentOrOwner is of type kNurbsCurveData
Status Codes:
  • MS::kSuccess Curve was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Error creating curve
Examples:
AbcImport/NurbsCurveHelper.cpp, AbcImport/NurbsSurfaceHelper.cpp, gpuCache/CacheReaderAlembic.cpp, helixCmd/helixCmd.cpp, helixQtCmd.cpp, helixTool/helixTool.cpp, motionTraceCmd/motionTraceCmd.cpp, and particlePathsCmd/particlePathsCmd.cpp.
MObject createWithEditPoints ( const MPointArray editPoints,
unsigned int  degree,
Form  form,
bool  create2D,
bool  createRational,
bool  uniformParam,
MObject parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method creates a nurbs curve from the given edit points and sets this function set to operate on the new curve.

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

If the parentOrOwner is kNurbsCurveData then the created curve will be of type kNurbsCurveGeom and will be returned. The parentOrOwner will become the owner of the new curve.

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

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

If the form specified is kClosed and the endpoints are not close then a new span will be created inorder to close the curve.

Parameters
[in]editPointsan array of edit points
[in]degreethe degree to create the curve with
[in]formeither kOpen, kClosed, kPeriodic
[in]create2Dtrue means that the Z-coordinates of the controlVertices will be ignored, giving a curve in the local XY plane
[in]createRationaltrue means curve being created will be rational
[in]uniformParamtrue means curve being created will have uniform parameterization, false means chord length
[in]parentOrOwnerthe DAG parent or kNurbsCurveData the new curve will belong to
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this curve is returned
  • If parentOrOwner is a DAG object then the curve shape is returned
  • The curve geometry is returned if parentOrOwner is of type kNurbsCurveData
Status Codes:
  • MS::kSuccess Curve was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Error creating curve
MObject create ( const MObjectArray sources,
MObject parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method creates a single curve that combines all the curves in the MObjectArray.

The method assumes the curves in the sources are good for building a single curve:

  • they are in the same direction,
  • they do not intersect themselves or each other,
  • there are no gaps between the endpoint of one curve and the start point of the next one in the array.

It is good enough to be C0 continouns (tangent breaks are okay).

Parameters
[in]sourcesInput array of souce curves.
[in]parentOrOwnerthe DAG parent or kNurbsCurveData the new curve will belong to
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this curve is returned
  • If parentOrOwner is a DAG object then the curve shape is returned
  • The curve geometry is returned if parentOrOwner is of type kNurbsCurveData
Status Codes:
  • MS::kSuccess Curve was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kFailure Error creating curve
MObject copy ( const MObject source,
MObject parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method creates a copy of a nurbs curve.

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

If the parentOrOwner is kNurbsCurveData then the created curve will be of type kNurbsCurveGeom and will be returned. The parentOrOwner will become the owner of the new curve.

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

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

Parameters
[in]sourcethe curve to be copied
[in]parentOrOwnerthe DAG parent or kNurbsCurveData the new curve will belong to
[out]ReturnStatusStatus code
Returns
  • If parentOrOwner is NULL then the transform for this curve is returned
  • If parentOrOwner is a DAG object then the curve shape is returned
  • The curve geometry is returned if parentOrOwner is of type kNurbsCurveData
Status Codes:
  • MS::kSuccess Curve was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Error creating curve
MStatus reverse ( bool  constructionHistory = false)

This method reverse the curve direction.

Parameters
[in]constructionHistoryThis parameter has no effect. Regardless of how it is set, if the function set was initialized with the DAG path of a curve node which already has history, then the reverse operation will be added into that history, otherwise the reverse operation will be applied directly to the curve's data and no history will be left behind.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus makeMultipleEndKnots ( )

This method gives end knots full multiplicity.

This ensures the end points of the curve interpolate the first and last CVs. It can also be used to convert a periodic curve to a closed curve.

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MObject cv ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Returns a CV as a component.

MItCurveCV can be used to examine or modify the returned CV.

Any modifications to the CV will affect the curve. After all modifications are done, updateCurve should be called to have the curve recalculate its cached geometry.

Parameters
[out]indexIndex of the CV
[out]ReturnStatusStatus code
Returns
A handle to the CVs requested
Status Codes:
  • MS::kSuccess The method was successful
  • MS::kInvalidParameter CV index out of range
  • MS::kFailure An object error has occurred
MStatus getCV ( unsigned int  index,
MPoint pt,
MSpace::Space  space = MSpace::kObject 
) const

Get the CV at the given index.

Parameters
[in]indexThe index of the CV that will be retrieved
[out]ptStorage for the CV
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
  • MS::kSuccess The CV was successfully set
  • MS::kInvalidParameter CV index out of range
  • MS::kFailure Object error
MStatus setCV ( unsigned int  index,
const MPoint pt,
MSpace::Space  space = MSpace::kObject 
)

Set the CV at the given index to the given point.

The method updateCurve should be called to trigger changes in the curve.

Parameters
[in]indexThe index of the CV that will be changed
[in]ptThe new value that the CV will take
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
  • MS::kSuccess The CV was successfully set
  • MS::kInvalidParameter CV index out of range
  • MS::kFailure Object error
MFnNurbsCurve::Form form ( MStatus ReturnStatus = NULL) const

This method returns the form of the curve.

The curve can be open, closed, or periodic.

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

Return the degree of this curve.

If the degree cannot be determined then 0 is returned.

Parameters
[out]ReturnStatusStatus code
Returns
The degree of this curve.
Status Codes:
  • MS::kSuccess The degree was successfully returned.
  • MS::kFailure An object error has occurred.
Examples:
AbcExport/MayaNurbsCurveWriter.cpp.
int numCVs ( MStatus ReturnStatus = NULL) const

Return the number of CVs for this curve.

If the number of CVs cannot be determined then 0 is returned.

Parameters
[out]ReturnStatusStatus code
Returns
The number of CVs for this curve.
Status Codes:
  • MS::kSuccess The number of CVs was successfully returned.
  • MS::kFailure An object error has occurred.
Examples:
AbcExport/MayaNurbsCurveWriter.cpp, AbcImport/NurbsSurfaceHelper.cpp, and geometrytools.cpp.
int numSpans ( MStatus ReturnStatus = NULL) const

Return the number of spans for this curve.

If the number of spans cannot be determined then 0 is returned.

Parameters
[out]ReturnStatusStatus code
Returns
The number of spans for this curve.
Status Codes:
  • MS::kSuccess The number of spans was successfully returned.
  • MS::kFailure An object error has occurred.
int numKnots ( MStatus ReturnStatus = NULL) const

Return the number of knots for this curve.

If the number of knots cannot be determined then 0 is returned.

Parameters
[out]ReturnStatusStatus code
Returns
The number of knots for this curve.
Status Codes:
  • MS::kSuccess The number of knots was successfully returned.
  • MS::kFailure An object error has occurred.
MStatus getKnotDomain ( double &  start,
double &  end 
) const

Return the range corresponding to the maximum and minimum parameter values for this curve.

Parameters
[out]startstorage for the max parameter value
[out]endstorage for the min parameter value
Returns
Status code
Status Codes:
  • MS::kSuccess The range was successfully returned
  • MS::kFailure Object error
MStatus getKnots ( MDoubleArray array) const

This method retrieves a copy of the knot array for this curve.

Parameters
[out]arraystorage where the parameter values of the knots for this curve will be copied
Returns
Status code
Status Codes:
  • MS::kSuccess The knots were successfully copied
  • MS::kFailure Object error
Examples:
AbcExport/MayaNurbsCurveWriter.cpp, and geometrytools.cpp.
MStatus setKnots ( const MDoubleArray array,
unsigned int  startIndex,
unsigned int  endIndex 
)

This method is used to set the values of a contiguous group of knots of the curve.

The range of knots to set is specified using the start and end index. The knots of index startIndex to endIndex inclusive will be set using the value in the double array.

Knot indices range from 0 to numKnots() - 1

Parameters
[in]arraya double array of knot points
[in]startIndexthe starting index of the knots to be altered.
[in]endIndexthe ending index of the knots to be altered.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Invalid start or end indices, or the length of the array is not sufficient to fill the range given, or the knots are in decreasing order.
  • MS::kFailure An object error has occurred
MStatus setKnot ( unsigned int  index,
double  param 
)

Set the given knot's parameter value.

Knot indices range from 0 to numKnots() - 1.

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]indexIndex of the knot to be set
[in]paramThe parameter value that the knot will take
Returns
Status code
Status Codes:
  • 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
MObject cvs ( unsigned int  startIndex,
unsigned int  endIndex,
MStatus ReturnStatus = NULL 
) const

Returns a contiguous group of CVs as a component.

MItCurveCV can be used to examine or modify the returned CVs.

Any modifications to these CVs will affect the curve. After all modifications are done, updateCurve should be called to have the curve recalculate its cached geometry.

Parameters
[in]startIndexthe start index for the CVs to return
[in]endIndexthe end index for the CVs to return
[out]ReturnStatusStatus code
Returns
An MObject providing direct-access to the specified CVs
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter CV index out of range
  • MS::kFailure An object error has occurred.
MStatus getCVs ( MPointArray array,
MSpace::Space  space = MSpace::kObject 
) const

Get the positions of the CVs of this curve.

The returned group can be accessed via the MPointArray class. Any modifications to these CVs will not affect this curve. setCVs should be called to modify the original curve. updateCurve should be called to cause the curve to redraw itself.

Parameters
[out]arrayThe array of point values for the CVs
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Cannot do world space transform
  • MS::kFailure An object error has occurred
Examples:
AbcExport/MayaNurbsCurveWriter.cpp, and geometrytools.cpp.
MStatus setCVs ( const MPointArray array,
MSpace::Space  space = MSpace::kObject 
)

Set the CVs for this curve to the given points.

Parameters
[in]arrayThe array of point values for the CVs
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.
double knot ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Get the parameter value of the specified knot for this curve.

Knot indices range from 0 to numKnots() - 1

Parameters
[in]indexThe knot index
[out]ReturnStatusStatus code
Returns
The parameter value for the knot at index.
Status Codes:
  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Knot index out of range
  • MS::kFailure An object error has occurred
MStatus removeKnot ( double  atThisParam,
bool  removeAll = false 
)

Remove one or more knots at the given parameter.

If there are multiple knots at the given parameter then removeAll determines the number to be removed. If it is true then they will all be removed. If it is false then all but one will be removed.

Parameters
[in]atThisParamStatus code
[in]removeAllHow to handle multiple knots at the same param.
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Parameter value is out of range
  • MS::kFailure An object error has occurred
bool isPointOnCurve ( const MPoint point,
double  tolerance = kMFnNurbsEpsilon,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

Determines whether the given point is on this curve.

Parameters
[in]pointThe point to test
[in]toleranceThe amount of error (epsilon value) in the calculation
[in]spaceSpecifies the coordinate system for this operation
[out]ReturnStatusStatus code
Returns
true if the given point is on the curve, false otherwise.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getPointAtParam ( double  param,
MPoint point,
MSpace::Space  space = MSpace::kObject 
) const

Returns the point in space that is at the given parameter value of the curve.

If the parameter value does not give a valid point on the curve, then MS::kInvalidParameter is returned.

Parameters
[in]paramThe parameter value that we are examining
[out]pointStorage for the point being returned
[in]spaceSpecifies the coordinate system for this operation
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid parameter specified.
  • MS::kFailure An object error has occurred.
Examples:
AbcImport/NurbsSurfaceHelper.cpp.
MStatus getParamAtPoint ( const MPoint atThisPoint,
double &  param,
MSpace::Space  space = MSpace::kObject 
) const

This method retrieves the parameter value corresponding to the given point on the curve.

Parameters
[in]atThisPointPoint to check
[out]paramstorage for the parameter value
[in]spaceSpecifies the coordinate system for this operation
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus getParamAtPoint ( const MPoint atThisPoint,
double &  param,
double  tolerance,
MSpace::Space  space = MSpace::kObject 
) const

This method retrieves the parameter value corresponding to the given point on the curve.

Parameters
[in]atThisPointPoint to check
[out]paramstorage for the parameter value
[in]tolerancetolerance used for operation
[in]spaceSpecifies the coordinate system for this operation
Returns
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
bool isParamOnCurve ( double  param,
MStatus ReturnStatus = NULL 
) const

Determines whether the specified parameter value is within the bounds of the knot vector of this curve.

Parameters
[in]paramThe parameter value to check
[out]ReturnStatusStatus code
Returns
  • true The parameter is on this curve.
  • false Parameter is NOT on this curve.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MVector normal ( double  param,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

This method returns the normal at the given parameter value on the curve.

For degree 1 curves the normal is the vector at right angles to the curve that lies in the average plane of the curve. For higher degrees the normal is defined by the local curvature at param.

Parameters
[in]paramThe parameter of the point on the curve from which to get the normal
[in]spaceSpecifies the coordinate system for this operation
[out]ReturnStatusStatus code
Returns
The normal vector for the given parameter
Status Codes:
  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Normal cannot be found for the given parameter value
  • MS::kFailure An object error has occurred
Examples:
closestPointOnCurve/closestTangentUAndDistance.cpp.
MVector tangent ( double  param,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

This method returns the tangent at the given parameter value on the curve.

The resulting tangent vector is normalized.

Parameters
[in]paramThe parameter of the point on the curve from which to get the tangent
[in]spaceSpecifies the coordinate system for this operation
[out]ReturnStatusStatus code
Returns
The tangent vector for the given parameter
Status Codes:
  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Tangent cannot be found for the given parameter value
  • MS::kFailure An object error has occurred
Examples:
closestPointOnCurve/closestTangentUAndDistance.cpp.
MStatus getDerivativesAtParm ( double  param,
MPoint pos,
MVector dU,
MSpace::Space  space,
MVector dUU = NULL 
) const

Evaluate the curve at the given parameter returning the position, first derivative and optionally the second derivative.

Derivatives are not normalized.

Parameters
[in]paramU parameter value to evaluate
[out]posStorage for the XYZ position of the curve
[out]dUStorage for the first order partial derivative with respect to u
[in]spaceCoordinate space for the returned vectors
[out]dUUPointer to storage for the second order partial derivative with respect to u
Returns
Status Code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Parameter does not define a point on the curve
  • MS::kFailure An object error has occurred.
bool isPlanar ( MVector planeNormal = NULL,
MStatus ReturnStatus = NULL 
) const

This method determines if this curve is a planar curve.

If planeNormal is non-NULL then the normal to the plane containing this curve is returned in this location.

Parameters
[in]planeNormalNormal to the plane containing this curve
[out]ReturnStatusStatus code
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MPoint closestPoint ( const MPoint toThisPoint,
double *  param = NULL,
double  tolerance = kMFnNurbsEpsilon,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

This method determines the closest point on the curve to the given point.

Parameters
[in]toThisPointThe point to test
[in]paramIf non-null, on successful returns this will contain the parameter value of the returned point.
[in]toleranceThe amount of error (epsilon value) to allow in the calculation
[in]spaceSpecifies the coordinate system for this operation
[out]ReturnStatusStatus code
Returns
The point on the curve closest to the given point.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
closestPointOnCurve/closestTangentUAndDistance.cpp.
MPoint closestPoint ( const MPoint toThisPoint,
bool  paramAsGuess,
double *  param = NULL,
double  tolerance = kMFnNurbsEpsilon,
MSpace::Space  space = MSpace::kObject,
MStatus ReturnStatus = NULL 
) const

This method determines the closest point on the curve to the given point.

Performance can be greatly increased by supplying a starting parameter value that is reasonably close to the final point.

Parameters
[in]toThisPointThe point to test
[in]paramAsGuessIf true use the incoming 'param' value as a guess as to the location of the closest point. If the closest point lies within the same span as the guess then this can greatly speed up the search. If not then the search may be slowed a bit.
[in,out]parampointer to a double. If non-null, on successful returns this will contain the parameter value of the returned point.
[in]toleranceThe amount of error (epsilon value) in the calculation
[in]spaceSpecifies the coordinate system for this operation
[out]ReturnStatusStatus code
Returns
The point on the curve closest to the given point.
Status Codes:
  • MS::kSuccess The method was successful.
  • 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 point on the curve which is closest to it.

Parameters
[in]ptThe point to calculate the distance to
[in]spaceSpecifies the coordinate system for this operation
[out]ReturnStatusStatus code
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
closestPointOnCurve/closestTangentUAndDistance.cpp.
double area ( double  tolerance = kMFnNurbsEpsilon,
MStatus ReturnStatus = NULL 
) const

This method returns the area bounded by this curve.

The curve must be closed and planar.

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

Parameters
[in]toleranceThe amount of error (epsilon value) in the calculation
[out]ReturnStatusStatus code
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
double length ( double  tolerance = kMFnNurbsEpsilon,
MStatus ReturnStatus = NULL 
) const

Return the arc length of this curve or 0.0 if it cannot be computed.

Parameters
[in]toleranceThe amount of error (epsilon value) in the calculation
[out]ReturnStatusStatus code
Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
Examples:
AbcImport/NurbsSurfaceHelper.cpp.
double findParamFromLength ( double  partLength,
MStatus ReturnStatus = NULL 
) const

Returns the parameter value corresponding to a given length along the curve.

If the parameter value cannot be found for the given length then ReturnStatus is set to kInvalidParameter and the parameter for the end point of the curve is returned.

Parameters
[in]partLengthLength along the curve to find parameter value at
[out]ReturnStatusStatus code
Returns
The parameter value corresponding to the given length. If a parameter cannot be found for the given length then the parameter for the end point of the curve is returned.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Parameter value cannot be found
  • MS::kFailure An object error has occurred.
Examples:
AbcImport/NurbsSurfaceHelper.cpp.
double findParamFromLength ( double  partLength,
double  tolerance,
MStatus ReturnStatus = NULL 
) const

Returns the parameter value corresponding to a given length along the curve with the given tolerance.

If the parameter value cannot be found for the given length then ReturnStatus is set to kInvalidParameter and the parameter for the end point of the curve is returned.

Note: The default tolerance for findParamFromLength is 1.0e-6 and would only need to be changed when working at extremely large or small scales.

Parameters
[in]partLengthLength along the curve to find parameter value at
[in]toleranceThe search tolerance
[out]ReturnStatusStatus code
Returns
The parameter value corresponding to the given length. If a parameter cannot be found for the given length then the parameter for the end point of the curve is returned.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Parameter value cannot be found
  • MS::kFailure An object error has occurred.
double findLengthFromParam ( double  param,
MStatus ReturnStatus = NULL 
) const

Returns the length along the curve corresponding to a given parameter value on the curve.

If the length cannot be found for the given parameter value then ReturnStatus is set to kInvalidParameter and a length of zero is returned.

Parameters
[in]paramParameter value on the curve
[out]ReturnStatusStatus code
Returns
The length corresponding to the given parameter value. If the given parameter value cannot be found then a length of zero is returned.
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter length cannot be determined
  • MS::kFailure An object error has occurred.
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
  • true shape has history
  • false shape does not have history
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MStatus updateCurve ( )

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

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

Returns
Status code
Status Codes:
  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.
MObject rebuild ( unsigned int  spans,
unsigned int  degree = 3,
unsigned int  keepRange = 1,
unsigned int  endKnots = 0,
bool  keepEndPoints = true,
bool  keepTangents = true,
bool  keepControlPoints = false,
float  tolerance = 0.01f,
MStatus ReturnStatus = NULL 
) const

This method rebuilds a new curve based on the current curve and parameters.

This method does not change current curve, but put the newly rebuilt curve data inside a MFnNurbsCurveData and then return it back.

This method is useful when you want to use Maya native algorithm to do nurbs curve rebuilding.

It uses same algorithm and similar controls as command 'rebuildCurve'.

Parameters
[in]spansThe number of spans in resulting curve
[in]degreeThe degree of the resulting curve 1 - linear, 2 - quadratic, 3 - cubic, 5 - quintic, 7 - heptic
[in]keepRangeDetermine the parameterization for the resulting curve. 0 - reparameterize the resulting curve from 0 to 1, 1 - keep the original curve parameterization, 2 - reparameterize the result from 0 to number of spans
[in]endKnotsEnd conditions for the curve 0 - uniform end knots, 1 - multiple end knots
[in]keepEndPointsIf true, keep the endpoints the same
[in]keepTangentsIf true, keep the end tangents the same
[in]keepControlPointsIf true, the CVs will remain the same.
[in]toleranceThe tolerance with which to rebuild
[out]ReturnStatusStatus code
Returns
  • The new MObject containing the rebuilt curve
Status Codes:
  • MS::kSuccess Curve was successfully rebuilt
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kFailure Error rebuilding curve

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