/**
 * @author redefinery with some edits by fabiantheblind
 * @description :选择一个图层所有蒙版
 * source:https://github.com/ff6347/after-effects-script-snippets/blob/master/select-all-masks-on%20layer.jsx
 * @todo [description]
 */
// 需求:
// layer = 图层对象, 而且该对象可以应用蒙版
//
fun();
function fun() {


  app.beginUndoGroup('XXX');

  var curComp = app.project.activeItem;
  if (!curComp || !(curComp instanceof CompItem)) {
    alert('noComp');
    return;
  }

  var layer = curComp.selectedLayers[0];

  var masksGroup = layer('Masks');
  var selectedMasks = new Array();                 // 存储蒙版对象; 起始为空
  if (masksGroup != null) {
                                                 // 遍历masksGroup(蒙版组)
                                                 // 追加蒙版进组
    for (var i = 1; i <= masksGroup.numProperties; i++) {
      masksGroup.property(i).selected = true;
    }
// ~         if (masksGroup.property(i).selected)
// ~             selectedMasks[selectedMasks.length] = masksGroup.property(i);
// ~ }
// The selectedMasks array now contains the list of selected masks
// in top-to-bottom order


  }
  app.endUndoGroup();

}

 

您的电子邮箱地址不会被公开。 必填项已用*标注