Creating Custom Classes
Richard Penney
Posts: 41
I'm sure there must be a way of creating custom classes, but I can't find an example anywhere. Let me show you what I need to do in order to get started.
The code below should construct two custom classes. The second is derived from the first.
// psudo code for a class constructorclass C_foo() : someDerived object{ var nVersion = 1.234; fuction getVersion() { return nVersion; }}// psudo code for a class constructorclass C_fooBar() : C_foo // derived from C_foo{ var sAuthor = "John Wayne"; fuction getAuthor() { return sAuthor; }}
I need to learn the correct syntax for creating class objects, and what they need to derive from.
Any help will be tremendously appreciated.
Comments
Try looking at the DS 3 scripting docs - there is soem discussion there http://docs.daz3d.com/doku.php/public/software/dazstudio/3/start
In my signaure you will find a link to the Scripting documentation. I would recommend reading the Summary section, followed by the Background section, followed by clicking the Identifiers link in the Language Reference section and reading the Reserved Words section on the linked page (noting specifically that "class" is reserved for future use), followed by clicking the Moving from QSA to Qt Script link down in the External Sources section and reading the The Scripting Language section on that page. This should provide you with the information you seek along with a brief glimpse into the history of the inevitable "why?" question that often follows.
-Rob
That reference in particular is Gold! Thank you Rob.
Here is the direct reference for convenience: https://doc.qt.io/archives/qt-4.8/porting-qsa.html
Thanks to everyone who responded. The help you gave me tonight allowed me to cook up this simple example of what I had in mind.
Now that we have defined this class, we can create another class derived from myScene, as shown below.
Once classes like these are fully implemented, you could save them to a script file and include it as a library module (see my previous thread on using Include statements).
I believe there are lots of opportunities for building wrapper classes around DS objects, encapsulating a lot of low-level operations and exposing simple-to-use interfaces.
Thanks for you help guys!