I'm having a weird problem with a script that adds and utilises an expression containing sampleImage.
The script is meant to add a 'Color Control' to the selected layer, sample a particular pixel RGBA value, and use that value.
I'm testing this with a pure red solid.
Here is the script in a basic form:
var myComp = app.project.activeItem;
var selectedLayer = myComp.selectedLayers[0];
var addColorControl = selectedLayer.Effects.addProperty("Color Control");
var expr = "sampleImage([0,0], [0.5,0.5], true, (time+0));";
addColorControl.property(1).expressionEnabled = true;
addColorControl.property(1).expression = expr;
var res = addColorControl(1).value;
$.writeln(addColorControl(1).value);
In After Effects 2014, this writes the following to the console:
1,0,0,1
Which is correct for the red solid.
But in After Effects 2015, the exact same script and circumstances (red solid), gives this response:
0,0,0,0
However, if after I have run the above script I then run this:
var myComp = app.project.activeItem;
var selectedLayer = myComp.selectedLayers[0];
var getColorControl = selectedLayer.Effects.property(1);
$.writeln(getColorControl(1).value);
It prints the correct response to the console:
1,0,0,1
As I said, it works fine in the previous version of AE (2014), but not in the current version. This not working has just crippled a couple of large scripts I'm using, and it would nice to be able to use them in the latest version.
Anyone have any ideas about this?