I’m trying to get a display of the value for each fader in a matrix. I got the values to show, but they are only being updated by the first fader, even though console.log-ing shows that the text value is in fact changing with every fader…
Here is my props for my faders: (I’m starting at Index 0, hence the “$+1”)
{
“typeTags”: “f”,
“id”: “/composition/layers/#{$+1}/video/opacity”
“address”: “/composition/layers/#{$+1}/video/opacity”,
“target”: “@{osc_r}”
}
and the code for my text matrix:
JS{{
var props = {}
props.id = “opacityFaderLabels #{$}”
props.value = "Layer #{$+1} " + "// " + @{opacityFaders.value}[$]
return props
}}
I also tried adding the function updateProp(“opacityFaderLabels”, value) to my fader scripts, but that didn’t help either…
Is this a bug I should report, or am I doing something wrong? Hahah
Thank you
Even then I strongly discourage the use of @{opacityFaders.value} here because the whole matrix is going to be rebuilt whenever the value updates. You could instead simply give each fader and text widget a linkId (based on the $ index) that will link them two by two.
@jean-emmanuel is there a way to limit the decimals that show in the text box?
When I link float type widgets to text boxes, the values show too many decimals and are not really useable
That may be a bug (handling when decimals are cut is tricky), you can circumvent it by using an input widget instead of a text widget or by following my second answer.
And is there a way to add a string to them when I link them with a linkId? Like "Layer $ " + value for instance?
To do that, you'd have to get rid of the linkId and ìnstead write the text's value property so that it depends on the fader's value. Usually it would look like @{fader_id} but since you're using matrices it's a bit more complicated and I suggest you check out the clones_and_variables.json example from this thread.
The idea is to build a template widget that contains both the slider and the text widgets, define their id so that it depends on the container's variables, and override the variables when cloning or duplicating the container (with a clone matrix).