how to create and manage dynamically created instances of co

Hello There! I’ve got a newbie question.

TL;DR
Looking for resources/information about using Touch Designer for creating rich and dynamic UI interfaces that are event- and data-driven, specifically; how to create and manage dynamically created instances of complex objects.

Longer version
I’m a software developer with a lot of experience with OpenFrameworks and Cinder and I work on a lot of UI-orientated projects, like touch-screen applications, which are usually connected to external databases. (example: vimeo.com/130469605)

I’m always looking for better/faster/nicer workflows, especially since some things are just so cumbersome to do in code.

I like TouchDesigner for its visual workflow and saw Matthew’s talk in Bologna, Italy a little while back, so I wanted to give TouchDesigner another shot. I tried before but always kinda struggle to translate a lot of concepts from my code-oriented mind into the TouchDesigner workflow, so this this time, before I get stuck again, I figured I’ll reach out to the forum, which also seems to be very much part of the touch designer workflow :wink:

Ok so much for background. What I’m mainly trying to get a grip on, is how to manager (complex) application state and use that to drive a visual user interface. TouchDesigner seems primarily oriented towards (live) visuals and most tutorials that I find that involve data, seem to be about getting that data as fast as possible into the GPU (for good reasons), which -so far- I fail to translate into my own purposes.

One concrete question for example is how do dynamically instantiate complex components? I assume I’d use a Container COMP that wraps around a piece of my application that I want to reproduce. But without knowing in advance when and how many instances of this container I will need on the screen, I can’t just prepare a comp and drop it somewhere in the node editor. Or can I? Maybe I’m thinking to much like a software developer here…

Any hints/tips or resources are welcome!
Cheers

Hey hey, Matthew here.

I’ve got a chunk of instancing examples up here that might be interesting to pull apart first:
github.com/raganmd/touchdesigne … g_examples

From there it’s a hop skip and a jump to start thinking about rendering picking (sorry that it’s an old one with some rough audio):
matthewragan.com/2015/03/29/thp … hdesigner/

That’s at least a place to get started. :slight_smile:

The Replicator COMP comes in handy here. Lets say for example you want to create a parameter window. You can make a bunch of ui items, buttons/sliders/fields etc and then have them set to be their own clone. You can then create a table DAT that is the definition of your panel and its values and have that copy the clones of those buttons into your new panel.

Be careful when creating UI components on the fly…big panels will cause hangs in the system when doing this. The replicator COMP has a parameter called “incremental update” which will stagger creation of panels so you don’t slow down the system.

In my own media server panel I actually dont use replicators but rather have a bunch of pre-made panels that are then “pointed” towards a particular row in a database. For my purposes I’ve found this more flexible. I just instantiate everything as a clone in the network with it’s own unique id. I then handle all the logic that the replicator would myself as it gives you slightly more power in some ways and makes it easier to manage state.

Ahhhh…

Re-reading I’m seeing that you’re not talking about GPU instances, but rather instances of objects.

TBH, some of this can be solved with GPU instances and render picking. Part of the trick is to think through how you want to handle your screen space vs operations vs your logic and state management.

You might think of your more complex state management bits as handled by CHOPs (which are really just arrays at their heart - and very fast for many computational processes), DATs, and Extensions. Python is a bit slower than CHOPs, but as long as you’re sparing about how it’s used, things tend to go without too much of a hiccup.

If you want lots of fast and dynamic objects created on the fly, instancing is usually the way to go - that combined with render picking gives you lots of information that you can feed back into your state management system.

If you have the patience, the Table COMP is actually a pretty great tool. A healthy part of the touch UI is built out of table components, and getting a mastery of them makes UI pieces a lot easier to think about.

To your question about components - clones are also worth looking into. They’re a kind of instance of an object. the TUIK UI library is all based on clones. Hidden from view is a master set of objects and every time you drag a TUIK element from the pallet into the network you’re creating a component, and making it a clone (instance) of one that’s already in a larger library hidden from view.

Drag and Drop scripts might also be very interesting to you in this regard as they let you do all sorts of the those kinds of operations:

matthewragan.com/2015/05/30/tou … p-scripts/

Does any of that help?

All of this helps, thanks so much for the feedback! And sorry for the slow response (kinda thought I’d get an email when I’d get a response and forgot to check the forum myself).

I went through the Image Selector/render picking tutorial which was very useful in general, though I ran into a wall when my Geometry started giving the error: “Instance texturing is not supported on this operating system”. Is this a mac issue, or because I’m using the non-commercial license? Anyway, I’ll continue that road on a windows machine at work some other time.

Replicators seem to do pretty close to what I need. Going through this tutorial: youtube.com/watch?v=KcHIkCZ5kPE
Currently I’m struggling with the panel CHOP and getting its rollover to work for the individual duplicator instances (right now there seems to be just one master rollover signal).

Still have to look into Clones, but all of this is looking good! Thanks again!

Instance texturing is likely a mac issue, it’s also an issue on older hardware. You can work around this issue by using a texture 3D (set to 2D array). It’s a slightly different work flow, but will get you the same results.

You might think of clone masters as your prototypical object, and clones as single instances of that object. Pars that you make clone immune will not inherit their properties form clone master anymore, but will be unique to that clone. They’re a pretty slick convention in Touch and well worth digging into.

Keep up the exploration, the more you use Touch the easier it becomes. :slight_smile: