IC Python API:RLPy RIBase
From Reallusion Wiki!
Revision as of 22:40, 14 April 2020 by Chuck (RL) (Talk | contribs)
- Main article: Modules.
- Last modified: 04/14/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, RIBase provides IsValid to detect for scene objects' validity.
Inheritance
RIBase > RIClip | RIMaterialComponent | RIMaterialComponent | RINode | RISkeletonComponent | RIVisemeComponent RIBase > RIObject > RIAvatar | RICamera | RIParticle | RIProp RIBase > RIObject > RILight > RIDirectionalLight | RIPointLight | RISpotLight
Member Functions
IsValid ( self )
Check whether or not the scene object exists; If detection fails, return False.
Returns
- True if valid, else False - bool
1 avatar = None
2 event_callback = None
3
4 class REventCallbackSampleCode(RLPy.REventCallback):
5 def __init__(self):
6 RLPy.REventCallback.__init__(self)
7 def OnObjectDeleted(self):
8 global avatar
9 if not avatar.IsValid():
10 print ("The avatar has been deleted")
11
12 def run_script():
13 global avatar
14 global event_callback
15 avatar_list = RLPy.RScene.GetAvatars()
16 avatar = avatar_list[0]
17 event_callback = REventCallbackSampleCode()
18 id = RLPy.REventHandler.RegisterCallback(event_callback)