我想从psd中找到所有剪贴蒙版层。但是问题是我们如何在当前使用的以下代码中确定psd中的剪切蒙版层。
我尝试了这个How to identify clipping masks in Photoshop using JavaScript
但这是行不通的。
for (var x = 0; x < layers.length; x++) {
var layerindex = layers[x];
doc.activeLayer = doc.artLayers[x];
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
if(desc.hasKey(charIDToTypeID('GrpL'))){
alert("this is Clipping Mask Layer");
}
}
最佳答案
var doc = activeDocument,
layers = activeDocument.layers;
for (var x = 0; x < layers.length; x++)
{
doc.activeLayer = doc.layers[x];
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var desc = executeActionGet(ref);
if (desc.hasKey(charIDToTypeID('Grup')) && desc.getBoolean(charIDToTypeID('Grup')))
{
alert("this is Clipping Mask Layer: " + doc.activeLayer.name);
}
}
关于javascript - 如何使用JavaScript不带比例的Photoshop识别剪贴蒙版?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56668542/