FbxTime Class Reference
 
 
 
FbxTime Class Reference

#include <fbxtime.h>


Class Description

Class to encapsulate time units.

FbxTime can measure time in hour, minute, second, frame, field, residual and also combination of these units. It is recommended to use FbxTime for all time related operations. For example, currently it is used in FbxGlobalSettings, FbxGlobalTimeSettings, FbxCache, all curve filters and all animation-related classes, etc. FbxTime is just used to represent a moment, to represent a period of time, FbxTimeSpan should be used.

See also:
FbxTimeSpan
Examples:

Animation/main.cxx, ExportScene01/main.cxx, ExportScene02/main.cxx, ExportScene03/main.cxx, ExportScene04/main.cxx, ImportScene/DisplayAnimation.cxx, ImportScene/DisplayGlobalSettings.cxx, Instances/main.cxx, Pivot/main.cxx, UI_Examples/CubeCreator/SDK_Utility.cxx, UserProperties/main.cxx, ViewScene/DrawScene.cxx, ViewScene/DrawScene.h, ViewScene/GetPosition.cxx, ViewScene/GetPosition.h, ViewScene/SceneCache.cxx, ViewScene/SceneCache.h, ViewScene/SceneContext.cxx, ViewScene/SceneContext.h, ViewScene/SetCamera.cxx, and ViewScene/SetCamera.h.

Definition at line 41 of file fbxtime.h.

List of all members.

Public Member Functions

  FbxTime (const FbxLongLong pTime=0)
  Long long constructor.

Static Public Member Functions

static FbxLongLong  GetOneFrameValue (EMode pTimeMode=eDefaultMode)
  One frame value for a specified time mode.

Time Modes and Protocols

enum   EMode {
  eDefaultMode, eFrames120, eFrames100, eFrames60,
  eFrames50, eFrames48, eFrames30, eFrames30Drop,
  eNTSCDropFrame, eNTSCFullFrame, ePAL, eFrames24,
  eFrames1000, eFilmFullFrame, eCustom, eFrames96,
  eFrames72, eFrames59dot94, eModesCount
}
  Time modes. More...
enum   EProtocol { eSMPTE, eFrameCount, eDefaultProtocol }
  Time protocols enumaration. More...
static void  SetGlobalTimeMode (EMode pTimeMode, double pFrameRate=0.0)
  Set default time mode.
static EMode  GetGlobalTimeMode ()
  Get default time mode.
static void  SetGlobalTimeProtocol (EProtocol pTimeProtocol)
  Set default time protocol.
static EProtocol  GetGlobalTimeProtocol ()
  Get default time protocol.
static double  GetFrameRate (EMode pTimeMode)
  Get frame rate associated with time mode, in frames per second.
static EMode  ConvertFrameRateToTimeMode (double pFrameRate, double pPrecision=0.00000001)
  Get time mode associated with frame rate.

Time Conversion

void  Set (FbxLongLong pTime)
  Set time in internal format.
FbxLongLong  Get () const
  Get time in internal format.
void  SetMilliSeconds (FbxLongLong pMilliSeconds)
  Set time in milliseconds.
FbxLongLong  GetMilliSeconds () const
  Get time in milliseconds.
void  SetSecondDouble (double pTime)
  Set time in seconds.
double  GetSecondDouble () const
  Get time in seconds.
void  SetTime (int pHour, int pMinute, int pSecond, int pFrame=0, int pField=0, EMode pTimeMode=eDefaultMode)
  Set time in hour/minute/second/frame/field format.
void  SetTime (int pHour, int pMinute, int pSecond, int pFrame, int pField, int pResidual, EMode pTimeMode)
  Set time in hour/minute/second/frame/field/residual format.
bool  GetTime (int &pHour, int &pMinute, int &pSecond, int &pFrame, int &pField, int &pResidual, EMode pTimeMode=eDefaultMode) const
  Get time in hour/minute/second/frame/field/residual format.
FbxTime  GetFramedTime (bool pRound=true)
  Snaps a time value to the time value associated with the nearest frame.
void  SetFrame (FbxLongLong pFrames, EMode pTimeMode=eDefaultMode)
  Set time in frame format.
int  GetHourCount () const
  Get number of hours in time.
int  GetMinuteCount () const
  Get number of minutes in time.
int  GetSecondCount () const
  Get number of seconds in time.
FbxLongLong  GetFrameCount (EMode pTimeMode=eDefaultMode) const
  Get number of frames in time.
