Possible to dynamically generate read-only pars in a custom component?

I have custom components that have various int/float outputs from CHOPs, and sometimes strings from Text DATs. If I need to access those values from elsewhere, I typically do one of:

  • custom parameter that’s bound to a child OPs output, set to read-only
  • Out CHOP/Out DAT
  • reference/export/bind the CHOP/DAT value directly with a global/absolute/relative path

Of those three, I like the first one best in some scenarios, but it’s the most steps in terms of setup (ie. creating custom parameters manually, binding, etc).

Is it possible to have these ‘output’ parameters created dynamically and automatically? For example, if the output of each CHOP/DAT with a certain string in its name (eg. par_out_) was automatically made into a corresponding custom read-only field in the parent containers parameters. Is this feasible?

you could make a global component with an op_find looking for your string in the name, or maybe a tag, that does something like this automatically. what gets a bit messier is if you want to have it automatically remove the customPars when you delete the op in question. Its the kind of thing that I’d be wary about leaving in my project; an errant name space collision could override parameters i have already, etc, and i wouldn’t want it automatically deleting anything.

1 Like

Automatically creating parameters takes some coding, but is very doable: Custom Parameters - Derivative

Watching your CHOPs is definitely a bit more complicated. In the past what I’ve done is set up an Evaluate DAT that watches CHOP.numChans. When that value changes you can check to make sure your custom parameters are correct. That doesn’t deal with name changes though… to do that you can evaluate [c.name for c in CHOP.chans(‘*’)]

1 Like

Matija, If you had something like op(‘mycomp’).out(1) to get the second output, would that be better?