IC Python API:RLPy RPyTimer
From Reallusion Wiki!
Revision as of 01:52, 26 March 2019 by Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} == Detailed Description == This class provides repetitive and single-shot timers. <syntaxhighlight lang="Python"> cl...")
- 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.