Profile Picture

Class inheritance

Posted By RobertoColombo 11 Months Ago
Rated 5 stars based on 1 vote.
Author
Message
RobertoColombo
RobertoColombo
Posted 11 Months Ago
View Quick Profile
Distinguished Member

Distinguished Member (7.6K reputation)Distinguished Member (7.6K reputation)Distinguished Member (7.6K reputation)Distinguished Member (7.6K reputation)Distinguished Member (7.6K reputation)Distinguished Member (7.6K reputation)Distinguished Member (7.6K reputation)Distinguished Member (7.6K reputation)Distinguished Member (7.6K reputation)

Group: Forum Members
Last Active: Last Month
Posts: 1.6K, Visits: 3.0K
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

My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO / 
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the VB with an HDMI splitter) / DirectX: 12

Edited
11 Months Ago by RobertoColombo
AllenLee (RL)
AllenLee (RL)
Posted 11 Months Ago
View Quick Profile
Junior Member

Junior Member (111 reputation)Junior Member (111 reputation)Junior Member (111 reputation)Junior Member (111 reputation)Junior Member (111 reputation)Junior Member (111 reputation)Junior Member (111 reputation)Junior Member (111 reputation)Junior Member (111 reputation)

Group: Forum Members
Last Active: 2 days ago
Posts: 20, Visits: 239
Hi, 
All class whose names begin with "RI" cannot be inherited.
Edited
11 Months Ago by AllenLee (RL)



Reading This Topic