IC Python API:RLPy RPyTimer

From Reallusion Wiki!
Revision as of 22:29, 4 July 2019 by Chuck (RL) (Talk | contribs)

Jump to: navigation, search
Main article: Modules.

Detailed Description

This class provides repetitive and single-shot timers.

class MyPyTimerCallback(RLPy.RPyTimerCallback):
 def __init__(self):
   RLPy.RPyTimerCallback.__init__(self)

 def Timeout(self):
   print ("timeout")

# set timer
timer = RLPy.RPyTimer()
timer.SetInterval(100)
timer.SetSingleShot(True)
print(timer.GetInterval()) # 100
# register callback
timer_callback = MyPyTimerCallback()
timer.RegisterPyTimerCallback(timer_callback)
# start timer
timer.Start()
...
# unregister callback
timer.UnregisterPyTimerCallback()

Member Functions

GetInterval

RLPy.RPyTimer.GetInterval ( self )

Get timer interval value.

Returns

Timer interval in milliseconds - int


IsRunning

RLPy.RPyTimer.IsRunning ( self )

Check if the timer is running.

Returns

True if the timer is running; otherwise returns false - bool


IsSingleShot

RLPy.RPyTimer.IsSingleShot ( self )

Get timer single shot status.

Returns

Is timer single shot or not - bool


RegisterPyTimerCallback

RLPy.RPyTimer.RegisterPyTimerCallback ( self, pCallback )

Register timer event callback.

Parameters

pCallback [IN] pointer of timer callback object - RLPy.RPyTimerCallback


SetInterval

RLPy.RPyTimer.SetInterval ( self, nMSec )

Set timer interval value.

Parameters

nMSec [IN] timer interval in milliseconds - int


SetSingleShot

RLPy.RPyTimer.SetSingleShot ( self, bSingleShot )

Set timer single shot status.

Parameters

bSingleShot [IN] timer single shot status - bool


Start

RLPy.RPyTimer.Start ( self )

Start the timer. Starts or restarts the timer. If the timer is already running, it will be stopped and restarted.


Stop

RLPy.RPyTimer.Stop ( self )

Stop the timer.


UnregisterPyTimerCallback

RLPy.RPyTimer.UnregisterPyTimerCallback ( self )

Unregister timer event callback.