FbxLongLong  GetFieldCount (EMode pTimeMode=eDefaultMode) const
  Get number of fields in time.
int  GetResidual (EMode pTimeMode=eDefaultMode) const
  Get residual time exceeding last full field.
char  GetFrameSeparator (EMode pTimeMode=eDefaultMode) const
  Separator char between second and frame.
FBX_DEPRECATED char *  GetTimeString (char *pTimeString, int pInfo=5, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol) const
  Get time in a human readable format.
char *  GetTimeString (char *pTimeString, const FbxUShort &pTimeStringSize, int pInfo=5, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol) const
  Get time in a human readable format.
bool  SetTimeString (const char *pTime, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol)
  Set time in a human readable format.
static bool  IsDropFrame (EMode pTimeMode=eDefaultMode)
  Test for Drop Frame mode.

Time Operators

bool  operator== (const FbxTime &pTime) const
  Equality operator.
bool  operator!= (const FbxTime &pTime) const
  Inequality operator.
bool  operator>= (const FbxTime &pTime) const
  Superior or equal to operator.
bool  operator<= (const FbxTime &pTime) const
  Inferior or equal to operator.
bool  operator> (const FbxTime &pTime) const
  Superior to operator.
bool  operator< (const FbxTime &pTime) const
  Inferior to operator.
FbxTime operator= (const FbxTime &pTime)
  Assignment operator.
FbxTime operator+= (const FbxTime &pTime)
  Addition operator.
FbxTime operator-= (const FbxTime &pTime)
  Subtraction operator.
FbxTime  operator+ (const FbxTime &pTime) const
  Addition operator.
FbxTime  operator- (const FbxTime &pTime) const
  Subtraction operator.
FbxTime  operator* (const int Mult) const
  Multiplication operator.
FbxTime  operator/ (const FbxTime &pTime) const
  Division operator.
FbxTime  operator* (const FbxTime &pTime) const
  Multiplication operator.

Member Enumeration Documentation

enum EMode

Time modes.

Remarks:
EMode eNTSCDropFrame is used for broadcasting operations where clock time must be (almost) in sync with time code. To bring back color NTSC time code with clock time, this mode drops 2 frames per minute except for every 10 minutes (00, 10, 20, 30, 40, 50). 108 frames are dropped per hour. Over 24 hours the error is 2 frames and 1/4 of a frame. A time-code of 01:00:03:18 equals a clock time of 01:00:00:00
EMode eNTSCFullFrame represents a time address and therefore is NOT IN SYNC with clock time. A time code of 01:00:00:00 equals a clock time of 01:00:03:18.
  • eDefaultMode
  • eFrames120 120 frames/s
  • eFrames100 100 frames/s
  • eFrames60 60 frames/s
  • eFrames50 50 frames/s
  • eFrames48 48 frame/s
  • eFrames30 30 frames/s (black and white NTSC)
  • eFrames30Drop 30 frames/s (use when display in frame is selected, equivalent to NTSC drop)
  • eNTSCDropFrame ~29.97 frames/s drop color NTSC
  • eNTSCFullFrame ~29.97 frames/s color NTSC
  • ePAL 25 frames/s PAL/SECAM
  • eFrames24 24 frames/s Film/Cinema
  • eFrames1000 1000 milli/s (use for date time)
  • eFilmFullFrame ~23.976 frames/s
  • eCustom Custom frame rate value
  • eFrames96 96 frames/s
  • eFrames72 72 frames/s
  • eFrames59dot94 ~59.94 frames/s
  • eModesCount Number of time modes
Enumerator:
eDefaultMode 
eFrames120 
eFrames100 
eFrames60 
eFrames50 
eFrames48 
eFrames30 
eFrames30Drop 
eNTSCDropFrame 
eNTSCFullFrame 
ePAL 
eFrames24 
eFrames1000 
eFilmFullFrame 
eCustom 
eFrames96 
eFrames72 
eFrames59dot94 
eModesCount 

Definition at line 87 of file fbxtime.h.

enum EProtocol

Time protocols enumaration.

  • eSMPTE SMPTE EProtocol
  • eFrameCount Frame count
  • eDefaultProtocol Default protocol (initialized to eFRAMES)
Enumerator:
eSMPTE 
eFrameCount 
eDefaultProtocol 

Definition at line 115 of file fbxtime.h.


Constructor & Destructor Documentation

FbxTime ( const FbxLongLong  pTime = 0 ) [inline]

Long long constructor.

