//by 群ID:无名人氏 QQ:1107677019
function unique(arr) {
    var sortArr = arr.sort();
    var result = [sortArr[0]];
    var sortArrLen = sortArr.length;
    for (var i = 1; i < sortArrLen; i++) {
        sortArr[i] !== sortArr[i - 1] && result.push(sortArr[i]);
    }
    return result;
}

function getChildItems(selectedCompItems) {
    var selectedCompsNum = selectedCompItems.length;
    var childItems = {};
    var childLayersArr = [];
    var childCompItemsArr = [];
    function getChildCompItems(compItem) {
        var childLayersNum = compItem.layers.length;
        for (var i = 1; i <= childLayersNum; i++) {
            var currentLayer = compItem.layer(i);
            var currentLayerSource = currentLayer.source;
            if (currentLayerSource instanceof CompItem) {
                childCompItemsArr.push(currentLayerSource);
                getChildCompItems(currentLayerSource);
            } else {
                childLayersArr.push(currentLayer);
            }
        }
    }
    for (var i = 0; i < selectedCompsNum; i++) {
        getChildCompItems(selectedCompItems[i]);
    }
    childItems.compItems = unique(childCompItemsArr);
    childItems.layers = unique(childLayersArr);
    return childItems;
}

Leave a Reply

Your email address will not be published.

请下载到本地观看!因为pdf是用的阿里云盘预览,可能部分字体加载不了。

请安装油猴脚本,并下载月离的万事屋脚本

请在右上角三个点 - 下载管理 - 找到刚才的文件,选择允许下载。 或者换个浏览器
echo