Closed RBasile closed 4 years ago
Hi,
Open Stage Control receives osc color
arguments as objects ({r: 168, g: 40, b: 40, a: 0 }
) but the widgets are not expecting data formatted this way, for instance the led widget expects an array ([168, 40, 40, 0]
) or a string ("#a02828"
) (see reference).
Sending the color formatted either way will do the trick, but you can also convert the object manually in Open Stage Control:
JS{{
var color = OSC{/r}
return [color.r, color.g, color.b, color.a] // skip color.a to ignore alpha
}}
Note that if you choose to send the data as something the widget can read directly, you don't need the OSC{}
syntax at all and can use its own osc address.
I get this error when trying to get the argument of var color.
rgbled_1.value: JS{{}} error:
TypeError: Cannot read property 'r' of undefined at line 1
If I made a OR like var color = OSC{/r} || { r: 255, g: 255, b: 255, a: 1 };
the OSC{/r}
seem to always be undefined
It seems to work with v1, can you paste the value property's content here ? Also note that the widget's preArgs must be matched to feed the osc listener unless the appropriatie flag is set (https://openstagecontrol.ammd.net/docs/widgets/advanced-syntaxes/#osc-listeners-oscaddress-default-usepreargs)
It's the same with the v1 for me Here my content of the "value property"
JS{{
var color = OSC{/r} || { r: 255, g: 255, b: 255, a: 1 };
return [color.r, color.g, color.b, color.a] // skip color.a to ignore alpha
}}
I don't have any prearg
If i use this:
JS{{
var color = OSC{/r} || { r: 255, g: 255, b: 255, a: 1 };
console.log("hello");
console.log(color);
return [color.r, color.g, color.b, color.a] // skip color.a to ignore alpha
}}
and sent some integer I have the "hello" and the number in the console but when receiving color I don't
My test file Color.json.txt
It should be fixed in sources now.
Included in alpha 18, osc color arguments are now properly received by osc listeners.
Thanks it's working for me
Open stage control is receving the color corectly as shown in the debug but not the in the widget
version 0.49.12 and version 1.0.0-alpha16 windows 10 built-in client
Maybe I done something wrong with the OSC{}