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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MAnimCurveClipboard Class Reference
OpenMayaAnim - API module for animation

Search for all occurrences

## Detailed Description

Control over the animation clipboard.

The clipboard is a list of MAnimCurveClipboardItems (i.e. an MAnimCurveClipboardItemArray). All of the data stored on a clipboard remains static; that is, it will persist as long as the application remains running.

The items on the clipboard must be ordered. In the case where the clipboard info represents animation of a hierarchy, the order in which items appear in the clipboard is reliant on a depth-first-iteration from the root or the hierarchy. This ordering, is essential to properly match up hierarchies of objects

As an example, consider that animation from the following hierarchy is placed into the clipboard. Slanted Dag Objects are animated.

In this example, the object labelled "C" has translate{X,Y,Z} animated, while all the others only have one animated attribute (excluding objects B and F, which have no animated attributes).

Using notation where A(r,c,a) represents the animCurve driving object "A", which is at row "r" in its subhierarchy, has "c" children, and "a" animated attributes these items would appear in the clipboard in this order (i.e. depth-first with each object's attributes explicitly indexed before continuing down the hierarchy):

        A(0,3,0) , B(1,1,0) , C(2,1,0) , C(2,1,1) , C(2,1,2) , D(3,0,0) ,
        E(1,0,0) , F(1,2,0) , G(2,0,0) , H(2,0,0)

For example C(2,1,2) would mean that the object C resides on the second level of the subhierarchy and has one child. The last "2" is simply used as an index to count the number of animated attributes on this object.

Multiple objects can be represented on the clipboard in this manner. In the example above, if we had a separate second object with no children, "J", it would appear at the end of the array as J(0,0,0).

Note that although B and F contain no animation data themselves, they must still be placed on the clipboard as placeholders to preserve the hierarchy information. A placeholder object is defined by a NULL value for the MAnimCurveClipboardItem's animCurve.

There is a special clipboard that remains static. It can be accessed by MAnimCurveClipboard::theAPIClipboard().

Examples:

  animFileUtils.cpp, animFileUtils.h, and animImportExport.h.

`#include <MAnimCurveClipboard.h>`

List of all members.

## Public Member Functions
| MAnimCurveClipboard ()
| Default Constructor.
| ~MAnimCurveClipboard ()
| Class Destructor.
MStatus | set (const MAnimCurveClipboard &cb)
| Replaces the contents of the clipboard.
MStatus | set (const MAnimCurveClipboardItemArray &clipboardItemArray)
| Sets the contents of the clipboard.
MStatus | set (const MAnimCurveClipboardItemArray &clipboardItemArray, const MTime &startTime, const MTime &endTime, const float &startUnitlessInput, const float &endUnitlessInput, bool strictValidation=true)
| Sets the contents of the clipboard.
MStatus | clear ()
| This method empties the clipboard.
bool | isEmpty (MStatus *ReturnStatus=NULL) const
| Determines if the clipboard is empty.
const MAnimCurveClipboardItemArray | clipboardItems (MStatus *ReturnStatus=NULL) const
| Returns the contents of the clipboard.
MTime | startTime (MStatus *ReturnStatus=NULL) const
| Returns the start time of the clipboard.
MTime | endTime (MStatus *ReturnStatus=NULL) const
| Returns the end time of the clipboard.
float | startUnitlessInput (MStatus *ReturnStatus=NULL) const
| Returns the start unitless input of the clipboard.
float | endUnitlessInput (MStatus *ReturnStatus=NULL) const
| Returns the end unitless input of the clipboard.
## Static Public Member Functions
static MAnimCurveClipboard & | theAPIClipboard ()
| Returns the static API clipboard. Search for all occurrences

## Member Function Documentation

MStatus set | ( | const MAnimCurveClipboard & | cb | ) |

Search for all occurrences

Replaces the contents of the clipboard.

Parameters:

  [in] | cb | the clipboard to copy

Returns:
  - MS::kSuccess if the clipboard contents were set successfully
  - MS::kFailure if the clipboard contents were not set successfully

Examples:
  animFileUtils.cpp.

MStatus set | ( | const MAnimCurveClipboardItemArray & | clipboardItemArray | ) |

Search for all occurrences

Sets the contents of the clipboard.

The leading offset information is not preserved if this method is used. For example, if the keys on the animCurve you wish to cut fall within the range of 10 to 20 frames, and a startTime of 3 is specified, the leading offset of 7 frames is not preserved.

Parameters:

  [in] | clipboardItemArray | the array of clipboard items to load on to the current clipboard

Returns:
  - MS::kSuccess if the clipboard contents were set successfully
  - MS::kFailure if the clipboard contents were not set successfully

MStatus set | ( | const MAnimCurveClipboardItemArray & | clipboardItemArray,
|  | const MTime & | startTime,
|  | const MTime & | endTime,
|  | const float & | startUnitlessInput,
|  | const float & | endUnitlessInput,
|  | bool | strictValidation = `true`
| ) |  |

Search for all occurrences

Sets the contents of the clipboard.

The start and end arguments are used to preserve offset information. For example, if the keys on the animCurve you wish to cut fall within the range of 10 to 20 frames, and a startTime of 3 is specified, the offset of 7 frames is preserved.

The arguments startTime and endTime are used to specify the range for animCurves of type kAnimCurveT*, while startUnitlessInput and endUnitlessInput are used to specify the range for animCurves of type kAnimCurveU*.

If the values of the MTime and float arguments are reversed (i.e. startTime > endTime or startUnitlessInput > endUnitlessInput ) then the range to be placed on the clipboard will be determined by the first and last key on the animCurves (i.e. leading offset information will not be preserved).

The start and end values must also bound the animation (i.e. the first and last key respectively), otherwise this method will fail. If there is no animation on any of the items being placed on the clipboard, the range is ignored.

The strictValidation argument exists to provide backwards compatibility with former workflows where certain clipboard hierarchy orders were strictly enforced, preventing setting of the clipboard contents unless the selection and hierarchy order met the validation criteria, such as the first element must have a depth of zero. When true, the validation is done and the clipboard will not be set unless the hierarchy restrictions are met. When false, pasting by name can work even if the hierarchy/selection order is different during the paste.

Parameters:

  [in] | clipboardItemArray | the array of clipboard items to load on to the current clipboard
  [in] | startTime | the start time for the clipboard
  [in] | endTime | the end time for the clipboard
  [in] | startUnitlessInput | the start unitless input for the clipboard
  [in] | endUnitlessInput | the end unitless input for the clipboard
  [in] | strictValidation | if true, do the validation check, if false, then don't do the check.

Returns:
  - MS::kSuccess if the clipboard contents were set successfully
  - MS::kFailure if the clipboard contents were not set successfully

MStatus clear | ( |  | ) |

Search for all occurrences

This method empties the clipboard.

Returns:
  Status flag

Status Codes:
  - MS::kSuccess The clipboard was successfully cleared.
  - MS::kFailure Error clearing the clipboard.

Examples:
  animImportExport.cpp.

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

Search for all occurrences

Determines if the clipboard is empty.

Parameters:

  [out] | ReturnStatus | Status Code (see below)

Returns:
  - true the current clipboard is empty
  - false the current clipboard is not empty
  Status Code

- MS::kSuccess the query was successful
- MS::kFailure the query was not successful

Examples:
  animFileUtils.cpp, and animImportExport.cpp.

const MAnimCurveClipboardItemArray clipboardItems | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the contents of the clipboard.

Parameters:

  [out] | ReturnStatus | Status Code (see below)

Returns:
  The item array currently on this clipboard.

Status Codes:
  - MS::kSuccess if the contents could be retrieved
  - MS::kFailure if the contents could not be retrieved

Examples:
  animFileUtils.cpp.

MTime startTime | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the start time of the clipboard.

Parameters:

  [out] | ReturnStatus | Status Code (see below)

Returns:
  The start time of the clipboard.

Status Codes:
  - MS::kSuccess if the start time could be retrieved
  - MS::kFailure if the start time could not be retrieved

Examples:
  animFileUtils.cpp.

MTime endTime | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the end time of the clipboard.

Parameters:

  [out] | ReturnStatus | Status Code (see below)

Returns:
  The end time of the clipboard.

Status Codes:
  - MS::kSuccess if the end time could be retrieved
  - MS::kFailure if the end time could not be retrieved

Examples:
  animFileUtils.cpp.

float startUnitlessInput | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the start unitless input of the clipboard.

Parameters:

  [out] | ReturnStatus | Status Code (see below)

Returns:
  The start unitless input of the clipboard.

Status Codes:
  - MS::kSuccess if the start unitless input could be retrieved
  - MS::kFailure if the start unitless input could not be retrieved

Examples:
  animFileUtils.cpp.

float endUnitlessInput | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the end unitless input of the clipboard.

Parameters:

  [out] | ReturnStatus | Status Code (see below)

Returns:
  The end unitless input of the clipboard.

Status Codes:
  - MS::kSuccess if the end unitless input be retrieved
  - MS::kFailure if the end unitless input not be retrieved

Examples:
  animFileUtils.cpp.

MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard
MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard MAnimCurveClipboard