文章目录

  • 1.算法程序
  • 2.作者答疑

1.算法程序

  AfterEffect(AE)插件是特效制作软件,本文向大家介绍如何开发插件中的子模块创建面板。源代码如下所示:

{function DemoPalette(thisObj){// Called when a button is pressed, to invoke its associated scriptfunction onHelpButtonClick(){alert("Click a button to run one of the following scripts:\n\n"  +"Find and Replace Text:\n"+"Launches a UI to find and replace text values. Finds and replaces text within values and keyframe values of selected text layers of the active comp.\n" +"\n" +"Scale Composition:\n" +"Launches a UI to scale the active comp. Scales all layers, including cameras, and also the comp dimensions.\n" +"\n" +"Scale Selected Layers:\n" +"Launches a UI to scale the selected layers of the active comp. Scales all selected layers, including cameras.\n" +"\n" +"Sort Layers by In Point:\n"+"Reorders all layers in the active comp by in-point.\n" +"\n" +"Render and Email:\n"+"Renders all queued render items and then sends you an email message when the render batch is done. Refer to Help for more information on this script.\n" +"", "Demo Palette");}// This function adds a new help button to the palettefunction addHelpButton(palette, buttonRect){var newButton = palette.add("button", buttonRect, "?");newButton.onClick = onHelpButtonClick;return newButton;}// Called when a button is pressed, to invoke its associated scriptfunction onScriptButtonClick(){var prevCurrentFolder = Folder.current;Folder.current = this.currentDirectory;// The scriptFile variable was set during addButton.// Run the script by opening it, reading it, and evaluating its contents.var scriptFile = new File(this.scriptFileName);scriptFile.open();eval(scriptFile.read());scriptFile.close();Folder.current = prevCurrentFolder;}// This function adds a new script-launching button to the palettefunction addScriptButton(palette, buttonRect, buttonLabel, buttonCurrentDirectory, buttonScriptName){var newButton = palette.add("button", buttonRect, buttonLabel);// JavaScript has an unusual but useful bit of functionality.// You can just assign a value to a new variable name and JS will// store it for you. The lines below create new variables named// scriptName and currentDirectory within newButton, and sets them// to buttonScriptName and myCurrentDirectory.// Later, in the onButtonClick() callback, the button will first// re-establish the current directory, then load and// run that file.newButton.scriptFileName   = buttonScriptName;newButton.currentDirectory = buttonCurrentDirectory;newButton.onClick = onScriptButtonClick;return newButton;}function isSecurityPrefSet(){var securitySetting = app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY");return (securitySetting == 1);}if (isSecurityPrefSet() == true) {//// Save the value of the current directory.// -- In some cases, the current directory value is lost when button and other// callbacks are invoked from a floating palette.// -- Some of the buttons in the demo palette need to read other script// files.  The most convenient notation for the filenames is to specify them// relative to the current directory. And if the current directory is set wrong,// then the nested scripts will fail to run correctly.// -- to fix this, save the current directory now, and make sure to // re-establish it during onScriptButtonClick(). This will insure that the // files run during onScriptButtonClick() can properly read other script files.//var myDirectory = Folder.current;var demosDirectory = new Folder(myDirectory.absoluteURI);// Horizontal Spacing variablesvar left_margin_width    = 5;var right_margin_width   = 5;var between_button_width = 5;// Width of buttons depends on platform and languagevar button_width;if (system.osName.indexOf("Windows") != -1) {// Windows system has narrower buttons.button_width = 120;} else {// Mac has wider buttonsbutton_width = 160;}if (app.language == Language.JAPANESE) {// Add 20 pixels for japanese machines, default font is widerbutton_width += 17;}var l_button_left  = left_margin_width;var l_button_right = l_button_left + button_width;var r_button_left  = l_button_right + between_button_width;var r_button_right = r_button_left + button_width;var palette_width  = r_button_right + right_margin_width;// Create and show a floating palette//var my_palette = new Window("palette","Script Demos");my_palette.bounds = [300,200,300+palette_width,285];var button1 = addScriptButton(my_palette,[l_button_left,   5, l_button_right, 25], "Find and Replace Text",    demosDirectory, "Find and Replace Text.jsx");var button3 = addScriptButton(my_palette,[l_button_left,  30, l_button_right, 50], "Scale Composition",         demosDirectory, "Scale Composition.jsx");var button4 = addScriptButton(my_palette,[l_button_left,  55, l_button_right, 75], "Scale Selected Layers", demosDirectory, "Scale Selected Layers.jsx");var button6 = addScriptButton(my_palette,[r_button_left,   5, r_button_right, 25], "Sort Layers by In Point",     demosDirectory, "Sort Layers by In Point.jsx");var button8 = addScriptButton(my_palette,[r_button_left,  30, r_button_right, 50], "Render and Email",    myDirectory,    "Render and Email.jsx");var button12 = addHelpButton(my_palette,[r_button_left,  55, r_button_right, 75]);my_palette.show();} else {alert ("This demo requires the scripting security preference to be set.\nGo to the \"General\" panel of your application preferences, and make sure that \"Allow Scripts to Write Files and Access Network\" is checked.", "Demo Palette");}}DemoPalette(this);
}

2.作者答疑


  如有疑问,请留言。

AfterEffect(AE)插件-常规功能开发-创建面板-js脚本开发相关推荐

  1. AfterEffect(AE)插件-常规功能开发-放大缩小图层-js脚本开发-AE插件

    文章目录 1.算法程序 2.文本转执行 3.作者答疑 1.算法程序   AfterEffect(AE)插件是Adobe公司开发的特效制作软件,稳定快速的功能和特效,在视频制作领域使用非常广泛,本文向大 ...

  2. illustrator插件-常用功能模块-测量路径长度-js脚本开发-AI插件

    文章目录 1.算法程序 2.作者答疑 1.算法程序   illustrator是矢量编辑软件,画板是绘制处理的重要容器,在印刷方面的一个重要功能就是测量路径长度,开发一个测量路径长度功能,以下功能仅用 ...

  3. AfterEffect插件--常规功能开发--扭曲效果--js脚本开发--AE插件

    文章目录 1.扭曲效果功能 2.作者答疑 1.扭曲效果功能   AfterEffect(AE)插件是Adobe公司开发的特效制作软件,稳定快速的功能和特效,在视频制作领域使用非常广泛,本文向大家介绍如 ...

  4. InDesign插件--常规功能开发--版面调整--js脚本开发--ID插件

    文章目录 1.算法程序 2.作者答疑 1.算法程序   Adobe InDesign是Adobe公司的一个桌面出版 (DTP) 的应用程序,主要用于各种印刷品的排版编辑.InDesign可以将文档直接 ...

  5. illustrator插件--常用功能开发--色标生成器--js脚本开发--AI插件

      illustrator是矢量编辑软件,画板是绘制处理的重要容器,在印刷方面的一个重要功能就是色标生成器,开发一个色标生成器功能,以下功能仅用于学习交流,请勿用于非法用途和商业用途,源代码如下所示: ...

  6. illustrator插件-画板功能开发-插入页码-js脚本开发-ai插件

    文章目录 1.算法程序 2.文本转执行 3.作者答疑 1.算法程序   illustrator是矢量编辑软件,画板是绘制处理的重要容器,开发一个插入页码功能,源代码如下所示: if (app.docu ...

  7. illustrator插件-拼版功能开发-阵列复制-js脚本开发-ai插件

    文章目录 1.算法程序 2.作者答疑 1.算法程序   illustrator是矢量编辑软件,画板是绘制处理的重要容器,在印刷方面的一个重要功能就是拼版,开发一个阵列复制功能,以下功能仅用于学习交流, ...

  8. illustrator插件--常用功能开发--绘制手提袋--js脚本开发--AI插件

      illustrator是矢量编辑软件,画板是绘制处理的重要容器,在印刷方面的一个重要功能就是绘制手提袋,开发一个绘制手提袋功能,以下功能仅用于学习交流,请勿用于非法用途和商业用途,源代码如下所示: ...

  9. AfterEffect插件-常规功能开发-高斯特效添加-js脚本开发-AE插件

    文章目录 1.程序算法 2.应用 3.作者答疑 1.程序算法   高斯模糊(英语:Gaussian Blur),也叫高斯平滑 ,通常用它来减少图像噪声以及降低细节层次. 从数学的角度来看,图像的高斯模 ...

最新文章

  1. ARCGIS中某字段递增赋值
  2. java调用Windows程序
  3. 没有绿幕,AI也能完美视频抠图,发丝毕现,毫无违和感 | CVPR
  4. 3.7 感知器-机器学习笔记-斯坦福吴恩达教授
  5. Tomcat--HTTPS的简单应用
  6. 毕设开发总结-3D游戏框架及网络对战游戏的开发(1)
  7. 原生js来实现对dom元素class的操作方法
  8. jQuery实现表格行上移下移和置顶
  9. href中使用javascript:void(0)无法执行操作
  10. VS2013 启用 angularjs 智能提示 Intelligence
  11. J2EE代码存档--导出Excel
  12. 使php支持pdo_mysql
  13. xstream-0 使用入门
  14. 阶段2 JavaWeb+黑马旅游网_15-Maven基础_第5节 使用骨架创建maven的java工程_12不使用骨架创建maven的java工程...
  15. mysql基本概念之关系_Mysql数据库学习(一):数据库基本概念、关系型数据库、Mysql数_MySQL...
  16. 远程teamview下载网址,和ie 下载地址
  17. tornado tcpclient 应用实例
  18. 关于2D-DCT字典和克罗内克积以及二维字典的separable特性的个人理解
  19. 输入字符,如果是大写则转化为小写,如果是小写则转化为大写
  20. 百度网盘高速下载器提示:高速受限!建议重新注册网盘账号使用

热门文章

  1. 树的遍历(python)
  2. Xcode8配置支持10.1的系统
  3. UI自动化_python+selenium京东前台购物流程
  4. 全面理解EOS——2.加入EOS主网和测试网
  5. EOS将发布的官方EVM怎么样?
  6. 推荐一些vue实战项目
  7. 微软拼音输入法繁体转简体
  8. 深度学习训练(优化)参数的玄学解释
  9. H3CSE的培训的重要知识点
  10. 语法转换_【语法专题】句型转换(上)