class MAnimCurveClipboard

Jump to documentation

Control over the animation clipboard (OpenMayaAnim) (OpenMayaAnim.py)

public members:

MAnimCurveClipboard ()
~MAnimCurveClipboard ()
static MAnimCurveClipboard & theAPIClipboard ()
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

Documentation

This class provide access to the animation or API clipboard which are used to hold on to anim curves during cut/copy/paste operations.
Description
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. (Dag Objects with "/" for sides are animated, as in the Hypergraph)

          ____  
         / A /
         /___/\_______
           |\_____    \__
          ____   _|__   _|__    
         | B |  / E /  | F |
         |___|  /___/  |___|
           |             |\________
           ____          ____      _|__
          / C /         / G /     / H /
          /___/         /___/     /___/
           |
          ____
         / D / 
         /___/

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 heirarchy):

	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 subheirarchy 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 heirarchy 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().

Functions

MAnimCurveClipboard:: MAnimCurveClipboard ()

Description

Default Constructor.

MAnimCurveClipboard:: ~MAnimCurveClipboard ()

Description

Class Destructor.

MAnimCurveClipboard & MAnimCurveClipboard:: theAPIClipboard ()

Description

Returns the static API clipboard.

MStatus MAnimCurveClipboard:: set ( const MAnimCurveClipboard & cb )

Description

Replaces the contents of the clipboard

Arguments

  • cb the clipboard to copy

Return Value

  • 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 )

Description

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.

Arguments

  • clipboardItemArray the array of clipboard items to load on to the current clipboard

Return Value

  • 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 )

Description

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.

Arguments

  • clipboardItemArray the array of clipboard items to load on to the current clipboard
  • startTime the start time for the clipboard
  • endTime the end time for the clipboard
  • startUnitlessInput the start unitless input for the clipboard
  • endUnitlessInput the end unitless input for the clipboard

Return Value

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

MStatus MAnimCurveClipboard:: clear ()

Description

This method empties the clipboard.

Return Value

  • Status flag

Status Codes

  • MS::kSuccess The clipboard was successfully cleared.
  • MS::kFailure Error clearing the clipboard.

bool MAnimCurveClipboard:: isEmpty ( MStatus * ReturnStatus ) const

Description

Determines if the clipboard is empty.

Arguments

  • ReturnStatus Status Code (see below)

Return Value

  • 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

const MAnimCurveClipboardItemArray MAnimCurveClipboard:: clipboardItems ( MStatus * ReturnStatus ) const

Description

Returns the contents of the clipboard.

Arguments

  • ReturnStatus Status Code (see below)

Return Value

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

MTime MAnimCurveClipboard:: startTime ( MStatus * ReturnStatus ) const

Description

Returns the start time of the clipboard.

Arguments

  • ReturnStatus Status Code (see below)

Return Value

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

MTime MAnimCurveClipboard:: endTime ( MStatus * ReturnStatus ) const

Description

Returns the end time of the clipboard.

Arguments

  • ReturnStatus Status Code (see below)

Return Value

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

float MAnimCurveClipboard:: startUnitlessInput ( MStatus * ReturnStatus ) const

Description

Returns the start unitless input of the clipboard.

Arguments

  • ReturnStatus Status Code (see below)

Return Value

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

float MAnimCurveClipboard:: endUnitlessInput ( MStatus * ReturnStatus ) const

Description

Returns the end unitless input of the clipboard.

Arguments

  • ReturnStatus Status Code (see below)

Return Value

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

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright