- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

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

# MPxIkSolverNode Class Reference
OpenMayaAnim - API module for animation | Proxy classes

This reference page is linked to from the following overview topics: Parent class descriptions, MPxNode and its derived classes.

Search for all occurrences

## Detailed Description

Base class for user defined IK solvers.

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:

- doSolve
- solverTypeName

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.

- compute
- getInternalValue
- setInternalValue
- legalConnection
- legalDisconnection
- connectionMade
- connectionBroken

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 its solve methods will be called in the same manner as the solvers within Maya.

Examples:

  simpleSolverNode.cpp.

`#include <MPxIkSolverNode.h>`

Inheritance diagram for MPxIkSolverNode:
[legend]

List of all members.

## Public Member Functions
virtual | ~MPxIkSolverNode ()
| Destructor.
virtual MPxNode::Type | type () const
| This method returns the type of the node.
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.
bool | rotatePlane (MStatus *ReturnStatus=NULL) const
| This method indicates whether this solver supports the rotate plane.
MStatus | setRotatePlane (bool rotatePlane)
| This method sets whether or not this solver supports the rotate plane.
bool | singleChainOnly (MStatus *ReturnStatus=NULL) const
| This method indicates whether this solver is a single chain solver.
MStatus | setSingleChainOnly (bool singleChainOnly)
| This method sets whether or not this solver is a single chain solver.
bool | positionOnly (MStatus *ReturnStatus=NULL) const
| Indicates whether the ik solution is dependent on the ikHandle position only or also uses the orientation.
MStatus | setPositionOnly (bool positionOnly)
| Sets whether or not the solver supports handle orientation.
bool | supportJointLimits (MStatus *ReturnStatus=NULL) const
| This method indicates whether the solver supports limits on joint angles.
MStatus | setSupportJointLimits (bool supportJointLimits)
| This method sets whether or not the solver supports limits on joint angles.
bool | uniqueSolution (MStatus *ReturnStatus=NULL) const
| This method indicates whether the solver provides a unique solution.
MStatus | setUniqueSolution (bool uniqueSolution)
| This method sets whether or not the solver provides a unique solution.
virtual bool | isSingleChainOnly () const
| This method is obsolete.
virtual bool | isPositionOnly () const
| This method is obsolete.
virtual bool | hasJointLimitSupport () const
| This method is obsolete.
virtual bool | hasUniqueSolution () const
| This method is obsolete.
virtual bool | groupHandlesByTopology () const
| This method is obsolete.
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.
MIkHandleGroup * | handleGroup () const
| Returns the handle group for this solver.
virtual void | setHandleGroup (MIkHandleGroup *)
| Set the handle group of this solver.
const MMatrix * | toWorldSpace () const
| Returns the world space matrix for this solver.
const MMatrix * | toSolverSpace () 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
| This method is not available in Python.
MStatus | setJointAngles (const MDoubleArray &)
| This method is not available in Python.
void | setToRestAngles ()
| This method is not available in Python.
| MPxIkSolverNode ()
| Constructor.

## Member Function Documentation

MPxNode::Type type | ( |  | ) | const`[virtual]`

Search for all occurrences

This method returns the type of the node.

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

Returns:
  The type of node

Status Codes:
  - MS::kSuccess The undo was successful
  - MS::kFailure This method is not undoable

Reimplemented from MPxNode.

MStatus preSolve | ( |  | ) | `[virtual]`

