【AE脚本】案例:移除所选图层的所有表达式

介绍

选择一个或者多个图层,会移除它们的所有表达式 ## 知识点

属性组/属性循环遍历:下面的[yl_keyword]recurse_children[/yl_keyword]函数 ## 源码

// 名称:移除所选图层的表达式
// 来源: 
// 源码:https://www.yuelili.com/?p=10427

app.beginUndoGroup(Remove all Expressions);

{
    var comp = app.project.activeItem;
    var layerNumber = comp.selectedLayers.length;
    var chosenLayers = comp.selectedLayers;

    if (layerNumber >= 1) {

        for (var i = 0; i < layerNumber; i++) {
            var layerNames = chosenLayers[i].index;
            recurse_children(comp.layers[layerNames]);
        }
    }
    else {
        alert('no layer selected');
    }

    function recurse_children(propParent) {
        if (propParent != null) {
            var prop;

            for (var i = 1; i <= propParent.numProperties; i++) {
                prop = propParent.property(i);
                switch (prop.propertyType) {
                    case PropertyType.PROPERTY:

                        if (prop.canSetExpression && prop.expression)
                            prop.expression = '';
                        break;
                    case PropertyType.INDEXED_GROUP:
                        recurse_children(prop);
                        break;
                    case PropertyType.NAMED_GROUP:
                        recurse_children(prop);
                        break;
                    default:
                        break;
                }
            }
        }
    }
}

app.endUndoGroup();

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

【AE脚本】案例:把信息传递到系统剪贴板

2020-4-8 22:48:17

AE开发脚本开发

【AE脚本】怎么用AE脚本给文件重命名?

2020-4-11 18:34:14

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