#include <c4d_basetime.h>
Cinema 4D
uses a sophisticated system for specifying time values.
If only frame numbers were used, changing the frame rate would cause keys either to overlap or disappear.
If only float values (seconds) were used instead, there would be problems because of the limited data precision. For instance when using
30
fps the frame
29
=
29/30
could easily be misinterpreted as frame
28
.
BaseTime
internally stores the time values as exact fractions independent of the frame rate. For example frame
29
is stored as fraction with nominator
29
and denominator
30
.
The class always tries to keep the nominator and denominator as small as possible. Hence
15/
30
is
stored as
1/2
, so if using
30
fps
GetFrame()
would return
15
, but if using
24
fps it would return frame
12
.
私有成员函数 |
|
void | Reduce (void) |
Private Attributes |
|
Float | numerator |
Float | denominator |
Friends |
|
class | BaseFile |
class | AESFile |
Constructor/Destructor |
|
BaseTime () | |
BaseTime ( Float r) | |
BaseTime ( Float z, Float n) |
Numerator/Denominator |
|
Float | Get (void) const |
Float | GetNumerator (void) const |
Float | GetDenominator (void) const |
void | SetNumerator ( Float r) |
void | SetDenominator ( Float r) |
Frames |
|
Int32 | GetFrame ( Float fps) const |
void | Quantize ( Float fps) |
Math Operators |
|
const friend BaseTime | operator* (const BaseTime &t1, const BaseTime &t2) |
const friend BaseTime | operator/ (const BaseTime &t1, const BaseTime &t2) |
const friend BaseTime | operator+ (const BaseTime &t1, const BaseTime &t2) |
const friend BaseTime | operator- (const BaseTime &t1, const BaseTime &t2) |
Comparison Operators |
|
Bool | operator== (const BaseTime &t1, const BaseTime &t2) |
Bool | operator< (const BaseTime &t1, const BaseTime &t2) |
Bool | operator!= (const BaseTime &t1, const BaseTime &t2) |
Bool | operator<= (const BaseTime &t1, const BaseTime &t2) |
Bool | operator>= (const BaseTime &t1, const BaseTime &t2) |
Bool | operator> (const BaseTime &t1, const BaseTime &t2) |
杂项 |
|
Int32 | TimeDif (const BaseTime &t2) const |
BaseTime | ( | ) |
Default constructor.
|
explicit |
Initializes the internal time value from a float value in seconds.
Constructor will multiply the seconds by 1000.0 and store it as a fraction with
1000.0
as denominator; after this the fraction will be reduced to its lowest form.
[in] | r | The time in seconds. |
|
explicit |
Initializes the internal time value to the given fraction of z / n .
[in] | z | The nominator. |
[in] | n | The denominator. |
|
private |
Float Get | ( | void | ) | const |
Gets the time in seconds.
Float GetNumerator | ( | void | ) | const |
Gets the numerator part of the internally stored time.
Float GetDenominator | ( | void | ) | const |
Gets the denominator part of the internally stored time.
void SetNumerator | ( | Float | r | ) |
Sets the numerator part of the internally stored time.
[in] | r | The numerator. |
void SetDenominator | ( | Float | r | ) |
Sets the denominator part of the internally stored time.
[in] | r | The denominator. |
Int32 GetFrame | ( | Float | fps | ) | const |
Gets the number of frames equivalent to the time for the given number of Frames per Second.
[in] | fps | The Frames per Second to use to calculate the frame number for the time. |
void Quantize | ( | Float | fps | ) |
Quantizes the internally stored value so that it is a multiple of the given number of Frames per Second.
[in] | fps | The number of Frames per Second to make the time a multiple of. |
Int32 TimeDif | ( | const BaseTime & | t2 | ) | const |
Check which is the largest between the time and t2 .
[in] | t2 | The time to compare with. |
|
friend |
|
friend |
|
friend |
Multiplies t1 and t2 .
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Divides t1 and t2 .
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Adds t1 and t2 .
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Subtracts t1 and t2 .
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Equality operator. Checks if t1 and t2 are equal.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Less than operator. Checks if t1 is less than t2 .
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Inequality operator. Checks if t1 and t2 are not equal.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Less than or equal operator. Checks if t1 is less than or equal to t2 .
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Greater than or equal operator. Checks if t1 is greater than or equal to t2 .
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
friend |
Greater than operator. Checks if t1 大于 t2 .
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
private |
|
private |