#include
<MPxConstraintCommand.h>
MPxConstraintCommand is the base class for user defined constraint commands. This command gives all of the flags and options of the base constraint command in addition allows user defined flags or behaviours. When registering this command, use the MFnPlugin::registerConstraintCommand() method. A MPxConstraint is also required to be used with MPxConstraintCommand. The constraintTypeId() virtual must be implemented to return the correct constraint node.
Public Types |
|
enum | TargetType { kTransform, kGeometryShape, kLast } |
Defines the type of target object.
More... |
|
Public Member Functions |
|
MPxConstraintCommand () | |
virtual | ~MPxConstraintCommand () |
virtual MStatus | doIt (const MArgList &argList) |
virtual MStatus | undoIt () |
virtual MStatus | redoIt () |
virtual MStatus | appendSyntax () |
Protected Member Functions |
|
virtual MStatus | parseArgs (const MArgList &argList) |
MSyntax | syntax (MStatus *ReturnStatus=NULL) const |
USE _syntax() IN SCRIPT. |
|
virtual MStatus | doEdit () |
virtual MStatus | doCreate () |
virtual MStatus | doQuery () |
virtual void | createdConstraint (MPxConstraint *constraint) |
virtual bool | supportsOffset () const |
virtual bool | hasVectorFlags () const |
virtual MTypeId | constraintTypeId () const |
virtual MPxConstraintCommand::TargetType |
targetType () const |
virtual const MObject & | aimVectorAttribute () const |
virtual const MObject & | upVectorAttribute () const |
virtual const MObject & | worldUpMatrixAttribute () const |
virtual const MObject & | worldUpTypeAttribute () const |
virtual const MObject & | worldUpVectorAttribute () const |
virtual const MObject & | offsetAttribute () const |
virtual const MObject & | constraintInstancedAttribute () const |
virtual const MObject & | constraintOutputAttribute () const |
virtual const MObject & | constraintRestAttribute () const |
virtual const MObject & | constraintEnableRestAttribute () const |
virtual const MObject & | constraintTargetInstancedAttribute () const |
virtual const MObject & | constraintTargetAttribute () const |
virtual const MObject & | constraintTargetWeightAttribute () const |
virtual const MObject & | objectAttribute () const |
virtual void | getObjectAttributesArray (MObjectArray &array) |
virtual void | handleNewTargets (MObject &dagObject) |
This method is obsolete. This
method is not available in Python. |
|
virtual MStatus | handleNewTargets (MDagPath &dagObject) |
virtual MStatus | connectTarget (void *opaqueTarget, int index) |
This method is obsolete. This
method is not available in Python. |
|
virtual MStatus | connectTarget (MDagPath &targetPath, int index) |
virtual MStatus | connectObjectAndConstraint (MDGModifier &modifier) |
MStatus | connectGeometryAttribute (void *opaqueTarget, int index, MObject &constraintAttr) |
MStatus | connectTargetAttribute (void *opaqueTarget, int index, MObject &constraintAttr) |
This method is obsolete. This
method is not available in Python. |
|
MStatus | connectTargetAttribute (MDagPath &targetPath, int index, MObject &tarAttr, MObject &constraintAttr, bool instanced=false) |
MStatus | connectObjectAttribute (const MObject &objectAttr, const MObject &constraintAttr, bool toConstraint=true, bool instanced=false) |
const MObject | transformObject () |
MPxConstraintCommand::MPxConstraintCommand | ( | ) |
Constructor
MPxConstraintCommand::~MPxConstraintCommand | ( | ) | [virtual] |
Destructor. Local class data should be freed here.
This method should execute a command by setting up internal class data and then return control to Maya for executing the base constraint command functionality. This is a virtual, and can be overridden in derived classes.
Default behaviour returns MS::kUnknownParameter so that Maya handles the operation.
[in] | args | the command's argument list. |
Reimplemented from MPxCommand.
MStatus MPxConstraintCommand::undoIt | ( | ) | [virtual] |
This method should undo the work done be the redoIt method based on the internal class data only.
Default behaviour returns MS::kUnknownParameter so that Maya handles the operation.
Reimplemented from MPxCommand.
MStatus MPxConstraintCommand::redoIt | ( | ) | [virtual] |
This method should do the actual work of the command based on the internal class data only. Internal class data should be set in the doIt method.
Default behaviour returns MS::kUnknownParameter so that Maya handles the operation.
Reimplemented from MPxCommand.
MStatus MPxConstraintCommand::appendSyntax | ( | ) | [virtual] |
This method should be overridden to append syntax to the constraint command. The syntax object can be obtained by calling the syntax method. The following flags cannot be used as user-defined flags as they are reserved for edit and query: "-e", "-edit", "-q", "-query".
Standard constraint flags that are provided are: name "-n" "-name", weight "-w" "-weight", target list "-tl" "-targetList", remove "-rm" "-remove", target alias "-wal" "-weightAliasList".
This method is used for parsing any custom flags/params that have been added to the command. Return MS::kUnknownParameter to allow the processing of base flags/params.
Default behaviour returns MS::kUnknownParameter so that Maya handles the operation.
[in] | argList | the command's argument list. |
USE _syntax() IN SCRIPT.
This method returns the syntax object of this constraint command. The syntax object can be appended to in an overridden version of the appendSyntax method.
[out] | ReturnStatus | return status |
MStatus MPxConstraintCommand::doEdit | ( | ) | [protected, virtual] |
This method is used for editing any custom setting on the command. Return MS::kUnknownParameter to allow processing of the base class functionality.
Default behaviour returns MS::kUnknownParameter so that Maya handles the operation.
MStatus MPxConstraintCommand::doCreate | ( | ) | [protected, virtual] |
This method is used for creating resources required by the command. Return MS:kUnknownParameter to allow processing of base class functionality.
Default behaviour returns MS::kUnknownParameter so that Maya handles the operation.
MStatus MPxConstraintCommand::doQuery | ( | ) | [protected, virtual] |
This method is used for querying information defined in the command. Return MS:kUnknownParameter to allow processing of base class functionality.
Default behaviour returns MS::kUnknownParameter so that Maya handles the operation.
void MPxConstraintCommand::createdConstraint | ( | MPxConstraint * | constraint | ) | [protected, virtual] |
This method is called when an MPxConstraintCommand creates a new MPxConstraint node. It can be used for transferring state from the command to the node object.
[in] | constraint | the constraint node created by the command. |
bool MPxConstraintCommand::supportsOffset | ( | ) | const [protected, virtual] |
This method is used to control if the constraint supports offset. Return true if the constraint should support offset. False is returned otherwise and is the default behaviour of this method.
If this method returns true, then the offsetAttribute() method should return a 3 double attribute.
bool MPxConstraintCommand::hasVectorFlags | ( | ) | const [protected, virtual] |
This method is used to control if the constraint supports the base class vector flags. Return true if the constraint should support the vector flags. False is returned otherwise and is the default behaviour of this method.
If this method returns true, then the following methods need to return valid attributes: aimVectorAttribute(), upVectorAttribute() worldUpMatrixAttribute(), worldUpTypeAttribute(), worldUpVectorAttribute().
MTypeId MPxConstraintCommand::constraintTypeId | ( | ) | const [protected, virtual] |
This method is used to return the MTypeId of the MPxConstraint node that is used with this command. This virtual must be implemented in a proxy constraint command.
This method must be implemented.
MPxConstraintCommand::TargetType MPxConstraintCommand::targetType | ( | ) | const [protected, virtual] |
Maya supports constraints targets which are either transforms or nodes derived from "geometryShape". Return the appropriate target type in this method.
By default, this method returns MPxConstraintCommand::kTransform.
const MObject & MPxConstraintCommand::aimVectorAttribute | ( | ) | const [protected, virtual] |
This method returns an attribute which defines the aim vector of a constraint. The aimVector attribute defines a vector in the space of the constrained object that should be aligned with the weighted average vector computed by the constraint. The upVectorAttribute(), worldUpVectorAttribute(), worldUpMatrixAttribute, and worldUpTypeAttribute() define how the constrained object is rotated about the aimVector.
The aimVector returned should be a 3 double attribute.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::upVectorAttribute | ( | ) | const [protected, virtual] |
This method returns an upVector attribute that is used in conjunction with the aimVector.
The upVector returned should be a 3 double attribute.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::worldUpMatrixAttribute | ( | ) | const [protected, virtual] |
This method returns an worldUpMatrix attribute that is used in conjunction with the aimVector.
The worldUpMatrix returned should be a matrix attribute.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::worldUpTypeAttribute | ( | ) | const [protected, virtual] |
This method returns an worldUpType attribute that is used in conjunction with the aimVector.
The worldUpType returned should be a enum attribute.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::worldUpVectorAttribute | ( | ) | const [protected, virtual] |
This method returns an worldUpVector attribute that is used in conjunction with the aimVector.
The worldUpVector returned should be a 3 double attribute.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::offsetAttribute | ( | ) | const [protected, virtual] |
This method returns the offset attribute and must be implemented if supportsOffset() returns true.
The offset returned should be a 3 double attribute.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::constraintInstancedAttribute | ( | ) | const [protected, virtual] |
This method returns the attribute on the constraint node that connects to an instanced constraint attribute of the constrained object.
The type of the attribute will depend on the constraint implementation.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::constraintOutputAttribute | ( | ) | const [protected, virtual] |
This method returns the attribute this constraint will connect to the constrained attribute of the constrained object.
The type of the attribute will depend on the constraint implementation.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::constraintRestAttribute | ( | ) | const [protected, virtual] |
This method returns the rest state attribute for the constraint. Constraints supporting rest state should implement this method.
The constraintReset attribute is a 3 double.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::constraintEnableRestAttribute | ( | ) | const [protected, virtual] |
This method returns the constraintReset attribute for the constraint.
The constraintReset attribute is a boolean.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::constraintTargetInstancedAttribute | ( | ) | const [protected, virtual] |
This method returns the constraintTargetInstanced attribute for the constraint.
The type of the attribute will depend on the constraint implementation. Suggested attribute types include a parent matrix or target geometry.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::constraintTargetAttribute | ( | ) | const [protected, virtual] |
This method returns the constraintTarget attribute for the constraint.
The type of the attribute will depend on the constraint implementation. But it must be an compound array attribute.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::constraintTargetWeightAttribute | ( | ) | const [protected, virtual] |
This method returns the constraintTargetWeight attribute for the constraint.
The type of the constraintTargetWeight attribute is a double.
The default behaviour of the method is to return a MObject::kNullObj.
const MObject & MPxConstraintCommand::objectAttribute | ( | ) | const [protected, virtual] |
This method returns the attribute this constraint will drive on the constrained object.
The default behaviour of the method is to return a MObject::kNullObj.
void MPxConstraintCommand::getObjectAttributesArray | ( | MObjectArray & | array | ) | [protected, virtual] |
This method returns the list of attributes this particular constraint considers when inserting a pair blend.
void MPxConstraintCommand::handleNewTargets | ( | MObject & | dagObject | ) | [protected, virtual] |
This method is obsolete. This method is not available in Python.
This method is used to perform any special processing when targets are added to the constraint. For example, the constraint may need to keep track of the list of targets to properly calculate an offset.
[in] | dagObject | path to the new constraint target |
MStatus MPxConstraintCommand::connectTarget | ( | void * | opaqueTarget, | |
int | index | |||
) | [protected, virtual] |
This method is obsolete. This method is not available in Python.
MStatus MPxConstraintCommand::connectTarget | ( | MDagPath & | targetPath, | |
int | index | |||
) | [protected, virtual] |
This method is called to make connections between the constraint and the target. Since the default behaviour is to do nothing it is generally necessary to override this method if your constraint is to work properly. The connectTargetAttribute() convenience method can be useful in this regard.
Default behaviour makes no connections.
[in] | targetPath | DAG path of the target |
[in] | index | index for this target in the node's constraint target attribute |
MStatus MPxConstraintCommand::connectObjectAndConstraint | ( | MDGModifier & | modifier | ) | [protected, virtual] |
This method is used for connecting the constraint and constrained object. The utility method MPxConstraintCommand::connectObjectAttribute() is used to connect the attributes.
Default behaviour returns MS::kUnknownParameter so that Maya handles the operation.
[in] | modifier | used for setting plug values such as translation |
MStatus MPxConstraintCommand::connectGeometryAttribute | ( | void * | opaqueTarget, | |
int | index, | |||
MObject & | constraintAttribute | |||
) | [protected] |
Utility method to make any required connections for the constraint. Note that it is called by the default implementation of connectTarget().
[in] | opaqueTarget | as passed to connectTarget() |
[in] | index | as passed to connectTarget() |
[in] | constraintAttribute | as defined by the constraint |
MStatus MPxConstraintCommand::connectTargetAttribute | ( | void * | opaqueTarget, | |
int | index, | |||
MObject & | constraintAttribute | |||
) | [protected] |
This method is obsolete. This method is not available in Python.
MStatus MPxConstraintCommand::connectTargetAttribute | ( | MDagPath & | targetPath, | |
int | index, | |||
MObject & | targetAttribute, | |||
MObject & | constraintAttr, | |||
bool | instanced = false |
|||
) | [protected] |
Utility method to make any required connections for the constraint.
[in] | targetPath | as passed to connectTarget() |
[in] | index | as passed to connectTarget() |
[in] | targetAttribute | as defined by the target |
[in] | constraintAttr | as defined by the constraint |
[in] | instanced | true if targetAttribute is an instanced attribute |
MStatus MPxConstraintCommand::connectObjectAttribute | ( | const MObject & | objectAttr, | |
const MObject & | constraintAttr, | |||
bool | toConstraint =
true , |
|||
bool | instanced = false |
|||
) | [protected] |
This method is used connectObjectAndConstraint() to make any required connections between the constraint and the constrained object.
[in] | objectAttr | as passed to connectTarget() |
[in] | constraintAttr | as defined by the constraint |
const MObject MPxConstraintCommand::transformObject | ( | ) | [protected] |
This method returns the target object being constrained. The object returned will be a "transform" node. This node can be queried using MFnTransform to extract information such as translate, scale etc which will allow the placement of the constrained object in a reasonable default location. For example, a geometric constraint may wish to place the constrained object on top of the target.
Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |