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

Scripting 通过在After effects中编写脚本添加效果,scripting,adobe,extendscript,after-effects,Scripting,Adobe,Extendscript,After Effects,在这里,我想写一个脚本,可以通过添加扭曲稳定器VFX来稳定延时序列,然后使用deflicker time-lase进行deflicker,最后渲染并导出视频,该视频在睡觉前运行,以便在工作时不会降低我的计算机速度。但是,我在AE脚本文档中找不到向层添加效果的API,有人知道如何做到这一点吗?提前谢谢 您可以向图层添加效果,如下所示: if (!theLayer.Effects.property("Warp Stabilizer")){ //add only if no such effect

在这里,我想写一个脚本,可以通过添加扭曲稳定器VFX来稳定延时序列,然后使用deflicker time-lase进行deflicker,最后渲染并导出视频,该视频在睡觉前运行,以便在工作时不会降低我的计算机速度。但是,我在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
  }
 }
}
要测试它,可以将其添加到选定层,将其应用到选定层的完整代码如下所示:

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论坛: