class MTime

Jump to documentation

Set and retrieve animation time values. (OpenMaya) (OpenMaya.py)

public members:

enum Unit
kInvalid
kHours
3600 seconds
kMinutes
60 seconds
kSeconds
1 second
kMilliseconds
1/1000 of a second
kGames
15 frames per second
kFilm
24 frames per second
kPALFrame
25 frames per second
kNTSCFrame
30 frames per second
kShowScan
twice the speed of film (48 frames per second)
kPALField
twice the speed of PAL (50 frames per second)
kNTSCField
twice the speed of NTSC (60 frames per second)
k2FPS
2 frames per second
k3FPS
3 frames per second
k4FPS
4 frames per second
k5FPS
5 frames per second
k6FPS
6 frames per second
k8FPS
8 frames per second
k10FPS
10 frames per second
k12FPS
12 frames per second
k16FPS
16 frames per second
k20FPS
20 frames per second
k40FPS
40 frames per second
k75FPS
75 frames per second
k80FPS
80 frames per second
k100FPS
100 frames per second
k120FPS
120 frames per second
k125FPS
125 frames per second
k150FPS
150 frames per second
k200FPS
200 frames per second
k240FPS
240 frames per second
k250FPS
250 frames per second
k300FPS
300 frames per second
k375FPS
375 frames per second
k400FPS
400 frames per second
k500FPS
500 frames per second
k600FPS
600 frames per second
k750FPS
750 frames per second
k1200FPS
1200 frames per second
k1500FPS
1500 frames per second
k2000FPS
2000 frames per second
k3000FPS
3000 frames per second
k6000FPS
6000 frames per second
kUserDef
user defined units (not implemented yet)
kLast
MTime ()
MTime ( const MTime & )
MTime ( double time_val, Unit = kFilm )
~MTime ()
Unit unit () const
double value () const
MStatus setUnit ( Unit new_unit )
MStatus setValue ( double new_value )
double as ( Unit other_unit ) const
static Unit uiUnit ()
static MStatus setUIUnit ( Unit new_unit)
MTime & operator = ( const MTime & rhs )
bool operator == ( const MTime & rhs ) const
bool operator != ( const MTime & rhs ) const
bool operator <= ( const MTime & rhs ) const
bool operator >= ( const MTime & rhs ) const
bool operator < ( const MTime & rhs ) const
bool operator > ( const MTime & rhs ) const
MTime operator + ( const MTime & rhs ) const
MTime & operator += ( const MTime & rhs )
MTime operator + ( double rhs ) const
MTime & operator += ( double rhs )
MTime operator - ( const MTime & rhs ) const
MTime & operator -= ( const MTime & rhs )
MTime operator - ( double rhs ) const
MTime & operator -= ( double rhs )
MTime operator * ( double rhs ) const
MTime & operator *= ( double rhs )
MTime operator / ( double rhs ) const
MTime & operator /= ( double rhs )
MTime & operator ++ ()
NO SCRIPT SUPPORT
MTime & operator ++ (int)
NO SCRIPT SUPPORT
MTime & operator -- ()
NO SCRIPT SUPPORT
MTime & operator -- (int)
NO SCRIPT SUPPORT
friend std::ostream& operator << ( std::ostream& os, const MTime & t )
NO SCRIPT SUPPORT

Documentation

Methods for setting and retreiving animation times in various unit systems.
Description

The MTime class provides a fundamental type for the Maya API to hold and manipulate animation timing information in various unit systems. All API methods that require or return timing information do so through variables of this type.

If one desires to manipulate time in such a way that integer changes in an MTime instance result in integer changes in the frame displayed by the timeslider, then an MTime instance should be created that uses UI units. This can be done either by using the default constructor, or by passing the return value of the static method uiUnit to the normal constructor. Once such an MTime instance is created, its value will be equivalent to a frame on the timeslider.

