MFnRotateManip Class Reference
[OpenMayaUI - API module for user interfaceFunctionSet classes]

#include <MFnRotateManip.h>

Inheritance diagram for MFnRotateManip:

Inheritance graph
[legend]
Collaboration diagram for MFnRotateManip:

Collaboration graph
[legend]

List of all members.


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.


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)
MObject create (const MString &manipName, const MString &rotationName, MStatus *ReturnStatus=NULL)
MStatus connectToRotationPlug (const MPlug &rotationPlug)
MStatus connectToRotationCenterPlug (const MPlug &rotationCenterPlug)
MStatus setInitialRotation (const MEulerRotation &rotation)
MStatus displayWithNode (const MObject &node)
MStatus setRotateMode (RotateMode mode)
RotateMode rotateMode () const
MStatus setSnapMode (bool snapEnabled)
bool isSnapModeOn () const
MStatus setSnapIncrement (double snapInc)
double snapIncrement () const
unsigned int rotationIndex (MStatus *ReturnStatus=NULL) const
unsigned int rotationCenterIndex (MStatus *ReturnStatus=NULL) const
 MFnRotateManip (const MObject &object, MStatus *ret=NULL)
 Constructor.

Protected Member Functions

virtual const char * className () const
 Class name.

Member Enumeration Documentation

Manipulator rotation modes.

Enumerator:
kObjectSpace  Object Space (default).
kWorldSpace  World Space.
kGimbal  Gimbal.


Constructor & Destructor Documentation

MFnRotateManip::~MFnRotateManip (  )  [virtual]

Destructor.

Class destructor.

MFnRotateManip::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:

MFnRotateManip::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:

MFnRotateManip::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:


Member Function Documentation

MFn::Type MFnRotateManip::type (  )  const [virtual]

Function set type.

Return the class type : MFn::kRotateManip

Reimplemented from MFnManip3D.

const char * MFnRotateManip::className (  )  const [protected, virtual]

Class name.

Return the class name : "MFnRotateManip"

Reimplemented from MFnManip3D.

MObject MFnRotateManip::create ( MStatus ReturnStatus = NULL  ) 

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:

MObject MFnRotateManip::create ( const MString manipName,
const MString rotationName,
MStatus ReturnStatus = NULL 
)

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 The name for the manipulator
[in] rotationName The string that displays in the feedback line while the rotation is being changed
[out] ReturnStatus return status
Returns:
An object corresponding to the new manipulator
Status Codes:

Reimplemented from MFnDependencyNode.

MStatus MFnRotateManip::connectToRotationPlug ( const MPlug rotationPlug  ) 

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 MFnRotateManip::connectToRotationCenterPlug ( const MPlug rotationCenterPlug  ) 

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 MFnRotateManip::setInitialRotation ( const MEulerRotation rotation  ) 

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 MFnRotateManip::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. The node must be a DAG object.

Parameters:
[in] node The node the manipulator should display with
Returns:

MStatus MFnRotateManip::setRotateMode ( RotateMode  mode  ) 

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:

MFnRotateManip::RotateMode MFnRotateManip::rotateMode (  )  const

Returns the current rotation mode.

Returns:
The current rotation mode

MStatus MFnRotateManip::setSnapMode ( bool  snapEnabled  ) 

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:

bool MFnRotateManip::isSnapModeOn (  )  const

Returns true when snap mode is on.

Returns:
Snap mode

MStatus MFnRotateManip::setSnapIncrement ( double  snapInc  ) 

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:

double MFnRotateManip::snapIncrement (  )  const

Returns the snapping increment in degrees.

Returns:
Snapping increment (degrees)

unsigned int MFnRotateManip::rotationIndex ( MStatus ReturnStatus = NULL  )  const

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 MFnRotateManip::rotationCenterIndex ( MStatus ReturnStatus = NULL  )  const

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


Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6