-
replaceSource and Effects
I have a layer with a static image (png) and an effect (Bulge) applied to the layer. What I’m trying to do is replace the static image with another image, but I still want the effect to apply to the new image. My script is pretty simple and looks like this:
// Load the replacement image
var importOptions = new ImportOptions(File(“D:/Dev/AfterEffects/Scripts/Assets/Test.png”));
var newImage = app.project.importFile(importOptions);
// Replace the layer content
testAVLayer.replaceSource(newImage, true);
When I execute the script, the image is replaced and I still see the effect attached to the layer in the AE UI, but the new image is no longer modified by the effect. As a sanity check, I added some code to examine the layer after the replaceSource call:
var fxLength = testAVLayer.effect.numProperties;
for(var i=1;i<=fxLength;i++){
var curFx = testAVLayer.effect(i);
alert(curFx.name);
}
This code indicates that the Bulge effect is still attached to the layer.
I’m a programmer by trade but very much a beginner with AE, so hopefully I’m missing something obvious. Thanks in advance for any help!