Class inheritance


https://forum.reallusion.com/Topic401133.aspx
Print Topic | Close Window

By RobertoColombo - 5 Years Ago
Hi,

I can create a sub-class (inherited) from RScene class but I can't do the same for RlProp and RlObject classes.
Code is as simple as the following:
import PySide2, RLPy
from PySide2 import *

def run_script():
    
    scene_obj = SceneClassChild()
    scene_obj.Print()
    
    props = scene_obj.GetProps()
    print(props)
    
    prop_obj = PropClassChild()
    prop_obj.Print()


class SceneClassChild(RLPy.RScene):

    def Print(self):
        print("I am a RScene class child")

class PropClassChild(RLPy.RlProp):

    def Print(self):
        print("I am a RlProp class child")



Error message is: 

<class 'AttributeError'>, File: E:/WorkingArea/iClone/PythonAPI/Test_iClone_Inheritance.py, Line: A
<class 'NameError'>, File: E:/WorkingArea/iClone/PythonAPI/Test_iClone_Inheritance.py, Line: B


Line A is: class PropClassChild(RLPy.RlProp):
Line B is: prop_obj = PropClassChild()

Note that "props = scene_obj.GetProps()" works fine, which means the Scene child class is ok.
Any hints about how to sub-class RlObject and RlProp ?

Thanks

  Roberto
By AllenLee (RL) - 5 Years Ago
Hi, 
All class whose names begin with "RI" cannot be inherited.