• 搭建AE脚本开发环境


            一开始也是试着在 After Effects 中打开脚本编辑器,但弹窗提示如下:

             根据提示需要下载 extendScript toolkit,但根据 extendScript toolkit 介绍由于受到 adobe 使用条款等约束已不再维护,且于2019年 adobe 提供了基于 vscodeextendScript debugger 插件。

             尽管不能替代 extendScript toolkit 的所有功能,还是转战 vscode 试试吧。先下载插件:

            如图所示,第二个就是啦!之前在指定文件夹下创建如 test.jsx 文件,后面会自动创建个 launch.json 文件,内容大概如下:

    1. {
    2. // Use IntelliSense to learn about possible attributes.
    3. // Hover to view descriptions of existing attributes.
    4. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    5. "version": "0.2.0",
    6. "configurations": [
    7. {
    8. "type": "extendscript-debug",
    9. "request": "attach",
    10. "name": "Attach to ExtendScript Engine",
    11. },
    12. {
    13. "type": "extendscript-debug",
    14. "request": "launch",
    15. "name": "Launch Script in ExtendScript Engine",
    16. }
    17. ]
    18. }

            之后可在 test.jsx 中测试如下代码,正常的话会在 ae 的信息面板中出现 ”hello world“ 字样:

    write("hello world");

             如果这时运行代码,会弹窗提示你需要手动选择对应的应用程序:

             这里可以在 launch.json 文件中添加配置:

    1. {
    2. "type": "extendscript-debug",
    3. "request": "launch",
    4. "name": "Launch Script in ExtendScript Engine",
    5. "hostAppSpecifier": "aftereffects-18.0",
    6. }

            这里属性是 hostAppSpecifier 字段,如果老版本的话,就是 targetSpecifier。重新点击运行后,程序依然不能生效,还有两处需要调整:

             第一处是需要将图中箭头指向处选为 launch 版本,另一处是要在文件 launch.json 中配置上脚本路径,即 script 属性,如果老版本的话,就是 program 属性:

    1. {
    2. "type": "extendscript-debug",
    3. "request": "launch",
    4. "name": "Launch Script in ExtendScript Engine",
    5. "hostAppSpecifier": "aftereffects-18.0",
    6. "script": "${workspaceFolder}/test.jsx",
    7. }

            这块注意到 test.jsx 文件名是写死的,如果有多个文件调试就得每次都来修改了。不过 vscode 也提供了一个内部变量 ${fileBasename} 可直接引用,动态获取当前文件名。

    1. {
    2. "type": "extendscript-debug",
    3. "request": "launch",
    4. "name": "Launch Script in ExtendScript Engine",
    5. "hostAppSpecifier": "aftereffects-18.0",
    6. "script": "${workspaceFolder}/${fileBasename}",
    7. }

            程序终于可以正常执行啦,信息面板中也能看到对应结果:

            如果想在 vscode 的控制台也打印输出呢?如下执行即可:

    $.write("hello world");

            至此,开发环境就算配置完成啦!欢迎交流~

  • 相关阅读:
    适用于多类移动场景的融合认证机制设计
    C_练习题 10
    Sprite Editor
    Anaconda安装和配置
    [TSG开发日志4]算法组件、个人编写的库文件如何封装成DLL,如何更好地对接软件开发?
    两数之和-(哈希)
    m基于simulink的WCDMA通信链路仿真
    leetcode 129
    质数因子求解
    手动编译与安装Qt的子模块
  • 原文地址:https://blog.csdn.net/yang1018679/article/details/126770005