jean-emmanuel / open-stage-control

Libre and modular OSC / MIDI controller
https://openstagecontrol.ammd.net
GNU General Public License v3.0
701 stars 88 forks source link

Fragment Value in onValue script #854

Closed tylerGirraphic closed 1 month ago

tylerGirraphic commented 1 month ago

OSC v1.27.0 Windows send: 127.0.0.1:8080 osc-port: 8081 debug: true client-options: usePercents=1 built in client

When using a fragment and a script in the onValue to get the widget ID based on panel variable "n" the value appears to be either 1 or 0, or just 1 in some cases. Backing up to v1.26.2 and changing nothing produces proper results.

let X = get("actorLocX_@{parent.variables.n}")
console.log(getProp(this, "id"))
send("/test", X)

image

image

jean-emmanuel commented 1 month ago

I don't see what could cause such issue between v1.26.2 and v1.27.0, nothing was changed regarding scripting and advanced syntaxes. Could you try making a minimal session to help reproduce the issue ? Also this

let X = get("actorLocX_@{parent.variables.n}")

should be

let X = get("actorLocX_" + getProp("parent", "variables").n)

as per the warning in the docs.

tylerGirraphic commented 1 month ago

Certainty. It could just be that line of code. The widget id matches regardless, just that value when loaded into a matrix appeared to be 1, instead of whatever I actually entered into the input widget.

tylerGirraphic commented 1 month ago

Some of the issue could have stemmed from the widgets being faders when they were created, then I switched the type to input? Also seemed like I had to save and reload the main file for it to take effect regardless of having the fragment opened and saving in it.

240731_matrixFragmentTest.zip

jean-emmanuel commented 1 month ago

I tried the session and the values sent over osc are all correct. What's not is the log message in the client console because you wrote the same thing for every widget:

console.log(get("X_1"))

where you should have written (I guess)

console.log(get(this))

Also seemed like I had to save and reload the main file for it to take effect regardless of having the fragment opened and saving in it.

I could not reproduce that with the file you provided, here opening the fragment in another tab and saving it does update the main session.