Welcome to %s forums

BrainModular Users Forum

Login Register

How to set output colours in FastScript?

I need help on a Patch
Post Reply
ynohtna
Member
Posts: 36
Location: Brighton, UK
Contact:

Unread post by ynohtna » 27 Aug 2013, 17:18

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.

ynohtna
Member
Posts: 36
Location: Brighton, UK
Contact:

Unread post by ynohtna » 28 Aug 2013, 17:16

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.

Code: Select all

SetValue(colour_out, GetValue(colour_in));
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?

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests