class MPxIkSolverNode

Jump to documentation

: public MPxNode Base class for user defined IK solvers (OpenMayaAnim) (OpenMayaAnim.py)

Inheritance:

MPxIkSolverNode < MPxNode

public members:

virtual ~MPxIkSolverNode ()
virtual MPxNode::Type type () const
virtual MStatus preSolve ()
virtual MStatus doSolve ()
virtual MStatus postSolve ( MStatus )
virtual MString solverTypeName () const
bool rotatePlane ( MStatus *ReturnStatus = NULL) const
MStatus setRotatePlane (bool rotatePlane )
bool singleChainOnly ( MStatus *ReturnStatus = NULL) const
MStatus setSingleChainOnly (bool singleChainOnly )
bool positionOnly ( MStatus *ReturnStatus = NULL) const
MStatus setPositionOnly (bool positionOnly )
bool supportJointLimits ( MStatus *ReturnStatus = NULL) const
MStatus setSupportJointLimits (bool supportJointLimits )
bool uniqueSolution ( MStatus *ReturnStatus = NULL) const
MStatus setUniqueSolution (bool uniqueSolution )
virtual bool isSingleChainOnly () const
OBSOLETE
virtual bool isPositionOnly () const
OBSOLETE
virtual bool hasJointLimitSupport () const
OBSOLETE
virtual bool hasUniqueSolution () const
OBSOLETE
virtual bool groupHandlesByTopology () const
OBSOLETE
virtual MStatus setFuncValueTolerance ( double tolerance )
virtual MStatus setMaxIterations ( int value )
MIkHandleGroup * handleGroup () const
virtual void setHandleGroup ( MIkHandleGroup * )
const MMatrix * toWorldSpace () const
const MMatrix * toSolverSpace () const
double funcValueTolerance () const
int maxIterations () const
virtual void snapHandle ( MObject & handle )

protected members:

MStatus getJointAngles ( MDoubleArray & ) const
USE _getJointAngles() IN SCRIPT
MStatus setJointAngles ( const MDoubleArray & )
USE _setJointAngles() IN SCRIPT
void setToRestAngles ()
USE _setToRestAngles() IN SCRIPT
MPxIkSolverNode ()

Inherited from MPxNode:

public members:

enum Type
kDependNode
kLocatorNode
kDeformerNode
kManipContainer
kSurfaceShape
kFieldNode
kEmitterNode
kSpringNode
kIkSolverNode
kHardwareShader
Custom shader derived from MPxHardwareShader
kHwShaderNode
Custom shader derived from MPxHwShaderNode
kTransformNode
kObjectSet
kFluidEmitterNode
kImagePlaneNode
kParticleAttributeMapperNode
kConstraintNode
kLast
virtual void postConstructor ()
virtual MStatus compute ( const MPlug & plug, MDataBlock & dataBlock )
virtual bool getInternalValueInContext ( const MPlug & plug, MDataHandle & dataHandle, MDGContext & ctx)
virtual bool setInternalValueInContext ( const MPlug & plug, const MDataHandle & dataHandle, MDGContext & ctx)
virtual bool getInternalValue ( const MPlug & plug, MDataHandle & dataHandle)
virtual bool setInternalValue ( const MPlug & plug, const MDataHandle & dataHandle)
virtual int internalArrayCount ( const MPlug & plug, const MDGContext & ctx) const
virtual void copyInternalData ( MPxNode * )
virtual MStatus legalConnection ( const MPlug & plug, const MPlug & otherPlug, bool asSrc, bool& isLegal ) const
virtual MStatus legalDisconnection ( const MPlug & plug, const MPlug & otherPlug, bool asSrc, bool& isLegal ) const
virtual MStatus setDependentsDirty ( const MPlug & plug, MPlugArray & plugArray)
virtual MStatus connectionMade ( const MPlug & plug, const MPlug & otherPlug, bool asSrc )
virtual MStatus connectionBroken ( const MPlug & plug, const MPlug & otherPlug, bool asSrc )
virtual bool isPassiveOutput ( const MPlug & plug ) const
virtual MStatus shouldSave ( const MPlug & plug, bool& isSaving )
virtual MPlug passThroughToOne ( const MPlug & plug ) const
virtual bool passThroughToMany ( const MPlug & plug, MPlugArray & plugArray ) const
MTypeId typeId () const
MString typeName () const
MString name () const
virtual Type type () const
virtual bool isAbstractClass () const
MObject thisMObject () const
static MStatus addAttribute ( const MObject & attr )
static MStatus inheritAttributesFrom ( const MString & parentClassName )
static MStatus attributeAffects ( const MObject & whenChanges, const MObject & isAffected )
MStatus setExistWithoutInConnections ( bool flag )
bool existWithoutInConnections ( MStatus * ReturnStatus = NULL ) const
MStatus setExistWithoutOutConnections ( bool flag )
bool existWithoutOutConnections ( MStatus * ReturnStatus = NULL ) const
static MObject message
static MObject isHistoricallyInteresting
static MObject caching
static MObject state

