Changing Many Different Widget Colors With a Knob

I've been successfully using setVar("WidgetID", "reverbIDColor1", "#f28018") etc to change color schemes with a widget, however I just recently got the error "maximum call stack size exceeded".

I presume I have too many setVar functions. Is there a way to dynamically inherit properties? I tried using the inherit syntax @{WidgetID.colorStroke}, and while it works statically, it doesn't seem to be dynamic.

Any suggestions to more efficiently change the properties of >60 widgets on three different settings?

The (incompletely scripted) widget changing color is the "color" widget in the decay panel.

Reverb.json (301.8 KB)

Hi,

I'm sure Jean could point at the best performance route. Nonetheless, another quick idea I thought of that may work out better is the following:

Instead of using setVar() for every widget when the knob is turn, instead, create a variable widget. For this example let's call it, "reverbColor". For the value, set it to your default value.

Then every widget instead of having the VAR{reverbIDColor1, #f28018}, you'd call the variable widget using @{reverbColor} in each of the widgets you want to use the color. Might need "" around the variable ID, can't remember off top of my head...

Oh and have the knob set the variable widget's value, set("reverbColor", valueHere).

Cheers!

1 Like

Sorry for the delay!

It works perfectly. Much more efficient. I will definitely use this technique in the future.

Thanks again!
Sam

1 Like