IC Python API:RLPy RTime

From Reallusion Wiki!
Revision as of 21:14, 13 January 2019 by Chuck (RL) (Talk | contribs) (GetStatusCode)

Jump to: navigation, search
Main article: System Module.

Class in RLPy / Inherits from: _object

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 of GetFrameTime() can ensure that RTime is on the correct frame.

Member Functions

GetFrameIndex

def RLPy.RTime.GetFrameIndex(kTime, nFps)

Convert the current time to frame index. Since iClone is 60 frames per second, the return value is usually the time in seconds times 60.

The following example gives the frame index at the 3 second mark.

Code:
 
import RLPy

#create a time object of 3 seconds
time = RLPy.RTime(3000)

#print the frame index at the 3 second mark: 180
print(RLPy.RTime.GetFrameIndex(time, RLPy.RGlobal.GetFps()))

GetFrameTime

def RLPy.RTime.GetFrameTime(kTime,nFps)

Deduce the frame time from a time object.

The RTime object may not give a time that perfectly matches a frame. Call this function to get the closest frame time for a RTime object - not to be confused with frame index.

Code:
import RLPy

#Construct time object that does not align perfectly with a frame.
time = RLPy.RTime(3005)

#Derive the nearest frame time from the RTime object.
frame_time = RLPy.RTime.GetFrameTime(time, RLPy.RGlobal.GetFps())

#Print the frame time: 3000
print(frame_time.GetValue())      

IsError

def RLPY.RStatus.IsError(self)