Public Member Functions | Static Public Member Functions | Protected Member Functions

MPxIkSolver Class Reference

Search for all occurrences

Detailed Description

OBSOLETE CLASS: Base class for user defined IK solvers.

Deprecated:
This class is obsolete and will be removed in a future version of Maya. It has been replaced with the MPxIkSolverNode class.

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

To register a solver, write a creator method to return an instance of the user solver:

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

The solver can then be registered using MFnPlugin::registerSolver.

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

#include <MPxIkSolver.h>

List of all members.

Public Member Functions

virtual ~MPxIkSolver ()
 Destructor.
virtual MStatus preSolve ()
 This method is called before doSolve.
virtual MStatus doSolve ()
 This is where the main solving takes place.
virtual MStatus postSolve (MStatus)
 This method is called after doSolve has finished.
virtual MString solverTypeName () const
 This method returns the type name of the solver.
virtual bool isSingleChainOnly () const
 This method indicates whether this solver is a single chain solver.
virtual bool isPositionOnly () const
 Indicates whether the solver supports handle orientation.
virtual bool hasJointLimitSupport () const
 This method indicates whether the solver supports limits on joint angles.
virtual bool hasUniqueSolution () const
 This method indicates whether the solver provides a unique solution.
virtual bool groupHandlesByTopology () const
 Indicates whether the IK system should group handles according to skeletal topology.
virtual MStatus setFuncValueTolerance (double tolerance)
 Set the error value for this solver.
virtual MStatus setMaxIterations (int value)
 Set the maximum iterations for a solution by this solver.
MIkHandleGrouphandleGroup () const
 Returns the handle group for this solver.
virtual void setHandleGroup (MIkHandleGroup *)
 Set the handle group of this solver.
const MMatrixtoWorldSpace () const
 Returns the world space matrix for this solver.
const MMatrixtoSolverSpace () const
 Returns the local space matrix for this solver.
double funcValueTolerance () const
 Return the error value for this solver.
int maxIterations () const
 Return the the maximum nuber of itertations for a solution by this solver.
virtual void snapHandle (MObject &handle)
 This function positions the handle at the end effector position.

Static Public Member Functions

static const char * className ()
 Returns the name of this class.

Protected Member Functions

MStatus getJointAngles (MDoubleArray &) const
 Returns the joint angles.
MStatus setJointAngles (const MDoubleArray &)
 Set joint angles to the given values.
void setToRestAngles ()
 Sets all joints to thier prefered orientations.
 MPxIkSolver ()
 Constructor.

Constructor & Destructor Documentation

~MPxIkSolver ( ) [virtual]

Destructor.

Local class data should be freed here.


Member Function Documentation

MStatus preSolve ( ) [virtual]

This method is called before doSolve.

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

Returns:
The status code which indicates if the pre-processing was successful
MStatus doSolve ( ) [virtual]

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.

Returns:
The status code which indicates if the solver was successful
MStatus postSolve ( MStatus  stat) [virtual]

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.

Parameters:
[out]statThe status returned from doSolve
Returns:
Status code to indicate whether the post calculations were successful
MString solverTypeName ( ) const [virtual]

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.

Returns:
The type name of this solver
bool isSingleChainOnly ( ) const [virtual]

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.

Returns:
  • true This is a single chain solver
  • false This is not a single chain solver
bool isPositionOnly ( ) const [virtual]

Indicates whether the solver supports handle orientation.

This method must be overriden to reflect the users solver.

Returns:
  • true the solver does not support handle orientation
  • false the solver supports handle orientation
bool hasJointLimitSupport ( ) const [virtual]

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

This method must be overriden to reflect the users solver.

Returns:
  • true solver supports joint limits
  • false solver does not support joint limits
bool hasUniqueSolution ( ) const [virtual]

This method indicates whether the solver provides a unique solution.

This method must be overriden to reflect the users solver.

Returns:
  • true solver has a unique solution
  • false solver does not have a unique solution
bool groupHandlesByTopology ( ) const [virtual]

Indicates whether the IK system should group handles according to skeletal topology.

This method must be overriden to reflect the users solver.

Returns:
  • true solver groups handles by topology
  • false solver does not groups handles by topology
MStatus setFuncValueTolerance ( double  tolerance) [virtual]

Set the error value for this solver.

The user can override this if any other calcluations should be done here.

Parameters:
[in]toleranceError value
Returns:
Status code
MStatus setMaxIterations ( int  value) [virtual]

Set the maximum iterations for a solution by this solver.

The user can override this if any other calcluations should be done here.

Parameters:
[in]valuevalue to set
Returns:
Status code
MIkHandleGroup * handleGroup ( ) const

Returns the handle group for this solver.

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

Returns:
A pointer to the ik handle group for this solver
void setHandleGroup ( MIkHandleGroup group) [virtual]

Set the handle group of this solver.

Parameters:
[in]groupThe handle group to be set
const MMatrix * toWorldSpace ( ) const

Returns the world space matrix for this solver.

Returns:
The world space matrix
const MMatrix * toSolverSpace ( ) const

Returns the local space matrix for this solver.

Returns:
The local space matrix
double funcValueTolerance ( ) const

Return the error value for this solver.

Returns:
The error value
int maxIterations ( ) const

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

Returns:
The maximum number of iterations
void snapHandle ( MObject handle) [virtual]

This function positions the handle at the end effector position.

The user can override this method.

Parameters:
[in]handlehandle to be set
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.
MStatus getJointAngles ( MDoubleArray angles) const [protected]

Returns the joint angles.

Parameters:
[out]anglesThe array of doubles to hold the angles.
Returns:
MStatus setJointAngles ( const MDoubleArray angles) [protected]

Set joint angles to the given values.

Parameters:
[in]anglesThe array of angles to set the joints to.
Returns:
  • MS::kSucces the joint angles were set
  • MS::kFailure the joint angles were not set

MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver
MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver MPxIkSolver