#include <MAnimCurveClipboard.h>
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):
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().
Public Member Functions | |
MAnimCurveClipboard () | |
Default Constructor. | |
~MAnimCurveClipboard () | |
Class Destructor. | |
MStatus | set (const MAnimCurveClipboard &cb) |
Replaces the contents of the clipboard. More... | |
MStatus | set (const MAnimCurveClipboardItemArray &clipboardItemArray) |
Sets the contents of the clipboard. More... | |
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. More... | |
MStatus | clear () |
This method empties the clipboard. More... | |
bool | isEmpty (MStatus *ReturnStatus=NULL) const |
Determines if the clipboard is empty. More... | |
const MAnimCurveClipboardItemArray | clipboardItems (MStatus *ReturnStatus=NULL) const |
Returns the contents of the clipboard. More... | |
MTime | startTime (MStatus *ReturnStatus=NULL) const |
Returns the start time of the clipboard. More... | |
MTime | endTime (MStatus *ReturnStatus=NULL) const |
Returns the end time of the clipboard. More... | |
float | startUnitlessInput (MStatus *ReturnStatus=NULL) const |
Returns the start unitless input of the clipboard. More... | |
float | endUnitlessInput (MStatus *ReturnStatus=NULL) const |
Returns the end unitless input of the clipboard. More... | |
Static Public Member Functions | |
static MAnimCurveClipboard & | theAPIClipboard () |
Returns the static API clipboard. | |
MStatus set | ( | const MAnimCurveClipboard & | cb | ) |
Replaces the contents of the clipboard.
[in] | cb | the clipboard to copy |
MStatus set | ( | const MAnimCurveClipboardItemArray & | clipboardItemArray | ) |
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.
[in] | clipboardItemArray | the array of clipboard items to load on to the current 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.
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.
[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. |
MStatus clear | ( | ) |
This method empties the clipboard.
bool isEmpty | ( | MStatus * | ReturnStatus = NULL | ) | const |
Determines if the clipboard is empty.
[out] | ReturnStatus | Status Code (see below) |
const MAnimCurveClipboardItemArray clipboardItems | ( | MStatus * | ReturnStatus = NULL | ) | const |
Returns the contents of the clipboard.
[out] | ReturnStatus | Status Code (see below) |
Returns the start time of the clipboard.
[out] | ReturnStatus | Status Code (see below) |
Returns the end time of the clipboard.
[out] | ReturnStatus | Status Code (see below) |
float startUnitlessInput | ( | MStatus * | ReturnStatus = NULL | ) | const |
Returns the start unitless input of the clipboard.
[out] | ReturnStatus | Status Code (see below) |
float endUnitlessInput | ( | MStatus * | ReturnStatus = NULL | ) | const |
Returns the end unitless input of the clipboard.
[out] | ReturnStatus | Status Code (see below) |