-
AE script – applyPreset()
Hi,
I’m writing a script in AE CS4 and I want to apply a preset to a Null layer. I can do this successfully if I assign the preset to a variable, then apply it just after I create the Null layer:
var controlLayer = myComp.layers.addNull();
controlLayer.source.name = “Cam_Null_ST”;
controlLayer.applyPreset(thePreset01);However, I need to apply the preset later in the script, and I can’t get it to work. I’m using the following code:
var mySTLayer = myComp.layer(“Cam_Null_ST”);
mySTLayer.moveToBeginning();
mySTLayer.enabled = true;
mySTLayer.applyPreset(thePreset01);I know that I’ve selected the layer correctly because it moves to the top of the stack and gets enabled. However, the preset gets applied either to the last new layer created earlier in the code, or, if no layers are selected, a new solid is created and the preset applied to that! I can’t understand why it doesn’t simply apply the preset to the “Cam_Null_ST” layer that it’s just moved to the top and enabled.
Any help would be much appreciated.
Thanks,
Steve.