通过在 After Effects 中编写脚本添加效果

Adding effects by scripting in After Effects

这里我想写一个脚本,通过添加 Warp Stabilizer VFX 来稳定延时序列,然后使用 DEFlicker Time Lapse 去闪烁,最后渲染和导出视频,它在睡觉前运行,这样它就不会在工作时间不要让我的电脑变慢。但是,我在AE脚本文档中找不到为图层添加效果的API,有谁知道如何做到这一点?提前致谢!

您可以像这样向图层添加效果:

if (!theLayer.Effects.property("Warp Stabilizer")){   //add only if no such effect applied
    var theEffect = theLayer.property("Effects").addProperty("Warp Stabilizer");  // the regular way to add an effect
}

要对其进行测试,您可以将其添加到所选图层,将其应用于所选图层的完整代码如下所示:

var activeItem = app.project.activeItem;

if (activeItem != null && activeItem instanceof CompItem) {          // only proceeds if one comp is active

  if (activeItem.selectedLayers.length == 1) {          // only proceeds if one layer is selected

    var theLayer = activeItem.selectedLayers[0];
if (!theLayer.Effects.property("Warp Stabilizer")){
    var theEffect = theLayer.property("Effects").addProperty("Warp Stabilizer");          // the regular way to add an effect
  }
 }
}

解决方案基于adobe论坛:https://forums.adobe.com/thread/1204115