IC Python API:RLPy REventHandler

From Reallusion Wiki!
Jump to: navigation, search

Main article: Modules. Last modified: 04/29/2020

Description

Inside iClone, events are responsible for communicating various types of status changes. For recieving different types of events, one would need to inherit from the REventCallback base class, and use RegisterCallback to register it. Then, one is able to execute relevant commands for the corresponding events, i.e. refreshing user interfaces, etc.

See Also: REventCallback

Member Functions

RegisterCallback ( pCallback )

Register an event callback and return an id which can be used when UnregisterCallback is called.

See Also: UnregisterCallback

Parameters

pCallback [IN] The callback event - REventCallback

Returns

The newly registered callback id - integer
1 class MyEventCallback(RLPy.REventCallback):
2    def __init__(self):
3        RLPy.REventCallback.__init__(self)
4    def OnObjectSelectionChanged(self):
5        print("OnObjectSelectionChanged")
6  
7 # register event
8 event_callback = MyEventCallback()
9 id = RLPy.REventHandler.RegisterCallback(event_callback)

UnregisterCallback ( uId )

Unregister a callback event by id. When successful, the EventCallback will be removed and the system will no longer receive the event. If the id can not be found, then return RLPy.RStatus.Failure.

See Also: UnregisterCallbacks

Parameters

uId [IN] Id - integer

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 class MyEventCallback(RLPy.REventCallback):
 2    def __init__(self):
 3        RLPy.REventCallback.__init__(self)
 4    def OnObjectSelectionChanged(self):
 5        print("OnObjectSelectionChanged")
 6  
 7 event_callback = MyEventCallback()
 8 id = RLPy.REventHandler.RegisterCallback(event_callback)
 9 # do something
10 status = RLPy.REventHandler.UnregisterCallback(id)

UnregisterCallbacks ( kIds )

Unregister several callback events at once. If an id in the list can not be found, then return RLPy.RStatus.Failure.

See Also: UnregisterCallback

Parameters

kIds [IN] Event callback ids - List

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 class MyEventCallback(RLPy.REventCallback):
 2    def __init__(self):
 3        RLPy.REventCallback.__init__(self)
 4    def OnObjectSelectionChanged(self):
 5        print("OnObjectSelectionChanged")
 6  
 7 event_callback = MyEventCallback()
 8 id = RLPy.REventHandler.RegisterCallback(event_callback)
 9 # do something
10 status = RLPy.REventHandler.UnregisterCallbacks([id])