It should be noted that while the timeslider displays frames, a seemingly unitless value, Maya internally is operating based on the desired frameRate (one of those specified by the MTime::Unit enum. It is necessary for the API programmer to be aware of this as MTime instances are not unitless and allow the manipulation of time in any desired units.

Functions

MTime:: MTime ()
Description

Default class constructor. Sets the initial time to 1 (the first frame) in the UI units currently in effect.

MTime:: MTime (const MTime & src)

Description

Copy Constructor.

Arguments

  • src the instance to copy

MTime:: MTime (double newValue, MTime::Unit newUnit )

Description

Constructor that sets the current time to the given value in the given units. If the parameter, newUnit, is not specified, it defaults to kFilm (24 frames/second).

Arguments

  • newValue the initial time value, in the newUnit system
  • newUnit the unit system to be used in this instance

MTime:: ~MTime ()

Description

The class destructor.

MTime::Unit MTime:: unit () const

Description

Returns the current units in effect for this instance.

Return Value

  • an element of the MTime::Unit enum

double MTime:: value () const

Description

Returns the current time value in the units that are currently in effect for this instance.

Return Value

  • the current time value

MStatus MTime:: setUnit ( MTime::Unit newUnit )

Description

Set the current units in effect on this MTime instance. Note that this method only changes the current units in the instance, it does not affect the value. So, calls to the value method before and after a call to setUnit will return the same number, however, the interpretation of that number will be different due to the change in unit systems.

Arguments

  • newUnit an element of the MTime::Unit enum

Return Value

  • kSuccess if the given unit is valid, kInvalidParameter otherwise

MStatus MTime:: setValue ( double newValue )

Description

Set the current time value in the current units for this instance.

Arguments

  • newValue The new time value.

Return Value

  • kSuccess if the value is set successfully, kFailure otherwise

double MTime:: as ( MTime::Unit newUnit ) const

Description

Returns the current time value in the given units. This does not affect the current units for the instance.

Arguments

  • newUnit an element of the MTime::Unit enum

Return Value

  • the current time value in the given units

MTime::Unit MTime:: uiUnit ()

Description

Returns the Working Units (or UI units) chosen in the settings of the prefs window. Maya's timeslider displays frames in these units.

Return Value

  • an element of the MTime::Unit enum

MStatus MTime:: setUIUnit ( MTime::Unit newUnit )

Description

Set the unit system to be used by the user in the UI. After the successful completion of this method, Maya's timeslider will be displaying frames in the specified units.

Arguments

  • newUnit an element of the MTime::Unit enum

Return Value

  • kSuccess if the given unit is valid, kInvalidParameter otherwise

MTime & MTime:: operator= ( const MTime & rhs )
Description

Assignment operator.

bool MTime:: operator == ( const MTime & rhs ) const
Description

Equality operator.

bool MTime:: operator != ( const MTime & rhs ) const
Description

InEquality operator.

bool MTime:: operator <= ( const MTime & rhs ) const
Description

Less than or equal to operator.

bool MTime:: operator >= ( const MTime & rhs ) const
Description

Greater than or equal to operator.

bool MTime:: operator < ( const MTime & rhs ) const
Description

Less than operator.

bool MTime:: operator > ( const MTime & rhs ) const
Description

Greater than operator.

MTime MTime:: operator + ( const MTime & rhs ) const
Description

Addition operator. The units of the returned MTime instance are those of the left hand argument to the + operator.

MTime & MTime:: operator += ( const MTime & rhs )
Description

In place addition operator.

MTime MTime:: operator + ( double rhs ) const
Description

Addition operator by a double. The double is interpreted as a number of frames in the units of the MTime instance to the left of the + operator. Thus, to increase time by five frames in the current units, add 5 to the instance.

MTime & MTime:: operator += ( double rhs )
Description

In place addition operator by a double. The double is interpreted as a number of frames in the units of the MTime instance. Thus, to increase time by five frames in the current units, add 5 to the instance.

MTime & MTime:: operator ++ ()
Description

Prefix increment operator.

MTime & MTime:: operator ++ ( int )
Description

Postfix increment operator.

Arguments

  • int dummy argument to differentiate the prefix and postfix operators.

MTime MTime:: operator - ( const MTime & rhs ) const
Description

Subtraction operator. The units of the returned MTime instance are those of the left hand argument to the - operator.

MTime & MTime:: operator -= ( const MTime & rhs )
Description

In place subtraction operator.

MTime MTime:: operator - ( double rhs ) const
Description

Subtraction operator by a double. The double is interpreted as a number of frames in the units of the MTime instance to the left of the - operator. Thus, to decrease time by five frames in the current units, subtract 5 from the instance.

MTime & MTime:: operator -= ( double rhs )
Description

In place Subtraction operator by a double. The double is interpreted as a number of frames in the units of the MTime instance. Thus, to decrease time by five frames in the current units, subtract 5 from the instance.

MTime & MTime:: operator -- ()
Description

Prefix decrement operator.

MTime & MTime:: operator -- ( int )
Description

Postfix decrement operator.

Arguments

  • int dummy argument to differentiate the prefix and postfix operators.

MTime MTime:: operator * ( double rhs ) const
Description

Multiplication by a scalar operator. Multiply the instance to the left of the * operator by the given double, and assign the result to a new MTime instance.

Arguments

  • rhs the scalar to multiply by.

MTime & MTime:: operator *= ( double rhs )
Description

In place multiplication by a scalar operator. Multiply the current instance by the given double.

Arguments

  • rhs the scalar to multiply by.

MTime MTime:: operator / ( double rhs ) const
Description

Division by a scalar operator. Divide the instance to the left of the / operator by the given double, and assign the result to a new MTime instance.

Arguments

  • rhs the scalar to divide by.

MTime & MTime:: operator /= ( double rhs )
Description

In place division by a scalar operator. Divide the current instance by the given double.

Arguments

  • rhs the scalar to multiply by.

std::ostream& operator << (std::ostream& os, const MTime & t )

Description

Print the contents of the given MTime on the given ostream. Prints the result of a call to the value() method on the given MTime instance.

Arguments

  • os the ostream to print to
  • t the MTime whose value is to be printed

Return Value

  • the ostream reference, os, provided as the first parameter.

This class has no child classes.


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