IC8 Python API:RLPy REventCallback

From Reallusion Wiki!
Jump to: navigation, search

Contents

Main article: iC8 Modules.
Last modified: 10/21/2026

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)

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.

Constructor & Destructor

__init__ (self)

Initializes a new event callback instance.

Member Functions

OnAPInitialized (self)

Callback after initialized main AP.

OnAPLayoutChanged (self)

Callback after layout changed.

OnAPLayoutRestored (self)

Callback after layout restored.

OnAfterFileLoaded (self, nFileType)

Trigger an event after iClone has finished reading an object from file and return the object's type.

Parameters

  • nFileType

OnAfterFileLoadedWithPath (self, nFileType, strFilePath)

Called after a file is loaded, with the loaded file path.

Parameters

  • nFileType
  • strFilePath

OnBeforeCloseAP (self)

Callback before closing AP.

OnBeforeLoadFile (self, nFileType)

Trigger an event before an object is read from file and return the object's type.

Parameters

  • nFileType

OnBeforeLoadFileWithPath (self, nFileType, strFilePath)

Callback for before load file.

Parameters

  • nFileType
  • strFilePath

OnBeforeSaveFile (self, nFileType, pProjectName)

Trigger an event right before iClone saves a file and return the file path.

Parameters

  • nFileType
  • pProjectName

OnCommandReceived (self, strCommand)

Called when the application receives a command.

Parameters

  • strCommand

OnContentBrowserSelected (self, kPaths)

Callback after selecting content in Content Browser dialog.

Parameters

  • kPaths

OnCurrentCameraChanged (self, nCameraState)

Callback when current camera changed.

Parameters

  • nCameraState

OnCurrentLibraryChanged (self)

Callback after current library changed.

OnCurrentTimeChanged (self, fTime)

Trigger an event everytime a change has been applied to the iClone timeline and return the current time. For example, updates are triggered when the timeline is stopped and while scrubbing the timeline, but playing the timeline does not.

Parameters

  • fTime

OnDialogModeChanged (self, nDialogMode)

Trigger an event when an iClone window related function is called and return the window's dialog mode (DialogModeType).

Parameters

  • nDialogMode

OnFileLoadFail (self, nFileType)

Callback for file load failed.

Parameters

  • nFileType

OnFileLoaded (self, nFileType)

Trigger an event when an object is read from file and return the object's type.

Parameters

  • nFileType

OnFileLoadedWithPath (self, nFileType, strFilePath)

Called when a file has been loaded and its type and path are available.

Parameters

  • nFileType
  • strFilePath

OnFileSaved (self, nFileType, pProjectName)

Trigger an event when iClone has succesfully saved a file and return the file path.

Parameters

  • nFileType
  • pProjectName

OnHierarchyChanged (self)

Trigger an event when receiving updates to the heirarchy data structure. Trigger actions include Attach, Detach, ConvertToTerrain, ConvertTerrainToProp, ReachEffector, MergeSubProps.

OnImageAsyncLoadAllDone (self)

Callback after all asynchronous loading of images is complete.

OnImageAsyncLoadStart (self)

Callback after starting asynchronous image loading.

OnInstallError (self, strContentId)

Callback after install error.

Parameters

  • strContentId

OnInstallFinished (self, strContentId)

Callback after install finished.

Parameters

  • strContentId

OnInstallProgress (self, strContentId, nPercentage)

Callback after install progress updated.

Parameters

  • strContentId
  • nPercentage

OnInstallStarted (self, strContentId)

Callback after install started.

Parameters

  • strContentId

OnLuaEvent (self, kParam)

Callback from Lua event.

Parameters

  • kParam

OnMemberLoginStatusChanged (self, bLogin)

Callback after MemberLoginStatus changed event.

Parameters

  • bLogin

OnObjectAboutToBeDeleted (self)

Callback for object about to be deleted.

OnObjectAdded (self)

Trigger an event when an iClone object is added to the scene. Currently triggers on the creation of Lights, Cameras, Paths, and duplication of any type of object.

OnObjectDataChanged (self)

Trigger an event when an iClone object data has changed (ObjectChangedDataType).

OnObjectDataChangedWithType (self, nObjectChangeDataType)

Trigger an event when receiving data updates on iClone objects and retrieve the object type.

Parameters

  • nObjectChangeDataType

OnObjectDeleted (self)

Trigger an event when an iClone object is deleted.

OnObjectSelectionChanged (self)

Trigger an event when an iClone object is selection.

OnOmniLiveChanged (self, bOn)

Callback after omni live session status changed.

Parameters

  • bOn

OnPickedGeometryChanged (self)

Callback after picked geometry notification in any primitive selection mode. No mesh or indices are provided. Query the current selection in this callback.

OnPlayed (self)

Trigger an event when the iClone timeline begins playing.

OnProjectDataChanged (self, nProjectDataType)

Trigger an event when the iClone project's settings change and return the settings type.

Parameters

  • nProjectDataType

OnQuickMagicWebSocketNotified (self, strMessageData)

Callback from Backend Websocket to QuickMagic event.

Parameters

  • strMessageData

OnRefreshAccountPoints (self, nAllPoints, nAvailablePoints, nAIPoints, nBonusPoint, nDAPoints, nAILevel)

Callback after RefreshAccountPoints event.

Parameters

  • nAllPoints
  • nAvailablePoints
  • nAIPoints
  • nBonusPoint
  • nDAPoints
  • nAILevel

OnRefreshDAPoints (self, nAllPoints)

Callback after RefreshDAPoints event.

Parameters

  • nAllPoints

OnSceneUpdated (self, fTime)

Callback for Scene updated.

Parameters

  • fTime

OnServiceWebSocketNotified (self, nServiceType, strMessageData)

Callback from Backend Websocket to Service based event.

Parameters

  • nServiceType
  • strMessageData

OnSmartGalleryInitialized (self, bSuccess)

Callback after initialized Smart Gallery.

Parameters

  • bSuccess

OnStopped (self)

Trigger an event when the iClone timeline has stopped playing, also works with pausing.

OnTimerUpdated (self, fTime)

Trigger events while the iClone timeline plays back and return the current time during playback.

Parameters

  • fTime

OnUndoRedoDone (self)

Trigger an event when an iClone undo or redo action is executed.

OnUninstallFinished (self, strContentId)

Callback after uninstall finished.

Parameters

  • strContentId

OnUninstallProgress (self, strContentId, nPercentage)

Callback after uninstall progress updated.

Parameters

  • strContentId
  • nPercentage

OnUninstallStarted (self, strContentId)

Callback after uninstall started.

Parameters

  • strContentId

OnUpdateDAPoints (self)

Callback after UpdateDAPoints event.

Properties

thisown

Indicates whether this SWIG proxy owns the underlying C++ object.