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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

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

Search for all occurrences

## Detailed Description

ScaleManip function set.

This class provides access to the built-in Maya scale manipulator. The manipulator consists of three constrained-axis scale handles for non-proportional scaling, and a central handle for proportional scaling.

The manipulator provides data to the plugin through the scale manipVal. The scale value is a vector consisting of X, Y, and Z scale values. Each scale value represents a factor controlling how much an object should be extended along that dimension. The scale values are absolute and the initial scale value has a default of <1.0,1.0,1.0>.

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 scaleCenter manipVal.

Examples:

  componentScaleManip.cpp, and swissArmyManip.cpp.

`#include <MFnScaleManip.h>`

Inheritance diagram for MFnScaleManip:
[legend]

List of all members.

## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnScaleManip ()
| Destructor.
| MFnScaleManip ()
| Default constructor.
| MFnScaleManip (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
| MFnScaleManip (const MDagPath &object, MStatus *ret=NULL)
| Constructor.
MObject | create (MStatus *ReturnStatus=NULL)
| Creates a new ScaleManip, and attaches this function set to the new manipulator.
MObject | create (const MString &manipName, const MString &scaleName, MStatus *ReturnStatus=NULL)
| Creates a new ScaleManip, and attaches this function set to the new manipulator.
MStatus | connectToScalePlug (const MPlug &scalePlug)
| Create a 1-1 connection from the scale manipVal to the scalePlug parameter.
MStatus | connectToScaleCenterPlug (const MPlug &scaleCenterPlug)
| Create a 1-1 association of the scale center on the manipulator and the scaleCenterPlug parameter.
MStatus | setInitialScale (const MVector &scale)
| Sets the initial scale for the scale 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 | 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 working units.
MStatus | setOrientation (const MEulerRotation &direction)
| Sets the arbitrary orientation of the MFnScaleManip.
MEulerRotation | getOrientation (MStatus *ReturnStatus=NULL) const
| Returns the orientation used by the manip when its orientationMode is set to kArbitraryOrientation.
MStatus | setOrientationMode (ScaleOrientationMode mode)
| Sets the orientation mode of the MFnScaleManip.
ScaleOrientationMode | getOrientationMode (MStatus *ReturnStatus=NULL) const
| Gets the orientation mode of the MFnScaleManip.
unsigned int | scaleIndex (MStatus *ReturnStatus=NULL) const
| Returns the index of the scale manipVal for this manipulator.
unsigned int | scaleCenterIndex (MStatus *ReturnStatus=NULL) const
| Returns the index of the scale center manipVal for this manipulator.
| MFnScaleManip (const MObject &object, MStatus *ret=NULL)
| Constructor.
## Protected Member Functions
virtual const char * | className () const
| Class name.

## Constructor & Destructor Documentation

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

Destructor.

Class destructor.

MFnScaleManip | ( | 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

MFnScaleManip | ( | 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

MFnScaleManip | ( | 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::kScaleManip.

Reimplemented from MFnManip3D.

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

Search for all occurrences

Class name.

Return the class name : "MFnScaleManip".

Reimplemented from MFnManip3D.

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

Search for all occurrences

Creates a new ScaleManip, 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 "Scale", indicating that this manipulator is in use.

Parameters:

  [out] | 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 & | scaleName,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Creates a new ScaleManip, 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 scaleName, indicating that this manipulator is in use.

Parameters:

  [in] | manipName | Name of the manip for UI purposes.
  [in] | scaleName | Label for the scale 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 connectToScalePlug | ( | const MPlug & | scalePlug | ) |

Search for all occurrences

Create a 1-1 connection from the scale manipVal to the scalePlug parameter.

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

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

Parameters:

  [in] | scalePlug | The plug to connect the scale 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 connectToScaleCenterPlug | ( | const MPlug & | scaleCenterPlug | ) |

Search for all occurrences

Create a 1-1 association of the scale center on the manipulator and the scaleCenterPlug parameter.

When both the scale 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 scale center.

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

Parameters:

  [in] | scaleCenterPlug | The plug to connect the scale 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 setInitialScale | ( | const MVector & | scale | ) |

Search for all occurrences

Sets the initial scale for the scale manipulator.

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

Parameters:

  [in] | scale | The initial scale

Returns:
  - MS::kSuccess Successfully set the initial scale
  - MS::kFailure Could not set the scale 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 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, scale values will snap to scale value within some interval apart. The interval is set using setSnapIncrement().

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 the working unit, and is the distance between snap points when dragging the scale handles.

Parameters:

  [in] | snapInc | The new snap increment

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 working units.

Returns:
  Snapping increment

MStatus setOrientation | ( | const MEulerRotation & | orientation | ) |

Search for all occurrences

Sets the arbitrary orientation of the MFnScaleManip.

This only has any effect when the orientation mode is set to kArbitraryOrientation

Parameters:

  [in] | orientation | the new orientation for MFnScaleManip.

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure the function set doesn't have a valid scale manip object

MEulerRotation getOrientation | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the orientation used by the manip when its orientationMode is set to kArbitraryOrientation.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  Current orientation direction of the manip

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure the function set doesn't have a valid scale manip object

MStatus setOrientationMode | ( | ScaleOrientationMode | mode | ) |

Search for all occurrences

Sets the orientation mode of the MFnScaleManip.

When the manipulator's orientationMode is set to kArbitraryOrientation the manipulator will be oriented according to the value set by setOrientation(). When the orientationMode is set to kDefaultOrientation the manipulator will be aligned with the world-space axes.

Parameters:

  [in] | mode | the new orientation mode of the MFnScaleManip.

Returns:
  - MS::kSuccess operation successful
  - MS::kFailure the function set doesn't have a valid scale manip object

MFnScaleManip::ScaleOrientationMode getOrientationMode | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Gets the orientation mode of the MFnScaleManip.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  current orientation mode of the manip

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure the function set doesn't have a valid scale manip object

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

Search for all occurrences

Returns the index of the scale manipVal for this manipulator.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  Scale 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 scaleCenterIndex | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the index of the scale center manipVal for this manipulator.

Note that the scale center is only used for display of the manipulator and has no effect on scale values produced by the manipulator.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  Scale 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

MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip
MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip MFnScaleManip