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

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions

# MFnRotateManip Class Reference
OpenMayaUI - API module for user interface | FunctionSet classes

Search for all occurrences

## Detailed Description

RotateManip function set.

This class provides access to the built-in Maya rotate manipulator. The manipulator consists of three constrained-axis rotation rings, a view rotation ring, as well as an invisible trackball that allows the user to rotate in arbitrary directions on the sphere.

The manipulator provides data to the plugin through the rotation manipVal. The rotation value is a vector consisting of x, y, and z rotations. Rotations are measured from the initial rotation (usually <0,0,0>) of the manipulator.

The manipulator can be configured either to display with an object (which must be a DAG node) or to display at an arbitrary point using the rotationCenter manipVal.

Examples:

  rotateManip.cpp, and swissArmyManip.cpp.

`#include <MFnRotateManip.h>`

Inheritance diagram for MFnRotateManip:
[legend]

List of all members.

## Public Types
enum | RotateMode { kObjectSpace = 0, kWorldSpace, kGimbal }
| Manipulator rotation modes. More...
## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnRotateManip ()
| Destructor.
| MFnRotateManip ()
| Default constructor.
| MFnRotateManip (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
| MFnRotateManip (const MDagPath &object, MStatus *ret=NULL)
| Constructor.
MObject | create (MStatus *ReturnStatus=NULL)
| Creates a new RotateManip, and attaches this function set to the new manipulator.
MObject | create (const MString &manipName, const MString &rotationName, MStatus *ReturnStatus=NULL)
| Creates a new RotateManip, and attaches this function set to the new manipulator.
MStatus | connectToRotationPlug (const MPlug &rotationPlug)
| Create a 1-1 connection from the rotation manipVal to the rotationPlug parameter.
MStatus | connectToRotationCenterPlug (const MPlug &rotationCenterPlug)
| Create a 1-1 association of the rotation center on the manipulator and the rotationCenterPlug parameter.
MStatus | setInitialRotation (const MEulerRotation &rotation)
| Sets the initial rotation for the rotate manipulator.
MStatus | displayWithNode (const MObject &node)
| Configures the manipulator to display with the node, causing the position of the manipulator to follow the position of the node whenever the node is moved.
MStatus | setRotateMode (RotateMode mode)
| Sets the mode for the rotation manipulator.
RotateMode | rotateMode () const
| Returns the current rotation mode.
MStatus | setSnapMode (bool snapEnabled)
| Sets the snap mode.
bool | isSnapModeOn () const
| Returns true when snap mode is on.
MStatus | setSnapIncrement (double snapInc)
| Sets the snap increment.
double | snapIncrement () const
| Returns the snapping increment in degrees.
unsigned int | rotationIndex (MStatus *ReturnStatus=NULL) const
| Returns the index of the rotation manipVal for the manipulator.
unsigned int | rotationCenterIndex (MStatus *ReturnStatus=NULL) const
| Returns the index of the rotation center for the manipulator.
MStatus | setRotationCenter (const MPoint &rotationCenter)
| Sets the position of the rotation center for the manipulator.
| MFnRotateManip (const MObject &object, MStatus *ret=NULL)
| Constructor.
## Protected Member Functions
virtual const char * | className () const
| Class name.

## Member Enumeration Documentation

enum RotateMode

Search for all occurrences

Manipulator rotation modes.

Enumerator:

  kObjectSpace | Object Space (default) Search for all occurrences
  kWorldSpace | World Space. Search for all occurrences
  kGimbal | Gimbal. Search for all occurrences

## Constructor & Destructor Documentation

~MFnRotateManip | ( |  | ) | `[virtual]`

Destructor.

Class destructor.

MFnRotateManip | ( | MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the 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

MFnRotateManip | ( | const MDagPath & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given constant MDagPath object.

Parameters:

  [in] | object | The const MDagPath to attach the function set to
  [out] | ReturnStatus | The 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

MFnRotateManip | ( | const MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the 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]`

Search for all occurrences

Function set type.

Return the class type : MFn::kRotateManip.

Reimplemented from MFnManip3D.

const char * className | ( |  | ) | const`[protected, virtual]`

Search for all occurrences

Class name.

Return the class name : "MFnRotateManip".

Reimplemented from MFnManip3D.

MObject create | ( | MStatus * | ReturnStatus = `NULL` | ) |

Search for all occurrences

Creates a new RotateManip, and attaches this function set to the new manipulator.

This method should only be used to create a non-composite manipulator, meaning that the manipulator is standalone and not part of a container.

When the manipulator is being used, the feedback line will display a string including "Rotation", indicating that this manipulator is in use.

Parameters:

  [in] | ReturnStatus | return status

Returns:
  An object corresponding to the new manipulator

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

MObject create | ( | const MString & | manipName,
|  | const MString & | rotationName,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Creates a new RotateManip, and attaches this function set to the new manipulator.

This method should only be used to create a non-composite manipulator, meaning that the manipulator is standalone and not part of a container.

When the manipulator is being used, the feedback line will display a string including rotationName, indicating that this manipulator is in use.

Parameters:

  [in] | manipName | Name of the manip for UI purposes.
  [in] | rotationName | Label for the rotation value displayed in the feedback line.
  [out] | ReturnStatus | Status code.

Returns:
  An object corresponding to the new manipulator.

Status Codes:
  - MS::kSuccess Operation successful.
  - MS::kFailure Operation failed.

Reimplemented from MFnDependencyNode.

MStatus connectToRotationPlug | ( | const MPlug & | rotationPlug | ) |

Search for all occurrences

Create a 1-1 connection from the rotation manipVal to the rotationPlug parameter.

Any changes to the rotation manipVal will be immediately reflected in the connected plug. Connecting to the "rotation" plug on a transform node will produce similar behavior to the built-in rotate manipulator.

The plug must have a data type of MFnNumericData::k3Double.

Parameters:

  [in] | rotationPlug | The plug to connect the rotation value to

Returns:
  - MS::kSuccess Successfully connected the plug
  - MS::kFailure Could not connect to the plug or an invalid object is attached to the function set

MStatus connectToRotationCenterPlug | ( | const MPlug & | rotationCenterPlug | ) |

Search for all occurrences

Create a 1-1 association of the rotation center on the manipulator and the rotationCenterPlug parameter.

When both the rotation center is attached to a plug and the displayWithNode() method has been called, the manipulator will display with the node regardless of the connection made to the rotation center.

The plug must have a data type of MFnNumericData::k3Double.

Parameters:

  [in] | rotationCenterPlug | The plug to connect the rotation center to

Returns:
  - MS::kSuccess Successfully connected the plug
  - MS::kFailure Could not connect to the plug or an invalid object is attached to the function set

MStatus setInitialRotation | ( | const MEulerRotation & | rotation | ) |

Search for all occurrences

Sets the initial rotation for the rotate manipulator.

Setting the initial rotation will prevent the manipulator from jumping back to the default rotation when there is already an existing rotation on the target plug.

Parameters:

  [in] | rotation | The initial rotation

Returns:
  - MS::kSuccess Successfully set the initial rotation
  - MS::kFailure Could not set the rotation or an invalid object is attached to the function set

MStatus displayWithNode | ( | const MObject & | node | ) |

Search for all occurrences

Configures the manipulator to display with the node, causing the position of the manipulator to follow the position of the node whenever the node is moved.

The node must be a DAG object.

Parameters:

  [in] | node | The node the manipulator should display with

Returns:
  - MS::kSuccess Successfully configured display with the node
  - MS::kInvalidParameter Invalid node parameter
  - MS::kFailure Could not display with the node or an invalid object is attached to the function set

MStatus setRotateMode | ( | RotateMode | mode | ) |

Search for all occurrences

Sets the mode for the rotation manipulator.

The manipulator mode controls the appearance of the manipulator when is it used.

Modes

The following modes are supported for the rotation manipulator:

- MFnRotateManip::kObjectSpace In object space mode, the manipulator is displayed as three perpendicular manipulator discs, as well as a view disc enclosing the manipulator. The manipulator will rotate whenever the manip value is changed.
- MFnRotateManip::kWorldSpace This mode forces the manipulator to display in the default orientation regardless of the manipulator value. The manipulator is displayed the same as in object space mode, except it does not rotate when the manip value is changed.
- MFnRotateManip::kGimbal In gimbal mode, only the constrained axis rotation discs are allowed to be manipulated. Gimbal mode treats the X,Y, and Z axis rotations as a sequence of operations on the default manipulator display. First, the X rotation is applied. Then, the Y rotation is applied, causing the X rotation disc to become transformed. Finally, the Z rotation is applied, transforming both the X and Y rotation discs. The Z rotation disc remains fixed during the operation. No view disc can be manipulated in gimbal mode.

Parameters:

  [in] | mode | The new manipulator mode

Returns:
  - MS::kSuccess Successfully set the manipulator mode
  - MS::kInvalidParameter Invalid mode parameter
  - MS::kFailure The function set is attached to an invalid object

MFnRotateManip::RotateMode rotateMode | ( |  | ) | const

Search for all occurrences

Returns the current rotation mode.

Returns:
  The current rotation mode

MStatus setSnapMode | ( | bool | snapEnabled | ) |

Search for all occurrences

Sets the snap mode.

The snap modes can be either on (true) or off (false). When snap mode is on, rotation manip values will snap to the values within some increment apart.

Parameters:

  [in] | snapEnabled | The new snap mode

Returns:
  - MS::kSuccess Successfully set the snap mode
  - MS::kFailure The function set is attached to an invalid object

bool isSnapModeOn | ( |  | ) | const

Search for all occurrences

Returns true when snap mode is on.

Returns:
  Snap mode

MStatus setSnapIncrement | ( | double | snapInc | ) |

Search for all occurrences

Sets the snap increment.

The snap increment is specified in degrees. Manipulator values will snap to the next rotation at an angle of snapInc from the original rotation. Note that snap rotate does not apply to the trackball rotations (when dragging between the rotate discs).

Parameters:

  [in] | snapInc | The new snap increment in degrees

Returns:
  - MS::kSuccess Successfully set the snap increment
  - MS::kFailure The function set is attached to an invalid object

double snapIncrement | ( |  | ) | const

Search for all occurrences

Returns the snapping increment in degrees.

Returns:
  Snapping increment (degrees)

unsigned int rotationIndex | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the index of the rotation manipVal for the manipulator.

When plugToManip conversion functions are used to produce the rotation manipVal, the manipulator data must be of the type MFnNumericData::k3Double, with X,Y, and Z rotations given in radians. This is easily accomplished by using the MEulerRotation class to manage the rotations.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  Rotation index

Status Codes:
  - MS::kSuccess Successfully retrieved the index
  - MS::kFailure Failed to retrieve the index or the object attached to this function set is invalid

unsigned int rotationCenterIndex | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the index of the rotation center for the manipulator.

Note that the rotation center is only used for positioning the display of the manipulator, and has no effect on the rotation values generated by the manipulator.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  Rotation center index

Status Codes:
  - MS::kSuccess Successfully retrieved the index
  - MS::kFailure Failed to retrieve the index or the object attached to this function set is invalid

MStatus setRotationCenter | ( | const MPoint & | rotationCenter | ) |

Search for all occurrences

Sets the position of the rotation center for the manipulator.

The value set by this method is ignored if a plug has been connected to the rotationCenterPlug. This value is only relevant when there is no plug connection to rotationCenterPlug nor node associated with the manip (see connectToRotationCenterPlug and displayWithNode, respectively).

Note that the rotation center is only used for positioning the display of the manipulator, and has no effect on the rotation values generated by the manipulator.

Parameters:

  [in] | rotationCenter | The world space position of the rotation center.

Returns:
  Return status

Status Codes:
  - MS::kSuccess Successfully set the rotation center.
  - MS::kFailure The object attached to this function set is invalid.

MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip
MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip MFnRotateManip