I'm trying to programmatically change knob colours with some custom FastScript, but I can't work out the correct method to set the value on the ptChooseColor outlet.
Does anyone know how to do it? I imagine I need to somehow convert/cast the 4 byte hex colour value into a floating point Single.
How to set output colours in FastScript?
I was just investigating this problem further and discovered something weird.
If I run a script that creates a ptChooseColor TParameter that is both an input and output then everything works. A colour chooser connected to the inlet transmits its values perfectly through the script to the outlet, and I can verify that casting it's GetValue() result to a longword is the hexadecimal colour definition as expected ($FFA03080 or whatever).
However, if I also create an additional ptChooseColor outlet TParameter and try to send the same colour value through it then the value sometimes gets "lost" and is not transmitted.
My hunch is that some colour values are considered NaN in floating point representation (fully opaque reds for example) and thus aren't being sent by SetValue. Bug?
I've tried using SetStringValue and SetColor but they don't have any affect. So, is there a recommended functional way for scripts to generate colour values through outlets?
If I run a script that creates a ptChooseColor TParameter that is both an input and output then everything works. A colour chooser connected to the inlet transmits its values perfectly through the script to the outlet, and I can verify that casting it's GetValue() result to a longword is the hexadecimal colour definition as expected ($FFA03080 or whatever).
However, if I also create an additional ptChooseColor outlet TParameter and try to send the same colour value through it then the value sometimes gets "lost" and is not transmitted.
Code: Select all
SetValue(colour_out, GetValue(colour_in));I've tried using SetStringValue and SetColor but they don't have any affect. So, is there a recommended functional way for scripts to generate colour values through outlets?
Who is online
Users browsing this forum: No registered users and 12 guests