protected members:

MDataBlock forceCache ( MDGContext & ctx= MDGContext::fsNormal )
void setMPSafe ( bool flag )
MStatus setDoNotWrite ( bool flag )
bool doNotWrite ( MStatus *ReturnStatus = NULL ) const

Documentation

Derive from this class to create user-defined IK solvers.

Description

This is the base class for writing user-defined IK solvers.
Users must at least override the following methods in order to write a solver:

Note that the following virtual methods (declared in MPxNode) are irrelevant for the MPxIkSolverNode. If these methods are overridden in a class derived from MPxIkSolverNode, they will be ignored.

A creator method is necessary to return an instance of the user solver:

    userSolver::creator() {
        return new userSolver;
    }
    

In order to create and register the solver, execute the mel command: createNode userSolver;

Once the solver is registered it can be assigned to IK handles and it's solve methods will be called in the same manner as the solvers within Maya.

Functions

MPxIkSolverNode:: ~MPxIkSolverNode ()

Description

Destructor. Local class data should be freed here.

MPxNode::Type MPxIkSolverNode:: type () const

Description

This method returns the type of the node. This method should not be overridden by the user. It will return MPxNode::kIkSolverNode.

Return Value

  • the type of node

Status Codes

  • MS::kSuccess The undo was successful
  • MS::kFailure This method is not undoable

MStatus MPxIkSolverNode:: preSolve ()

Description

This method is called before doSolve. Users should override this method if there is any preprocessing that needs to be done before solving..

Return value

  • The status code which indicates if the pre-processing was successful

MStatus MPxIkSolverNode:: doSolve ()

Description

This is where the main solving takes place. The user must override this method.

The purpose of this method is to calculate joint angles in a skeleton based upon the position of the end effector of the handle associated with this solver.

Return value

  • The status code which indicates if the solver was successful

MStatus MPxIkSolverNode:: postSolve ( MStatus stat )

Description

This method is called after doSolve has finished. The user should override this method if there are any post calculations to be done.

The status argument indicates whether doSolve was successful.

Arguments

  • stat The status returned from doSolve

Return value

  • Status code to indicate whether the post calculations were successful

MString MPxIkSolverNode:: solverTypeName () const

Description

This method returns the type name of the solver.
The user must override this method in order for the solver to be identifiable when it is registered.
Once the solver is registered, the type name can be used to assign the solver to an IK handle.

Return value

  • The type name of this solver

bool MPxIkSolverNode:: rotatePlane ( MStatus *ReturnStatus) const

Description

This method indicates whether this solver supports the rotate plane. Solvers that support the rotate plane allow the user to manipulate the IK handle's pole vector with the rotate plane manipulators.

Return Value

  • true, solver supports the rotate plane
  • false, solver does not support the rotate plane

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxIkSolverNode:: setRotatePlane (bool rotatePlane )

Description

This method sets whether or not this solver supports the rotate plane. Solvers that support the rotate plane allow the user to manipulate the IK handle's pole vector with the rotate plane manipulators.

Arguments

  • rotatePlane whether or not the solver supports the rotate plane

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

bool MPxIkSolverNode:: singleChainOnly ( MStatus *ReturnStatus) const

Description

This method indicates whether this solver is a single chain solver. Single chain solvers are solvers which act on one handle only, i.e. the handle groups have only one handle if they are for single chain solvers.

Return Value

  • true, solver is a single chain solver
  • false, solver is not a single chain solver

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxIkSolverNode:: setSingleChainOnly (bool singleChainOnly )

Description

This method sets whether or not this solver is a single chain solver. Single chain solvers are solvers which act on one handle only, i.e. the handle groups have only one handle if they are for single chain solvers.

Arguments

  • singleChainOnly whether or not the solver is a single chain solver

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

bool MPxIkSolverNode:: positionOnly ( MStatus *ReturnStatus) const

Description

Indicates whether the ik solution is dependent on the ikHandle position only or also uses the orientation.

Return Value

  • true, solver does not support handle orientation
  • false, solver supports handle orientation

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxIkSolverNode:: setPositionOnly (bool positionOnly )

Description

Sets whether or not the solver supports handle orientation.

Arguments

  • positionOnly whether or not the solver is positionOnly

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

