Matrix, fragments children widgets id

Hi, what is the correct way to set matrix children widgets "id"? I have a track.json fragment and am trying to find a way to easily start my OSC client with variable number of tracks, so i tried to add matrix with fragments, but don't now how to set children widgets unique "id" using n variable (as discussed here: Cloning, pasting, decoupling widgets, send recevie).

When i add "variables": {"n": #{$}} to matrix's props, it doesn't do anything (as opposed to when i ad it to a different, separate fragment props) - i guess it's because matrix doesn't have variables, so it's not propagated down to fragment container and from there all the way down to track's widgets? So how is it done properly? Or am i doing something wrong? Thank you.

1 Like

Just to add - the widgets in track are nested in panel widget. And also - what is the widget chain here? Is it like this: root -> matrix -> fragment (track.json) -> panel -> all track widgets? Is there some way how to check it (i tried to show it using web developer tools in ff, but didn't find it)?

hi,

Would you upload your session json file to try to help you. Please

1 Like

track.json (11.9 KB)
matrix.json (2.2 KB)

It's the fragments' props property you need to override to get what you want:

{
  "file": "track.json",
  "props": {"variables": {"n": #{$} }}
}

what is the widget chain here? Is it like this: root -> matrix -> fragment (track.json) -> panel -> all track widgets

Yes, the fragment widget is a wrapper, just like the clone widget.

Is there some way how to check it (i tried to show it using web developer tools in ff, but didn't find it)?

The html structure should represent the widget structure, each element with the widget class that has a data-widget attribute is linked to a widget instance.

Thank you. But how can i do that? How can i get to each fragment's, embedded in matrix widget, settings? Actually, once i was somehow able to select one of the fragments in matrix and see it's settings - but i don't know how i did it and can't do it again. Do you mean this or some other way?

No you can't access the fragment's content (unless a bug occurs), I was just saying that you can see the widget structure in the html structure but it doesn't give any control over it.

Sorry, i was replying to this. How can i set this in matrix widget, so it applies to its fragment widgets? Thank you.

That's the matrix' props property, you can paste it as is.

Ah, sorry, i'm blind :smiley: didn't catch it's variables embedded in props :smiley: it works! :smiley: thanks for patience!

hi @johan ,

could you post the json files that work as this we can all see how you and Jean-Emmanuel have solved the problem :slight_smile:
Thanks !

Of course :slight_smile:

matrix.json (2.2 KB)

It's slightly different, but the only important change is:

"props": "{\n "file": "track_new.json",\n "props": {"variables": { "n": #{$} }}\n}",

instead of:

"props": "{\n "file": "track.json",\n "variables": { "n": #{$} }\n}",

except the name of file.

Hi,

Thank you. i've never used Fragments before :slight_smile:
indeed we have to change the track file name :slight_smile:

But it's not very handy to have to close ,or use two instances of o-s-c,to edit the fragment (track.json) and the matrix.json. But i understand we can with fragments reuse and centralize some code. So i have to explore

You don't have to have 2 servers running, just open a browser to create a second client instance (or "menu > new window" in the launcher window).

ah yes ! Wonderfull !

1 - Launch o-s-c and open matrix.json
2 - open a new window in the launcher window
image

3 - load the track.json

4 - edit your fragment and save

5 - and the matrix is updated :slight_smile:

Very very handy "du coup" :slight_smile: