【AE脚本】基于选择的顺序 批量按序号重命名

/**
 * @author fabiantheblind
 * @description rename selected layers with number
 * this happens in comp and project panel
 * source:https://github.com/ff6347/after-effects-script-snippets/blob/master/rename-layers.jsx
 *
 * @todo catch error if layer as no source
 */
 fun();
 function fun() {

   app.beginUndoGroup('rename layers');
   var curComp = app.project.activeItem;
   if (!curComp || !(curComp instanceof CompItem)) {
     alert('noComp');
     return;
   }
   // 判断是否选择图层
   var promttxt = 'layer';
   if(curComp.selectedLayers.length < 1) {
     alert('no selection');
     return;
   }
   // 设置默认名称
   promttxt = curComp.selectedLayers[0].name;

   // 弹出命名对话框
   var basename = prompt('请输入命名前缀', promttxt);
   if(basename.length < 1) {
     alert('nothing is to short');
     return;
   }

   for(var i = 0; i < curComp.selectedLayers.length; i++) {
     var name = basename + ' ' + String(i + 1);
     var currLayer = curComp.selectedLayers[i];
     currLayer.name = name;
   }

   app.endUndoGroup();
 }

 

给TA充电
共{{data.count}}人
人已充电
AE开发脚本开发

【AE脚本】反选 选择的图层

2021-9-6 12:55:57

AE开发脚本开发

【AE脚本】打开当前工程文件夹

2021-9-6 14:03:54

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
搜索