Hi, I have this script that will create layer comps from layers or folders.
The only problem is that it turns on both positioning and blending checkbox options for each layer comp it creates.
Is it possible to only turn on visibility, not positioning/blending checkbox options?
here's the code:
Code: Select all #target Photoshop
function main(){
if(!documents.length) return;
var doc = activeDocument;
for(var c =0; c<doc.layers.length;c++){
doc.activeLayer= doc.layers[c];
doc.activeLayer.visible=false;
}
for(var a=doc.layers.length-1;a > -1;a--){
doc.activeLayer= doc.layers[a];
if(doc.activeLayer.isBackgroundLayer) continue;
doc.activeLayer.visible=true;
var Name = doc.activeLayer.name;
doc.layerComps.add(Name, "",true, true, true);
doc.activeLayer.visible=false;
}
doc.layerComps[0].apply();
}
main();
Auto Layer Comp Script
Auto Layer Comp Script
In ExtendScript Toolkit please check out
Help > Object Model Viewer
select your version of Photoshop and then select »LayerComps« in the Classes.
If you look up the Method »add« you should be able to figure out what the various boolean arguments in the line
Code: Select all doc.layerComps.add(Name, "",true, true, true);
in your code affect and which one/s you may want to change to »false«.
Good luck!
Help > Object Model Viewer
select your version of Photoshop and then select »LayerComps« in the Classes.
If you look up the Method »add« you should be able to figure out what the various boolean arguments in the line
Code: Select all doc.layerComps.add(Name, "",true, true, true);
in your code affect and which one/s you may want to change to »false«.
Good luck!
-
- Posts: 1
- Joined: Wed Aug 23, 2017 5:48 pm
Re: Auto Layer Comp Script
A correction is needed to get this to work properly
Code: Select all
#target Photoshop
function main(){
if(!documents.length) return;
var doc = activeDocument;
for(var c =0; c<doc.layers.length;c++){
doc.activeLayer= doc.layers[c];
if(doc.activeLayer.isBackgroundLayer) continue; //added this line
doc.activeLayer.visible=false;
}
for(var a=doc.layers.length-1; a > -1; a--){
doc.activeLayer= doc.layers[a];
if(doc.activeLayer.isBackgroundLayer) continue;
doc.activeLayer.visible=true;
var Name = doc.activeLayer.name;
doc.layerComps.add(Name, "",true, true, true);
doc.activeLayer.visible=false;
}
doc.layerComps[0].apply();
}
main();