ExtendScript 可以用Illustrator 文件替换FootageItem 并指定某个图层吗?

Can ExtendScript replace a FootageItem with an Illustrator file and specify a certain layer?

在 AfterEffects 中,我可以右键单击“项目”面板中的文件,然后 select "Replace Footage"。选择 Illustrator 文件后,会出现下面的 window,这使我可以 select 来自该 Illustrator 文件的特定图层。

是否可以使用ExtendScript替换FootageItem并指定Illustrator文件的某个图层?

文档的基础知识,我只找到了 FootageItem.replace( ) 方法。但是,当我使用这种方法时,我无法指定 Illustrator 文件的图层。

来自脚本指南:

app.project.item(index).layer(index).replaceSource (newSource, fixExpressions)

Description:
Replaces the source for this layer.

Parameters:

newSource
The new source AVItem object.

fixExpressions
True to adjust expressions for the new source, false otherwise. Note that this feature can be resource-intensive; if replacing a large amount of footage, do this only at the end of the operation. See also "Project autoFixExpressions() method" on page 115.

Returns: Nothing.

所以我想你应该做两个步骤。

  1. 通过 new ImportOptions(file);
  2. 导入您的 .ai 文件
  3. 替换您的 AVLayer 的来源