Ausgabe
Gibt es eine Möglichkeit oder ein Skript zum Kopieren der Ebene auf alle Zeichenflächen in Photoshop?
Vielen Dank im Voraus, da ich keine Lösung finden konnte
Lösung
Zeichenflächen sind nur spezialisierte Ebenengruppen, auf die mit der Eigenschaft document.layerSets abgezielt werden kann. In diesem Arbeitsbeispiel (getestet und in Adobe PS CC 2019 ausgeführt) gehe ich davon aus, dass es 1 Ebene gibt, die wir kopieren, und jede Zeichenfläche bereits 1 Ebene enthält. Eine visuelle Demo finden Sie in diesem Screencast-GIF: https://www.rebel-ist.com/img/example/duplicateArtboards.gif
var doc = app.activeDocument;
// assumes your bottom most artboard in the layer tree contains the layer you want to copy from AKA Artboard 1
var artBoardToCopyFrom = doc.layerSets[doc.layerSets.length - 1];
// assumes there is only 1 layer in this artboard that we need to target
var layerToCopy = artBoardToCopyFrom.layers[0];
// set that layer as the active layer
doc.activeLayer = layerToCopy;
// select all
doc.selection.selectAll();
// copy the selection
doc.selection.copy();
// loop through each layerSet aka artboard except the last one -- no need to paste an additional copy into the bottom most layerSet
for (var g = 0; g < doc.layerSets.length - 1; g++) {
// set layer 0 in this group as the active layer -- again assumes there is only one layer in each artboard
doc.activeLayer = doc.layerSets[g].artLayers[0];
// select all
doc.selection.selectAll();
// paste into selection aka create new layer and paste with mask
doc.paste(true);
}
Beantwortet von – InternetRebel
Antwort geprüft von – Katrina (FixError Volunteer)