Parameters:
pTime Initial value defined as a 64bit integer.

Definition at line 47 of file fbxtime.h.

{ mTime = pTime; }

Member Function Documentation

static void SetGlobalTimeMode ( EMode  pTimeMode,
double  pFrameRate = 0.0 
) [static]

Set default time mode.

Parameters:
pTimeMode Time mode identifier.
pFrameRate Custom framerate, only have effect in case of pTimeMode = FbxTime::eCustom
Remarks:
It is meaningless to set default time mode to eDefaultMode.
static EMode GetGlobalTimeMode ( ) [static]

Get default time mode.

Returns:
Currently set time mode identifier.
Remarks:
Default time mode initial value is eFrames30.
static void SetGlobalTimeProtocol ( EProtocol  pTimeProtocol ) [static]

Set default time protocol.

Parameters:
pTimeProtocol Time protocol identifier.
Remarks:
It is meaningless to set default time protocol to eDefaultProtocol.
static EProtocol GetGlobalTimeProtocol ( ) [static]

Get default time protocol.

Returns:
Currently set time protocol identifier.
Remarks:
Default time protocol initial value is eSMPTE.
static double GetFrameRate ( EMode  pTimeMode ) [static]

Get frame rate associated with time mode, in frames per second.

Parameters:
pTimeMode Time mode identifier.
Returns:
Frame rate value.
Examples:
ExportScene03/main.cxx, and ViewScene/SceneContext.cxx.
static EMode ConvertFrameRateToTimeMode ( double  pFrameRate,
double  pPrecision = 0.00000001 
) [static]

Get time mode associated with frame rate.

Parameters:
pFrameRate The frame rate value.
lPrecision The tolerance value.
Returns:
The corresponding time mode identifier or eDefaultMode if no time mode associated to the given frame rate is found.
void Set ( FbxLongLong  pTime ) [inline]

Set time in internal format.

Parameters:
pTime Time value to set.

Definition at line 164 of file fbxtime.h.

{ mTime = pTime; }
FbxLongLong Get ( ) const [inline]

Get time in internal format.

Returns:
Time value.
Examples:
ExportScene03/main.cxx.

Definition at line 169 of file fbxtime.h.

{ return mTime; }
void SetMilliSeconds ( FbxLongLong  pMilliSeconds ) [inline]

Set time in milliseconds.

Parameters:
pMilliSeconds Time value to set.

Definition at line 174 of file fbxtime.h.

{ mTime = pMilliSeconds * FBXSDK_TC_MILLISECOND; }
FbxLongLong GetMilliSeconds ( ) const [inline]

Get time in milliseconds.

Returns:
Time value.

Definition at line 179 of file fbxtime.h.

{ return mTime / FBXSDK_TC_MILLISECOND; }
double GetSecondDouble ( ) const

Get time in seconds.

Returns:
Time value.
Examples:
ExportScene03/main.cxx.
void SetTime ( int  pHour,
int  pMinute,
int  pSecond,
int  pFrame = 0,
int  pField = 0,
EMode  pTimeMode = eDefaultMode 
)

Set time in hour/minute/second/frame/field format.

Parameters:
pHour The hours value.
pMinute The minutes value.
pSecond The seconds value.
pFrame The frames values.
pField The field value.
pTimeMode Time mode identifier.
Remarks:
Parameters pHour, pMinute, pSecond, pFrame and pField are summed together. For example, it is possible to set the time to 83 seconds in the following ways: SetTime(0,1,23) or SetTime(0,0,83).
Examples:
ExportScene03/main.cxx.
void SetTime ( int  pHour,
int  pMinute,
int  pSecond,
int  pFrame,
int  pField,
int  pResidual,
EMode  pTimeMode 
)

Set time in hour/minute/second/frame/field/residual format.

Parameters:
pHour The hours value.
pMinute The minutes value.
pSecond The seconds value.
pFrame The frames values.
pField The field value.
pResidual The hundredths of frame value.
pTimeMode Time mode identifier.
Remarks:
Parameters pHour, pMinute, pSecond, pFrame, pField and pResidual are summed together, just like above. pResidual represents hundredths of frame, and won't necessarily correspond to an exact internal value.
The time mode can't have a default value, because otherwise SetTime(int, int, int, int, int, int) would be ambiguous. Please specify DEFAULT_MODE.
bool GetTime ( int &  pHour,
int &  pMinute,
int &  pSecond,
int &  pFrame,
int &  pField,
int &  pResidual,
EMode  pTimeMode = eDefaultMode 
) const

