IC Python API:RLPy RIBase

From Reallusion Wiki!
Revision as of 22:58, 8 April 2020 by Chuck (RL) (Talk | contribs)

Jump to: navigation, search
Main article: Modules.
Last modified: 04/8/2020

Description

This is the base class for all scene objects such as RIAvatar, RIProp, RICamera, etc. Deployed objects might come across some points of operation failure during the course of one's work with the scene, i.e. deletion, undo/redo operations, file importation, etc. Therefore, RIBaseprovides IsValid to detect for scene objects' validity.

Member Functions

IsValid ( self )

Check whether or not the scene object exists; If detection fails, return False.

Returns

True if valid, else False - bool
avatar = None
event_callback = None

class REventCallbackSampleCode(RLPy.REventCallback):
    def __init__(self):
        RLPy.REventCallback.__init__(self)
    def OnObjectDeleted(self):
        global avatar
        if not avatar.IsValid():
            print ("The avatar has been deleted")

def run_script():
    global avatar
    global event_callback
    avatar_list = RLPy.RScene.GetAvatars()
    avatar = avatar_list[0] 
    event_callback = REventCallbackSampleCode()
    id = RLPy.REventHandler.RegisterCallback(event_callback)