So I’ve been playing with cloned controls and for the life of me can’t figure out a way to update some but not all values on a cloned control.
For example let’s say I had the following definition on a hidden tab that I plan on using as a template for multiple cloned controls on other tabs of the UI. (I’ve stripped irrelevant properties for clarity).
{
“type”: “panel”,
“id”: “pan_fader_volume”,
“variables”: {
“cc”: 0,
“channel”: “@{parent.variables.channel}”,
“default”: 63,
“max”: 127,
“min”: 0,
“name”: “Fader”,
“target”: “@{parent.variables.target}”
}
}
If I I clone this into another tab without any changes it works as expected and I can send midi messages no problem via a fader I have inside of the widgets of this control. I based my logic on the example available at
However, every single clone will reference the exact same variables. Not a problem I think, I’ll just define my overrides in the props and everything should work as expected.
{
“type” : “clone”,
“widgetId” : “pan_fader_volume”,
“id” : “gainVolume”,
“props”: {
“variables” : {
“name” : “Master Gain”
}
}
With these props I’m expecting the variables in my cloned control when evaluated to look like:
“variables”: {
“cc”: 0,
“channel”: “1”,
“default”: 63,
“max”: 127,
“min”: 0,
“name”: “Master Gain”,
“target”: “midi:mymid”
}
Instead it appears that I end up with:
“variables”: {
“name”: “Master Gain”
}
I get why what I’m doing won’t work. What I’m hoping to find out if there is some kind of alternative formatting or scripting I could employ to get the result I’m expecting.
I understand that it might not be possible to do a deep merge of the objects. In such a case I’d be curious if an alternative syntax is available or could be employed to single out a specific nested property. Something like one of the following:
“props”: {
“variables.name” : “Master Gain”,
“variables[‘name’]” : “Master Gain”
}
I’d be fine employing a little scripting as well to get around it, but I’m trying to keep my configs as light as possible. I’d really rather avoid having to redefine all my variables for every object and have random things break when I forget.
Thanks