Get time in hour/minute/second/frame/field/residual format.

Parameters:
pHour The returned hours value.
pMinute The returned minutes value.
pSecond The returned seconds value.
pFrame The returned frames values.
pField The returned field value.
pResidual The returned hundredths of frame value.
pTimeMode The time mode identifier which will dictate the extraction algorithm.
Returns:
true if the pTimeMode parameter is a valid identifier and thus the extraction succeeded. If the function returns false, all the values are set to 0.
FbxTime GetFramedTime ( bool  pRound = true )

Snaps a time value to the time value associated with the nearest frame.

Parameters:
pRound If true the return value is rounded to the nearest integer.
Returns:
The snapped time value.
void SetFrame ( FbxLongLong  pFrames,
EMode  pTimeMode = eDefaultMode 
)

Set time in frame format.

Parameters:
pFrames The number of frames.
pTimeMode The time mode identifier which will dictate the extraction algorithm.
int GetHourCount ( ) const

Get number of hours in time.

Returns:
Hours value.
int GetMinuteCount ( ) const

Get number of minutes in time.

Returns:
Minutes value.
int GetSecondCount ( ) const

Get number of seconds in time.

Returns:
Seconds value.
FbxLongLong GetFrameCount ( EMode  pTimeMode = eDefaultMode ) const

Get number of frames in time.

frames exceeding last full second.

Parameters:
pTimeMode Time mode identifier.
Returns:
Frames values.
Examples:
ViewScene/DrawScene.cxx.
FbxLongLong GetFieldCount ( EMode  pTimeMode = eDefaultMode ) const

Get number of fields in time.

Parameters:
pTimeMode Time mode identifier.
Returns:
Fields value.
int GetResidual ( EMode  pTimeMode = eDefaultMode ) const

Get residual time exceeding last full field.

Parameters:
pTimeMode Time mode identifier.
Returns:
Residual value.
static bool IsDropFrame ( EMode  pTimeMode = eDefaultMode ) [static]

Test for Drop Frame mode.

Parameters:
pTimeMode Time mode identifier.
Returns:
True if the pTimeMode is a Drop Frame mode.
char GetFrameSeparator ( EMode  pTimeMode = eDefaultMode ) const

Separator char between second and frame.

Parameters:
pTimeMode Time mode identifier.
Returns:
';' is returned if pTimeMode is a DropFrame mode otherwise ':'.
FBX_DEPRECATED char* GetTimeString ( char *  pTimeString,
int  pInfo = 5,
EMode  pTimeMode = eDefaultMode,
EProtocol  pTimeFormat = eDefaultProtocol 
) const

Get time in a human readable format.

Parameters:
pTimeString An array large enough to contain a minimum of 19 characters.
pInfo The amount of information if time protocol is eSMPTE:
  • 1 means hours only
  • 2 means hours and minutes
  • 3 means hours, minutes and seconds
  • 4 means hours, minutes, seconds and frames
  • 5 means hours, minutes, seconds, frames and field
  • 6 means hours, minutes, seconds, frames, field and residual value
pTimeMode Requested time mode.
pTimeFormat Requested time protocol.
Returns:
pTimeString parameter filled with a time value or set to a empty string if parameter pInfo is not valid.
Remarks:
Until it gets removed, this function will simply call the secure version passing 50 in the /e pTimeStringSize.
Examples:
ImportScene/DisplayAnimation.cxx, and ImportScene/DisplayGlobalSettings.cxx.
char* GetTimeString ( char *  pTimeString,
const FbxUShort pTimeStringSize,
int  pInfo = 5,
EMode  pTimeMode = eDefaultMode,
EProtocol  pTimeFormat = eDefaultProtocol 
) const

Get time in a human readable format.

Parameters:
pTimeString An array large enough to contain a minimum of 19 characters.
pTimeStringSize Size of the pTimeString buffer used with secure functions.
pInfo The amount of information if time protocol is eSMPTE:
  • 1 means hours only
  • 2 means hours and minutes
  • 3 means hours, minutes and seconds
  • 4 means hours, minutes, seconds and frames
  • 5 means hours, minutes, seconds, frames and field
  • 6 means hours, minutes, seconds, frames, field and residual value
pTimeMode Requested time mode.
pTimeFormat Requested time protocol.
Returns:
pTimeString parameter filled with a time value or set to a empty string if parameter pInfo is not valid.
bool SetTimeString ( const char *  pTime,
EMode  pTimeMode = eDefaultMode,
EProtocol  pTimeFormat = eDefaultProtocol 
)