Search for all occurrences

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]`

Search for all occurrences

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

Examples:
  simpleSolverNode.cpp.

MStatus postSolve | ( | MStatus | stat | ) | `[virtual]`

Search for all occurrences

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] | stat | The status returned from doSolve

Returns:
  Status code to indicate whether the post calculations were successful

MString solverTypeName | ( |  | ) | const`[virtual]`

Search for all occurrences

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

Examples:
  simpleSolverNode.cpp.

bool rotatePlane | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

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.

Parameters:

  [in] | ReturnStatus | Status code.

Returns:
  Boolean value: true if the solver supports the rotate plane, false otherwise.

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setRotatePlane | ( | bool | rotatePlane | ) |

Search for all occurrences

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.

Parameters:

  [in] | rotatePlane | whether or not the solver supports the rotate plane

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

bool singleChainOnly | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

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.

Parameters:

  [in] | ReturnStatus | Status code.

Returns:
  Boolean value: true if the solver is a single chain solver, false otherwise.

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setSingleChainOnly | ( | bool | singleChainOnly | ) |

Search for all occurrences

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.

Parameters:

  [in] | singleChainOnly | whether or not the solver is a single chain solver

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

bool positionOnly | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

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

Parameters:

  [in] | ReturnStatus | Status code.

Returns:
  Boolean value: true if the solver does not support handle orientation, false otherwise

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setPositionOnly | ( | bool | positionOnly | ) |

Search for all occurrences

Sets whether or not the solver supports handle orientation.

Parameters:

  [in] | positionOnly | whether or not the solver is positionOnly

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

bool supportJointLimits | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

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

Parameters:

  [in] | ReturnStatus | Status code.

Returns:
  Boolean value. true if the solver supports limits on joint angles, false otherwise.

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setSupportJointLimits | ( | bool | supportJointLimits | ) |

Search for all occurrences

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

Parameters:

  [in] | supportJointLimits | whether or not the solver supports joint limits

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

bool uniqueSolution | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

This method indicates whether the solver provides a unique solution.

Parameters:

  [in] | ReturnStatus | Status code.

Returns:
  Boolean value: true if the solver provides a unique solution, false otherwise.

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

MStatus setUniqueSolution | ( | bool | uniqueSolution | ) |

Search for all occurrences

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

Parameters:

  [in] | uniqueSolution | whether or not the solver provides a unique solution

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure operation failed

bool isSingleChainOnly | ( |  | ) | const`[virtual]`

Search for all occurrences

This method is obsolete.

Deprecated:

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:
  Boolean value true if this is a single chain solver, false otherwise.

bool isPositionOnly | ( |  | ) | const`[virtual]`

Search for all occurrences

This method is obsolete.

Deprecated:

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

Returns:
  Boolean value true if solver does not support handle orientation, false otherwise.

bool hasJointLimitSupport | ( |  | ) | const`[virtual]`

Search for all occurrences

This method is obsolete.

Deprecated:

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

Returns:
  Boolean value true if solver supports joint limits, false otherwise.

bool hasUniqueSolution | ( |  | ) | const`[virtual]`

Search for all occurrences

This method is obsolete.

Deprecated:

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

Returns:
  Boolean value true if solver has a unique solution, false otherwise.

bool groupHandlesByTopology | ( |  | ) | const`[virtual]`

Search for all occurrences

This method is obsolete.

Deprecated:

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

Returns:
  Boolean value true if solver hgroups handles by topology, false otherwise.

MStatus setFuncValueTolerance | ( | double | tolerance | ) | `[virtual]`

Search for all occurrences

Set the error value for this solver.

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

Parameters:

  [in] | tolerance | Error value

Returns:
  Status code

MStatus setMaxIterations | ( | int | value | ) | `[virtual]`

Search for all occurrences

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] | value | value to set

Returns:
  Status code

MIkHandleGroup * handleGroup | ( |  | ) | const

Search for all occurrences

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]`

Search for all occurrences

Set the handle group of this solver.

Parameters:

  [in] | group | The handle group to be set

const MMatrix * toWorldSpace | ( |  | ) | const

Search for all occurrences

Returns the world space matrix for this solver.

Returns:
  The world space matrix

const MMatrix * toSolverSpace | ( |  | ) | const

Search for all occurrences

Returns the local space matrix for this solver.

Returns:
  The local space matrix

double funcValueTolerance | ( |  | ) | const

Search for all occurrences

Return the error value for this solver.

Returns:
  The error value

int maxIterations | ( |  | ) | const

Search for all occurrences

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

Returns:
  The maximum number of iterations

void snapHandle | ( | MObject & | handle | ) | `[virtual]`

Search for all occurrences

This function positions the handle at the end effector position.

The user can override this method.

Parameters:

  [in] | handle | handle to be set

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

Reimplemented from MPxNode.

MStatus getJointAngles | ( | MDoubleArray & | angles | ) | const`[protected]`

Search for all occurrences

This method is not available in Python.

Returns the joint angles. Use MPxIkSolverNode::_getJointAngles in scripts.

Parameters:

  [out] | angles | The array of doubles to hold the angles.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The operation was successfull.
  - MS::kFailure The operation failed.

MStatus setJointAngles | ( | const MDoubleArray & | angles | ) | `[protected]`

Search for all occurrences

This method is not available in Python.

Set joint angles to the given values. Use MPxIkSolverNode::_setJointAngles in scripts.

Parameters:

  [in] | angles | The array of angles to set the joints to.

Returns:
  Status code

Status Codes:
  - MS::kSucces the joint angles were set
  - MS::kFailure the joint angles were not set

void setToRestAngles | ( |  | ) | `[protected]`

Search for all occurrences

This method is not available in Python.

Sets all joints to thier prefered orientations. Use MPxIkSolverNode::_setToRestAngles in scripts.

MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode
MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode MPxIkSolverNode