IC8 Python API:RLPy REventCallback

From Reallusion Wiki!
Jump to: navigation, search
Main article: iC8 Modules.
Last modified: 01/17/2023

Description

This class provides a way to monitor iClone events and register callbacks for system events. Once an instance is created, iClone trigger events can be recieved, i.e. playback status, file read status, object creation and deletion status, etc. REventCallback can not be created as a local variable, otherwise the application will crash. Errors in the callback function can also cause the application to crash without warning, therefore, one should consider using Python's try except for fool-proof implementation.

Class Methods

RLPy.REventCallback.OnAfterFileLoaded(self, nFileType)

Callback after the file is loadeded.

Parameters

nFileType[IN] file type - int
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnAfterFileLoaded(self, nFileType):
 5         print('File type:' + str(nFileType))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnAfterFileLoadedWithPath(self, nFileType, strFilePath)

Callback before the file is loaded.

Parameters

nFileType[IN] file type - int
pProjectName[IN] project name
1 # No example

RLPy.REventCallback.OnAPInitialized(self)

Callback after initialized main AP.

Experimental API

1 # No example

RLPy.REventCallback.OnBeforeLoadFile(self, nFileType)

Callback for before load file.

Parameters

nFileType[IN] file type - int
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnBeforeLoadFile(self, nFileType):
 5         print('File type:' + str(nFileType))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnBeforeLoadFileWithPath(self, nFileType, strFilePath)

Callback for before load file.

Parameters

nFileType[IN] file type - int
pProjectName[IN] project name
1 # No example

RLPy.REventCallback.OnBeforeSaveFile(self, nFileType, pProjectName)

Callback for before save file.

Parameters

nFileType[IN] file type - int
pProjectName[IN] project name - string
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnBeforeSaveFile(self, nFileType, strProjectName):
 5         print('File type:' + str(nFileType) + ', Project Name:' + str(pProjectName))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnCurrentTimeChanged(self, fTime)

Callback for current time changed.

Parameters

fTime[IN] current time - float
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnCurrentTimeChanged (self, fTime):
 5         print('Current time:' + str(fTime))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnDialogModeChanged(self, nDialogMode)

Callback for dialog mode changed.

Parameters

nDialogMode[IN] dialog mode - int
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnDialogModeChanged(self, nDialogMode):
 5         print('Dialog Mode Changed ~ ' + 'Dialog Mode:' + str(nDialogMode))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnFileLoaded(self, nFileType)

Callback for file loaded.

Parameters

nFileType[IN] file type - int
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnFileLoaded(self, nFileType):
 5         print('File type:' + str(nFileType))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnFileLoadedWithPath(self, nFileType, strFilePath)

Callback for before load file.

Parameters

nFileType[IN] file type - int
pProjectName[IN] project name
1 # No example

RLPy.REventCallback.OnFileSaved(self, nFileType, pProjectName)

Callback for file saved.

Parameters

nFileType[IN] file type - int
pProjectName[IN] project name - string
1 # No example

RLPy.REventCallback.OnHierarchyChanged(self)

Callback for hierarchy changed.

Experimental API

 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnHierarchyChanged(self):
 5         print('Hierarchy Changed')
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnObjectDataChangedWithType(self, nObjectChangeDataType)

Callback for object data changed with type.

Experimental API

Parameters

nObjectChangeDataType[IN] object change data type - int
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnObjectDataChangedWithType(self, nDataType):
 5         print('Object Data Changed:' + str(nDataType))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnOmniLiveChanged(self, bOn)

Callback after omni live session status changed.

Experimental API

1 # No example

RLPy.REventCallback.OnProjectDataChanged(self, nProjectDataType)

Callback for project data changed.

Parameters

nProjectDataType[IN] project data type - int
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnProjectDataChanged(self, nProjectDataType):
 5         print('Project Data type:' + str(nProjectDataType))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)

RLPy.REventCallback.OnSmartGalleryInitialized(self, bSuccess)

Callback after initialized Smart Gallery.

Experimental API

1 # No example

RLPy.REventCallback.OnTimerUpdated(self, fTime)

Callback for timer updated.

Parameters

fTime[IN] current time - float
 1 class REventCallbackSampleCode(RLPy.REventCallback):
 2     def __init__(self):
 3         RLPy.REventCallback.__init__(self)
 4     def OnTimerUpdated (self, fTime):
 5         print('Updated time:' + str(fTime))
 6 
 7 event_callback = None
 8 
 9 def run_script():
10     global event_callback
11     event_callback = REventCallbackSampleCode()
12     id = RLPy.REventHandler.RegisterCallback(event_callback)