c4d.BaseTime

class c4d.BaseTime

A BaseTime represents a time value within Cinema 4d.

Here is an example how to use a BaseTime object.

import c4d

bc1 = c4d.BaseTime(5, 10) # reduced to 1/2
bc2 = c4d.BaseTime(5)     # 5/1
bc3 = bc1 / bc2
doc.SetTime(bc3)

See also

BaseTime Manual.

Methods Signatures

BaseTime.__init__()

Initializes the internal time value from a real value in seconds.

BaseTime.__cmp__()

Compare two times with each other.

BaseTime.__eq__()

Check if two different BaseTime represents the same time.

BaseTime.__ne__()

Check if two different BaseTime don’t represents the same time.

BaseTime.__ge__()

Check if the passed BaseTime is greater or equal than self.

BaseTime.__gt__()

Check if the passed BaseTime is greater than self.

BaseTime.__le__()

Check if the passed BaseTime is lesser or equal than self.

BaseTime.__lt__()

Check if the passed BaseTime is lesser than self.

BaseTime.__add__()

Add two times and return the result.

BaseTime.__sub__()

Subtract two times and return the result.

BaseTime.__mul__()

Multiply two times and return the result.

BaseTime.__div__()

Divide two times and return the result.

BaseTime.GetFrame()

Get the number of frames equivalent to this time for the given number of frames per second.

BaseTime.Quantize()

Quantize the internal value so that it is a multiple of the specified framerate.

BaseTime.SetNumerator()

Set the numerator part of the internally stored time.

BaseTime.GetNumerator()

Get the numerator part of the internally stored time.

BaseTime.SetDenominator()

Get the denominator part of the internally stored time.

BaseTime.GetDenominator()

Get the denominator part of the internally stored time.

BaseTime.Get()

Return the time in seconds.

BaseTime.TimeDif()

Check which is the largest between the time and t2.

Methods Documentation

BaseTime.__init__(self, z=0.0, n=0.0)
Initializes the internal time value from a real value in seconds.
This will multiply the seconds by 1000.0 and store it as a fraction with the denominator at 1000.0.
Parameters
  • z (int) – Optional time in seconds.

  • n (Union[bool, int]) – If n is False, disable the automatic fraction-reduction and if int, set the denominator.

BaseTime.__cmp__(self, other)

Compare two times with each other.

Parameters

other (c4d.BaseTime) – The time value to compare with.

BaseTime.__eq__(self, other)

Check if two different BaseTime represents the same time.

Parameters

other (c4d.BaseTime) – The time value to compare with.

Return type

bool

Returns

True if the BaseTime are similar, otherwise False.

BaseTime.__ne__(self, other)

Check if two different BaseTime don’t represents the same time.

Return type

bool

Returns

True if the BaseTime don’t represent the same time, otherwise False.

BaseTime.__ge__(self, other)

Check if the passed BaseTime is greater or equal than self.

Parameters

other (c4d.BaseTime) – The other BaseTime.

Return type

bool

Returns

True if other BaseTime is greater or equal than self

BaseTime.__gt__(self, other)

Check if the passed BaseTime is greater than self.

Parameters

other (c4d.BaseTime) – The other BaseTime.

Return type

bool

Returns

True if other BaseTime is greater than self

BaseTime.__le__(self, other)

Check if the passed BaseTime is lesser or equal than self.

Parameters

other (c4d.BaseTime) – The other BaseTime.

Return type

bool

Returns

True if other BaseTime is lesser or equal than self

BaseTime.__lt__(self, other)

Check if the passed BaseTime is lesser than self.

Parameters

other (c4d.BaseTime) – The other BaseTime.

Return type

bool

Returns

True if other BaseTime is lesser than self

BaseTime.__add__(self, other)

Add two times and return the result.

Parameters

other (c4d.BaseTime) – The other value.

Return type

c4d.BaseTime

Returns

The result.

BaseTime.__sub__(self, other)

Subtract two times and return the result.

Parameters

other (c4d.BaseTime) – The other value.

Return type

c4d.BaseTime

Returns

The result.

BaseTime.__mul__(self, other)

Multiply two times and return the result.

Parameters

other (c4d.BaseTime) – The other value.

Return type

c4d.BaseTime

Returns

The result.

BaseTime.__div__(self, other)

Divide two times and return the result.

Parameters

other (c4d.BaseTime) – The other value.

Return type

c4d.BaseTime

Returns

The result.

BaseTime.GetFrame(self, fps)

Get the number of frames equivalent to this time for the given number of frames per second.

Parameters

fps (int) – The number of frames for this time.

Return type

int

Returns

The frames per second to use to calculate the frame number for this time.

BaseTime.Quantize(self, fps)

Quantize the internal value so that it is a multiple of the specified framerate.

Parameters

fps (number) – The number of frames per second to make this time a multiple of.

BaseTime.SetNumerator(self, r)

Set the numerator part of the internally stored time.

Parameters

r (number) – The numerator.

BaseTime.GetNumerator(self)

Get the numerator part of the internally stored time.

Return type

float

Returns

The numerator.

BaseTime.SetDenominator(self, r)

Get the denominator part of the internally stored time.

Parameters

r (number) – The denominator.

BaseTime.GetDenominator(self)

Get the denominator part of the internally stored time.

Return type

float

Returns

The denominator

BaseTime.Get(self)

Return the time in seconds.

Return type

float

Returns

Time in seconds.

BaseTime.TimeDif(self, t2)

Check which is the largest between the time and t2.

Parameters

t2 (c4d.BaseTime) – The time to compare with.

Return type

int

Returns

-1 if the time is < t2, 0 if they are equal and 1 if the time is > t2.