Set time in a human readable format.

Parameters:
pTime An array of a maximum of 18 characters. If time protocol is eSMPTE, pTimeString must be formatted this way: "[hours:]minutes[:seconds[.frames[.fields]]]". Hours, minutes, seconds, frames and fields are parsed as integers and brackets indicate optional parts. If time protocol is eFRAME, pTimeString must be formatted this way: "frames". Frames is parsed as a 64 bits integer.
pTimeMode Given time mode.
pTimeFormat Given time protocol.
Returns:
True if the set time string succeed, otherwise return false.
bool operator== ( const FbxTime pTime ) const [inline]

Equality operator.

Parameters:
pTime The FbxTime to be compared.
Returns:
true if equal, false otherwise.

Definition at line 351 of file fbxtime.h.

{ return mTime == pTime.mTime; }
bool operator!= ( const FbxTime pTime ) const [inline]

Inequality operator.

Parameters:
pTime The FbxTime to be compared.
Returns:
true if unequal, false otherwise.

Definition at line 357 of file fbxtime.h.

{ return mTime != pTime.mTime; }
bool operator>= ( const FbxTime pTime ) const [inline]

Superior or equal to operator.

Parameters:
pTime The FbxTime to be compared.
Returns:
true if this FbxTime is superior or equal to the passed FbxTime, false otherwise.

Definition at line 363 of file fbxtime.h.

{ return mTime >= pTime.mTime; }
bool operator<= ( const FbxTime pTime ) const [inline]

Inferior or equal to operator.

Parameters:
pTime The FbxTime to be compared.
Returns:
true if this FbxTime is inferior or equal to the passed FbxTime, false otherwise.

Definition at line 369 of file fbxtime.h.

{ return mTime <= pTime.mTime; }
bool operator> ( const FbxTime pTime ) const [inline]

Superior to operator.

Parameters:
pTime The FbxTime to be compared.
Returns:
true if this FbxTime is superior to the passed FbxTime, false otherwise.

Definition at line 375 of file fbxtime.h.

{ return mTime > pTime.mTime; }
bool operator< ( const FbxTime pTime ) const [inline]

Inferior to operator.

Parameters:
pTime The FbxTime to be compared.
Returns:
true if this FbxTime is inferior to the passed FbxTime, false otherwise.

Definition at line 381 of file fbxtime.h.

{ return mTime < pTime.mTime; } 
FbxTime& operator= ( const FbxTime pTime ) [inline]

Assignment operator.

Parameters:
pTime The FbxTime to be assigned.

Definition at line 386 of file fbxtime.h.

{ mTime = pTime.mTime; return *this; }
FbxTime& operator+= ( const FbxTime pTime ) [inline]

Addition operator.

Parameters:
pTime The FbxTime to be added.
Returns:
This FbxTime after addition.

Definition at line 392 of file fbxtime.h.

{ mTime += pTime.mTime; return *this; }
FbxTime& operator-= ( const FbxTime pTime ) [inline]

Subtraction operator.

Parameters:
pTime The FbxTime to be subtracted.
Returns:
This FbxTime after subtraction.

Definition at line 398 of file fbxtime.h.

{ mTime -= pTime.mTime; return *this; }
FbxTime operator+ ( const FbxTime pTime ) const

Addition operator.

Parameters:
pTime The FbxTime to be added.
Returns:
A temporary FbxTime after addition.
FbxTime operator- ( const FbxTime pTime ) const

Subtraction operator.

Parameters:
pTime The FbxTime to be subtracted.
Returns:
A temporary FbxTime after subtraction.
FbxTime operator* ( const int  Mult ) const

Multiplication operator.

Parameters:
Mult Multiply this FbxTime by int Mult.
Returns:
A temporary FbxTime after multiplication.
FbxTime operator/ ( const FbxTime pTime ) const

Division operator.

Parameters:
pTime Divide this FbxTime by pTime.
Returns:
A temporary FbxTime after division.
FbxTime operator* ( const FbxTime pTime ) const

Multiplication operator.

Parameters:
pTime Multiply this FbxTime by pTime.
Returns:
A temporary FbxTime after multiplication.
static FbxLongLong GetOneFrameValue ( EMode  pTimeMode = eDefaultMode ) [static]

One frame value for a specified time mode.

Parameters:
pTimeMode Time mode identifier.
Returns:
the time code of a one frame.

The documentation for this class was generated from the following file: