我有这样的功能:
function selectLayersOfType_inContainer( layerType, containerLayer ) {
// Filter layers using NSPredicate
var scope = containerLayer.firstObject().children(),
predicate = NSPredicate.predicateWithFormat( "(className == %@)", layerType ),
layers = scope.filteredArrayUsingPredicate( predicate );
// Loop through filtered layers and select them
var loop = layers.objectEnumerator(),
layer;
while ( layer = loop.nextObject() ) {
// [ layer select: true byExpandingSelection: true ]
console.log( layer )
}
log( layers.count() + " " + layerType + "s selected" )
}
该函数遍历所选项目并仅返回MSLayerGroup
-s。但我还需要知道一件事——哪个组在层级中更高,或者哪个组是父/子。那么我怎样才能找出它是什么“Child1.1 Group”是“Child1 Group”的孩子。
请参阅下面的项目结构示例: .