hi
I have a simple script to adjust the grey level of a layer using a temporary sampleImage expression to get the colour at the centre of the layer then set values in a Levels effect. It works fine when run from ESTK and also when run from Launch Pad but for some reason wigs out when I try to run it from rd: Script Launcher. I also sometimes get an error "internal verification error... invalid index..."etc. Is there something wrong with how I'm approaching this ??? or is rd: Script Launcher having some issue ???
thanks.
---
Code: Select all
curComp = app.project.activeItem;
L = curComp.selectedLayers[0];
if(L){
app.beginUndoGroup("set grey to 73%");
if(!L.Effects.property("Grey Levels")){
L.Effects.addProperty("Levels (Individual Controls)").name = "Grey Levels";
}
var colorSample = L.Effects.addProperty("Color Control");
colorSample.color.expression = "sampleImage(transform.position, [5,5], false, time)";
var r = colorSample.color.valueAtTime(curComp.time,false)[0];
var g = colorSample.color.valueAtTime(curComp.time,false)[1];
var b = colorSample.color.valueAtTime(curComp.time,false)[2];
L.Effects.property("Grey Levels")("Red Input White").setValue( (r/0.73) );
L.Effects.property("Grey Levels")("Blue Input White").setValue( (b/0.73) );
L.Effects.property("Grey Levels")("Green Input White").setValue( (g/0.73) );
colorSample.remove()
app.endUndoGroup();
}
else{alert("no layer selected")}