Unique ID and value with duplication

Hi,
I’m working on my first patch which is a controller for Hy-Rep2, which contain 8 same track sequencing.
After creating my first track I wanted to duplicate it to create “Track02” but they are sharing same value despite I change the main panel container.
Does it means I need to customize every controller ?
Best

Clone is a great tool !

Yes. A way to do so is to use the panel’s variables property:

{
  "n": 1
}

And use it to define it’s children’s ids (@{parent.variables.n}). When copying the panel, incrementing that variable will increment all the children too. If using a clone widget, the variables property can be overridden with the props property:

{
  "variables": {"n": 2}
}

Edit: it’s also possible to use the paste action “ID + 1” that will simply paste copied widgets and increment their id automatically.

1 Like

The paste function “ID + 1” is fine, I didn’t saw it because I’m always using shortcut.
But I need to understand "n" : 1 solution.
btw it can be a cool solution to have hierarchy :slight_smile:

A problem with "ID +1" is that doesn’t take the update +1 on “text” that is getting value from @{knob}
And at this time I did not succeed with the
( @{parent.variables.n} )

A problem with "ID +1" is that doesn’t take the update +1 on “text” that is getting value from @{knob}

That’s a limitation indeed. To do that with the variables method you have to to write something like
@{knob_@{parent.variables.n}}

1 Like

Ok I’ll re try again later !
So this has to be implement at the begin of the patch creation.

sorry I don’t get it, I tried to follow your explication but I’m totally lost by where to use where as well for copy +1 or clone.

> “responsive is really powerful”

copy_clone_test.json (6.5 KB)

Here is a simple example: clone_variable_n.json (5.5 KB)
The panel on the left is the “template” widget, its variables property is used to define its children’s ids (and the texts’ values). The panel on the right is a clone widget targeting the template widget that overrides the variables property.