Hello - I was wondering what how to properly have some form of inheritance for an extension.
For example, I am making my own record/playback tox’s. I will make one for chops and another for tops, and they have some overlap: the “savers” need to be able to prompt users to input a file name and path, increment that filename, etc… I could write individual extensions without having a shared module or inherited class but it seems like there’s a proper way to have them inherit from a base ‘saver’ class… I might be over thinking this here but how would you approach this in touch?
you’re certainly not overthinking, also in TouchDesigner inheritance is a very sound approach, and I use it often in my projects.
See for an example the documentation of the TDAbleton package in which you have to use inheritance to create new components. Here’s a link to the tutorial with a simple code example how to derive your extension from an existing class and inherit its methods&members.
Thank you! So in this case, the “TDAbletonCompBaseExt” is a base that has this extension, then you reference the extension object on the base to pass into your class to inherit from? Is this preferable over having your comp include two extensions, with one expecting the other to be present? For example, I have set up my ‘video recorder’ class to reference the owner comp’s other extension, which is another class that handles the basics of selecting files in the system.