How to inherit @{parent.variables} and add new variables

Hello, while using this astoundingly awesome program, I am trying to get a panel object to inherit its parent’s variables, while also declaring some variables unique to itself.

I have tried to set the variables property as:

{
@{parent.variables},“device”: “filter”
}

but this is computed as:

{
“{“track”:10}”,“device”: “filter”
}

and the track variable cannot be accessed by the panel’s children

Is there something I’m doing wriong, or a better way to do this?

To give a bit of context, I have an xy pad inside this panel, and I want to create its OSC address by using its parent (representing an effect device in Ableton) and it’s grandparent (representing a track in Ableton)

I hope that makes sense!

You’d need some javascript magic to do that:

#{Object.assign(@{parent.variables}, {device: "filter"})}

This will merge both objects. See

1 Like

Amazing, thank you!

So say this same panel containing an xypad is cloned throughout the project. It’s oldest ancestor contains the variable “n” : 5, and no matter if this ancestor is it’s grandparent, or great great great great grandparent, I want to be able to set the id and osc address of the xypad to something that includes “n”, only with the knowledge that an arbitrary ancestor contains the variable “n” : 5

Is there an easier way to this other than setting each ancestor to inherit “n” from its parent?

If this isn’t clear enough I can provide screenshots!

Is there an easier way to this other than setting each ancestor to inherit “n” from its parent?

Leaving all the ancestors' variables to the default value and overriding them only at the highest level (the one you'll clone): see clone_and_variables.json from this thread.

Ok, and if I need to add variables in the ancestors, then I’ll use the method of inheriting variables and setting adding to them, thanks!