|
|
I'm thinking the problem is you are applying an expression to the controller and then asking the value of the controller - the problem is that if you apply an expression to say position and then ask the for the value it returns the default position. rather than add the expression to sample the color just create a variable to sample the point you need and then it will return the correct color. I don't know your whole application so that may not be possible, and the last time I tried sampleImage() I had some weird colors show up.
tt
> On April 30, 2018 at 10:29 PM Chris Zwar <AE-List@media-motion.tv> wrote:
>
>
> Hi,
>
> Just after some scripting help. I have a simple script that works fine when run without a GUI, but if I use exactly the same code in a version with a GUI it doesn’t work any more.
>
> The aim is to sample the colour of a layer. The script applies a colour control / expression control effect, with an expression that uses sampleImage to read the RGB values. The script then reads the value of the colour control to get the RGB values.
>
> As I said - works fine if I run the script from the scripts menu. But the same thing in a GUI and run from the ScriptsUI Panel doesn’t work. The RGB array variable is just 0. So what am I doing wrong?
>
> Cheers,
>
>
> -Chris
>
> Offending code:
>
> myLayer[0].property("ADBE Effect Parade").addProperty("ADBE Color Control”);
>
> myLayer[0].property("ADBE Effect Parade").property("ADBE Color Control").property("ADBE Color Control-0001").expression="x=thisLayer.width/2;y=thisLayer.height/2; c=sampleImage([x,y], radius = [2, 2], postEffect = true, t = time);";
>
> var RGB=myLayer[0].property("ADBE Effect Parade").property("ADBE Color Control").property("ADBE Color Control-0001").value;
>
>
> +---End of message---+
> To unsubscribe send any message to <ae-list-off@media-motion.tv>
|
|