IC Python API:RLPy RTime
- Main article: Modules.
Detailed Description
This class is used to hold and manipulate timing information. Time is stored internally in system as milliseconds. Most API methods that require or return timing information do so through variables of
this type. This class also provide methods to convert between Frame and RTime, such as GetFrameIndex() and IndexedFrameTime(). Use GetFrameTime() can ensure that RTime is on the correct frame.time = RLPy.RGlobal.GetTime()
# compare time
if time == RLPy.RGlobal.SetTime(RLPy.RTime(1000)):
print("equal")
else if time > RLPy.RGlobal.SetTime(RLPy.RTime(1000)):
print("greater")
else if time < RLPy.RGlobal.SetTime(RLPy.RTime(1000)):
print("less")
# operator
time += RLPy.RTime(1000)
time -= RLPy.RTime(1000)
time *= 2
time /= 2
# convert between Frame
time = RLPy.RTime(3000)
print(RLPy.RTime.GetFrameIndex(time, RLPy.RGlobal.GetFps())) # 180
time = RLPy.RTime.IndexedFrameTime(180, RLPy.RGlobal.GetFps())
print(time.GetValue()) # 3000
time = RLPy.RTime(3005)
frame_time = RLPy.RTime.GetFrameTime(time, RLPy.RGlobal.GetFps())
print(frame_time.GetValue()) # 3000
Constructor & Destructors
__init__
RLPy.RTime.__init__ ( self, args )
Constructor, Initialize a new RTime object with a float value and an unit.
Parameters
fValue [IN] a float value representing a time - float
eUnit [IN] a time unit - RLPy.Unit
- RLPy.kInvalid
- RLPy.kHours not support
- RLPy.kMinutes not support
- RLPy.kSeconds not support
- RLPy.kMilliseconds 1/1000 of a second
- RLPy.k30FPS not support
- RLPy.k60FPS 60 frames per second
- RLPy.kUserDef not support
Member Functions
AsUnits
RLPy.RTime.AsUnits ( self, eUnit )
Returns the current time value in the given units. This does not affect the current units for the instance.
Parameters
eUnit [IN] a time unit - RLPy.Unit
- RLPy.kInvalid
- RLPy.kHours not support
- RLPy.kMinutes not support
- RLPy.kSeconds not support
- RLPy.kMilliseconds 1/1000 of a second
- RLPy.k30FPS not support
- RLPy.k60FPS 60 frames per second
- RLPy.kUserDef not support
Returns
GetFrameIndex
RLPy.RTime.GetFrameIndex ( kTime, nFps )
Get frame index from frame time.
Parameters
kTime [IN] the time for this frame - RLPy.RTime
nFps [IN] frames per second - int
Returns
GetFrameTime
RLPy.RTime.GetFrameTime ( kTime, nFps )
Get frame time from a time. The time of a RTime object may not located exactly on a frame. Call this function to get the closest frame time for this RTime object.
Parameters
kTime [IN] the time in an animation - RLPy.RTime
nFps [IN] frames per second - int
Returns
GetUnit
RLPy.RTime.GetUnit ( self )
Get the unit of this RTime object.
Returns
- RLPy.kInvalid
- RLPy.kHours not support
- RLPy.kMinutes not support
- RLPy.kSeconds not support
- RLPy.kMilliseconds 1/1000 of a second
- RLPy.k30FPS not support
- RLPy.k60FPS 60 frames per second
- RLPy.kUserDef not support
GetValue
RLPy.RTime.GetValue ( self )
Get the float value of this RTime object.
Returns
IndexedFrameTime
RLPy.RTime.IndexedFrameTime ( nFrameIndex, nFps )
Get frame time from frame index.
Parameters
nFrameIndex [IN] the frame index for this frame time - int
nFps [IN] frames per second - int
Returns
SetUnit
RLPy.RTime.SetUnit ( self, eUnit )
Set time unit.
Parameters
eUnit [IN] a time unit - RLPy.Unit
- RLPy.kInvalid
- RLPy.kHours not support
- RLPy.kMinutes not support
- RLPy.kSeconds not support
- RLPy.kMilliseconds 1/1000 of a second
- RLPy.k30FPS not support
- RLPy.k60FPS 60 frames per second
- RLPy.kUserDef not support
SetValue
RLPy.RTime.SetValue ( self, fValue )
Set the float value of a time.
Parameters
fValue [IN] a float value of a time - float