|
|
Thanks for your interest. Yes your script works fine, and it’s prompted me to play around a bit more. My full script is a few hundred lines and I won’t post it all, but I have stripped it down to the basics and I’ve found where the problem comes from.
In my full script I am applying the Color Link effect and sampling the colour after it is applied. It’s this effect which is not working in CC 2017 or CC 2018. As an experiment, I tried applying the basic fill effect instead, and when I do that the script does work as expected.
I’ve pasted a version of the script below. If you leave it as-is. the color link effect is applied and the sampleImage only returns 0. If you comment out the color link effect to prevent it being added, then only the fill effect is applied. Then the sampleImage correctly returns the values of 1,0,0.
I would love to know if you can replicate this behaviour - thanks again.
-Chris
{
function ZaksTest(thisObj) {
var ZaksTestData = new Object ();
ZaksTestData.strApply="Apply";
var colourExpression="x=thisLayer.width/2;y=thisLayer.height/2;\n c=sampleImage([x,y], radius = [2, 2], postEffect = true, t = time);\n c";
// Set up the GUI
function ZaksTest_buildUI(thisObj) {
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window ("palette","ZaksTest",undefined, {resizable:true});
var res =
"group { \
orientation:'column', alignment:['fill','top'], \
apply: Group { \
alignment:['right','top'], \
applyBtn: Button { text:'" + ZaksTestData.strApply + "' }, \
}, \
}";
myPanel.grp = myPanel.add(res)
var apply=myPanel.grp.apply.applyBtn;
// Apply button - main part
apply.onClick=function()
{
var myComp = app.project.activeItem;
app.beginUndoGroup("ZaksTest");
clearOutput();
var myLayer = myComp.selectedLayers[0];
myLayer.property("ADBE Effect Parade").addProperty("ADBE Fill");
// comment out the color link effect and the script works. If it's enabled it doesn't //
myLayer.property("ADBE Effect Parade").addProperty("ADBE Color Link");
myLayer.property("ADBE Effect Parade").addProperty("ADBE Color Control");
myLayer.property("ADBE Effect Parade").property("ADBE Color Control").property("ADBE Color Control-0001").expression=colourExpression;
var RGB=[1,1,1,1];
var r=0;g=0;b=0;
RGB=myLayer.property("ADBE Effect Parade").property("ADBE Color Control")(1).value;
r=RGB[0];
g=RGB[1];
b=RGB[2];
alert("RGB: "+r+","+g+","+b);
app.endUndoGroup();
}
// Set panel resizing
myPanel.layout.layout (true);
myPanel.grp.minimumSize=myPanel.grp.size;
myPanel.layout.resize();
myPanel.onResizing = myPanel.onResize= function () {this.layout.resize()}
return myPanel;
}
var ZaksTestPal = ZaksTest_buildUI(thisObj);
if ((ZaksTestPal != null) && (ZaksTestPal instanceof Window))
{
ZaksTestPal.center();
ZaksTestPal.show();
}
}
ZaksTest(this) ;
}
|
|