bool MPxIkSolverNode:: supportJointLimits ( MStatus *ReturnStatus) const

Description

This method indicates whether the solver supports limits on joint angles.

Return Value

  • true, solver supports limits on joint angles
  • false, solver does not support limits on joint angles

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxIkSolverNode:: setSupportJointLimits (bool supportJointLimits )

Description

This method sets whether or not the solver supports limits on joint angles.

Arguments

  • supportJointLimit whether or not the solver supports joint limits

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

bool MPxIkSolverNode:: uniqueSolution ( MStatus *ReturnStatus) const

Description

This method indicates whether the solver provides a unique solution.

Return Value

  • true, solver provides a unique solution
  • false, solver does not provide a unique solution

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxIkSolverNode:: setUniqueSolution (bool uniqueSolution )

Description

This method sets whether or not the solver provides a unique solution.

Arguments

  • uniqueSolution whether or not the solver provides a unique solution

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

bool MPxIkSolverNode:: isSingleChainOnly () const

Description

This method indicates whether this solver is a single chain solver.
Single chain solvers are solvers which act on one handle only, i.e. the handle groups have only one handle if they are for single chain solvers.

Return value

  • true This is a single chain solver
  • false This is not a single chain solver

bool MPxIkSolverNode:: isPositionOnly () const

Description

Indicates whether the solver supports handle orientation.
This method must be overriden to reflect the users solver.

Return value

  • true the solver does not support handle orientation
  • false the solver supports handle orientation

bool MPxIkSolverNode:: hasJointLimitSupport () const

Description

This method indicates whether the solver supports limits on joint angles.
This method must be overriden to reflect the users solver.

Return value

  • true solver supports joint limits
  • false solver does not support joint limits

bool MPxIkSolverNode:: hasUniqueSolution () const

Description

This method indicates whether the solver provides a unique solution.
This method must be overriden to reflect the users solver.

Return value

  • true solver has a unique solution
  • false solver does not have a unique solution

bool MPxIkSolverNode:: groupHandlesByTopology () const

Description

Indicates whether the IK system should group handles according to skeletal topology.
This method must be overriden to reflect the users solver.

Return value

  • true solver groups handles by topology
  • false solver does not groups handles by topology

MStatus MPxIkSolverNode:: setFuncValueTolerance ( double tolerance )

Description

Set the error value for this solver.
The user can override this if any other calcluations should be done here.

Arguments

  • tolerance Error value

Return value

  • Status code

MStatus MPxIkSolverNode:: setMaxIterations ( int value )

Description

Set the maximum iterations for a solution by this solver.
The user can override this if any other calcluations should be done here.

Arguments

  • value value to set

Return value

  • Status code

MIkHandleGroup * MPxIkSolverNode:: handleGroup () const

Description

Returns the handle group for this solver. The handle group provides access to handles associated with the solver.

Arguments

  • value value to set

Return value

  • A pointer to the IK handle group for this solver

void MPxIkSolverNode:: setHandleGroup ( MIkHandleGroup * group )

Description

Set the handle group of this solver.

Arguments

  • group The handle group to be set

const MMatrix * MPxIkSolverNode:: toWorldSpace () const

Description

Returns the world space matrix for this solver.

Return value

  • the world space matrix

const MMatrix * MPxIkSolverNode:: toSolverSpace () const

Description

Returns the local space matrix for this solver.

Return value

  • the local space matrix

double MPxIkSolverNode:: funcValueTolerance () const

Description

Return the error value for this solver.

Return value

  • The error value

int MPxIkSolverNode:: maxIterations () const

Description

Return the the maximum nuber of itertations for a solution by this solver.

Return value

  • The maximum number of iterations

void MPxIkSolverNode:: snapHandle ( MObject & handle )

Description

This function positions the handle at the end effector position.
The user can override this method.

Arguments

  • handle handle to be set

MStatus MPxIkSolverNode:: getJointAngles ( MDoubleArray & angles) const

Description

Returns the joint angles.

Arguments

  • angles The array of doubles to hold the angles.

Return value

  • MS::kSuccess The operation was successfull.
  • MS::kFailure The operation failed.

MStatus MPxIkSolverNode:: setJointAngles ( const MDoubleArray & angles )

Description

Set joint angles to the given values.

Arguments

  • angles The array of angles to set the joints to.

Return value

  • MS::kSucces the joint angles were set
  • MS::kFailure the joint angles were not set

void MPxIkSolverNode:: setToRestAngles ()

Description

Sets all joints to thier prefered orientations.

MPxIkSolverNode:: MPxIkSolverNode ()

Description

Constructor.

This class has no child classes.


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