Overridable ranges on components with parameters created via extension?

I’m working on packaging up some effects for a artist who is going to continue to use my touch designer networks for their own purposes. As I work I have been somewhat imperiously setting pre-established ranges for the parameters that control behaviour of my effects.

Now I’m wondering whether there’s any way for a user of a network to make permanent modifications to the min and max of a custom parameter without having to edit the extension code which creates those parameters?

As I write I realize this is a super niche question so perhaps the well is going to run a bit dry, but I’ll ask anyways in case it sparks any thoughts later.

The Par members you want are:

normMin/normMax - controls the range of the slider on the parameter dialog, but you can still type values outside this range
clampMin/clampMax - if True, clamps the value of the parameter to within the range given by:
min/max - allowable range of the parameter when clampMin/clampMax are True

For example, to change the minimum range of the parameter’s slider, you can just do OP.par.name.normMin = whatever.

thanks for writing back!

I’ve left things probably a little unclear so let me try to clarify. I wrote an extension that makes some custom parameters for a component and set the normMin/normMax according to the syntax you recommend. I’m happy this is available and am making lots of use of it so thanks for providing that as a scriptable option!

The thing I’m trying to do would be to have an option to override these extension specified values. This would enable my main component user to use my default range until it doesn’t suit them (perhaps environmental factors at an event require a different range on a parameter) and then they could optionally set their own before returning to my defaults for the next event.

I almost want to suggest to my user that they should use a slider ui of their own that they reference into the parameter of interest, but I feel like this might make for a more complex interface. Another thought I had was perhaps there was a way to only initialize the extension once. Then the user could use the “customize component window” to set a new parameter range and then the next time the component loads it would use their choice instead of using the extensions? Sort of how a .tox has the option to “reload .tox on start” or not.

Ah, yeah I see. Yes, allowing the user to change the range in the Comp Editor is straightforward. If you want to get tricky, you can of course build a UI that changes those values with script. Last option, you can use this little-used bind expression syntax: (TD object, “member name”) to bind a parameter to the range values. E.g. bind expression to bind to normMin: (op(‘whatever’).par.Float, ‘normMin’)

Yes, allowing the user to change the range in the Comp Editor is straightforward.

I’d love to stick with this, but can you help me make sure their changes in the Comp Editor persist after a save and re-open?

Thanks for these other options too, I’ll keep them in mind if I don’t have other simpler approaches. The bind one seems like it might be what I fall back to.

Not sure exactly how you are set up, but if you set the values in the extension init, then they will get reset every time you initialize. One simple solution might be to have the default range initialization be attached to a button on the component instead of automatic when it is created.

Oh that’s such a good idea. So like have the extension init setup a pulse, and then somehow have the pulse trigger another extension method that adds the other parameters and overrides any existing ranges?

I guess the part of that I’m unsure about is the pulse callback connection to an extension method. Can you explain more on that?

You’ll set up a Parameter Execute DAT onPulse callback. Will ultimately do something like this:

def onPulse(par):
	if par.name == 'Resetdefaults':
		ext.EffectExt.ResetDefaults()
	return
1 Like

Wow, so straightfoward. Thanks so much I’ll try to implement this and get back to you.

Out of curiosity, would there be an approach that I could use to toggle “on off” the “use defaults” method that will override user set custom ranges?

Would I create the toggle parameter outside of the extension, and then have the extension init check the status of that?

If you can think of a way to create the toggle within the extension but have it still play this role that would be very helpful.

Cheers

There’s no way to “lock” the ranges in a way that you couldn’t edit them with comp editor, so I don’t think a toggle solution would work consistently. Best you could do would be a “set defaults on extension init” toggle, which would be very weird imo.

Ok, working on the suggestion of the parameter execute dat callback onPulse. Thanks for all the assistance to this point!