Profile Picture

Class inheritance

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

Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)Distinguished Member (10.2K reputation)

Group: Forum Members
Last Active: 3 Years Ago
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 + 1x2TB Samsung
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12

Edited
5 Years Ago by RobertoColombo
AllenLee (RL)
AllenLee (RL)
Posted 5 Years Ago
View Quick Profile
Senior Member

Senior Member (343 reputation)Senior Member (343 reputation)Senior Member (343 reputation)Senior Member (343 reputation)Senior Member (343 reputation)Senior Member (343 reputation)Senior Member (343 reputation)Senior Member (343 reputation)Senior Member (343 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 54, Visits: 526
Hi, 
All class whose names begin with "RI" cannot be inherited.
Edited
5 Years Ago by AllenLee (RL)



Reading This Topic