MAnimCurveClipboard Class Reference
[OpenMayaAnim - API module for animation]

#include <MAnimCurveClipboard.h>
Collaboration diagram for MAnimCurveClipboard:
Collaboration graph
[legend]

List of all members.


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.

animHier.gif

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.


Public Member Functions

  MAnimCurveClipboard ()
  ~MAnimCurveClipboard ()
MStatus  set (const MAnimCurveClipboard &cb)
MStatus  set (const MAnimCurveClipboardItemArray &clipboardItemArray)
MStatus  set (const MAnimCurveClipboardItemArray &clipboardItemArray, const MTime &startTime, const MTime &endTime, const float &startUnitlessInput, const float &endUnitlessInput)
MStatus  clear ()
bool  isEmpty (MStatus *ReturnStatus=NULL) const
const MAnimCurveClipboardItemArray  clipboardItems (MStatus *ReturnStatus=NULL) const
MTime  startTime (MStatus *ReturnStatus=NULL) const
MTime  endTime (MStatus *ReturnStatus=NULL) const
float  startUnitlessInput (MStatus *ReturnStatus=NULL) const
float  endUnitlessInput (MStatus *ReturnStatus=NULL) const

Static Public Member Functions

static MAnimCurveClipboard theAPIClipboard ()

Constructor & Destructor Documentation

MAnimCurveClipboard::MAnimCurveClipboard (  ) 

Default Constructor.

MAnimCurveClipboard::~MAnimCurveClipboard (  ) 

Class Destructor.


Member Function Documentation

MAnimCurveClipboard & MAnimCurveClipboard::theAPIClipboard (  )  [static]

Returns the static API clipboard.

Examples:

MStatus MAnimCurveClipboard::set ( const MAnimCurveClipboard cb  ) 

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:

MStatus MAnimCurveClipboard::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.

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 MAnimCurveClipboard::set ( const MAnimCurveClipboardItemArray clipboardItemArray,
const MTime startTime,
const MTime endTime,
const float &  startUnitlessInput,
const float &  endUnitlessInput  
)

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.

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
Returns:
  • MS::kSuccess if the clipboard contents were set successfully
  • MS::kFailure if the clipboard contents were not set successfully

MStatus MAnimCurveClipboard::clear (  ) 

This method empties the clipboard.

Returns:
Status flag
Status Codes:
Examples:

bool MAnimCurveClipboard::isEmpty ( MStatus ReturnStatus = NULL  )  const

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

const MAnimCurveClipboardItemArray MAnimCurveClipboard::clipboardItems ( MStatus ReturnStatus = NULL  )  const

Returns the contents of the clipboard.

Parameters:
[out]  ReturnStatus  Status Code (see below)
Returns:
The item array currently on this clipboard.
Status Codes:
Examples:

MTime MAnimCurveClipboard::startTime ( MStatus ReturnStatus = NULL  )  const

Returns the start time of the clipboard.

Parameters:
[out]  ReturnStatus  Status Code (see below)
Returns:
The start time of the clipboard.
Status Codes:
Examples:

MTime MAnimCurveClipboard::endTime ( MStatus ReturnStatus = NULL  )  const

Returns the end time of the clipboard.

Parameters:
[out]  ReturnStatus  Status Code (see below)
Returns:
The end time of the clipboard.
Status Codes:
Examples:

float MAnimCurveClipboard::startUnitlessInput ( MStatus ReturnStatus = NULL  )  const

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:

float MAnimCurveClipboard::endUnitlessInput ( MStatus ReturnStatus = NULL  )  const

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

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