Copy link to clipboard
Copied
Hi, I want to know how to export different layer combinations. I'm setting up character sprites for a video game, and I would like to mix and match different facial parts to make a variety of expressions.
Here is how the layers are set up:
This is how the folders look when opened:
The idea is to mix and match these parts to create different expressions. For example:
These are two possible combinations out of 216 total.
I tried to use this script: GitHub - mechanicious/photoshopCompositionComposer: Automate the process of creating design composit...
However, it would always export only the first 2 combinations. I spent quite a few hours trying to get it to work. The "Layer Composition" feature is near useless, as I have to make every possible combination visible, then save it. Is there a way to automate this? Thank you!
You are right for automation, it can be done even using actions but is it worth? Perhaps if you need for at least several characters to animate, otherwise you will spend more time recording action then creating layer comps. If you have lots of similar files then I can try to explain to you how to record action but keep in mind that every file must have layers with exact same names or at least same order and same layer count in order to record action for such task. It is worthless even to think a
...Copy link to clipboard
Copied
Have you tried with Window > Layer Comps to save layer comps with different expressions then to save them as separate files using File > Export > Layer Comps to Files?
There is no other way to explain to software what you want using built in features, at least from what I know about that topic.
Copy link to clipboard
Copied
You would need to design some Process that cans be scripted to produce the output file you want. Like use the layer stacking order within groups. Where only one layer in each group will be visible in the output character image. First the top layer in each group on and output a character sprite.Then them off and next one down the stack on. The output filename would character name + first group layer name. There need to be some logical way to know which layers should be in visible for each of the 216 sprite ,
Or create 216 layer comps for each character document and export layer comps to files
Copy link to clipboard
Copied
You are right for automation, it can be done even using actions but is it worth? Perhaps if you need for at least several characters to animate, otherwise you will spend more time recording action then creating layer comps. If you have lots of similar files then I can try to explain to you how to record action but keep in mind that every file must have layers with exact same names or at least same order and same layer count in order to record action for such task. It is worthless even to think about with only one file in question.
If nothing else, you can automate layer comp creation. Record action to create layer com and assign keyboard shortcut to play action. Manage layer visibility then play action... You can also turn on modal for Make layer comp step to be able to name layer comp or just record step and play action which will be creating layer comps with generic names.
Copy link to clipboard
Copied
I tried to write a script, but I really struggle with Photoshop... I have JS experience but Photoshop script is hard for me.. dont know why. Anyway, thank you for your replies, I will keep trying.
Copy link to clipboard
Copied
You can walk through the layers with a script using a loop, and show/hide layers as you go. Leave the base layer on and turn on and off the ones you want varied, then export.
Copy link to clipboard
Copied
This is a script I use to export text layers to a file. Note the for loop and test for LayerKind. Your script would have different logic but otherwise be similar.
#target photoshop
textCopier2();
function textCopier2(){
if(documents.length > 0){
var originalDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.ERROR;
try{
var fleLogFile2 = new File('~/Desktop/textExport2.txt');
fleLogFile2.open('a:');
for(var j = 0; j < documents.length; j++){
var docRef = documents
var exportLine = docRef.name;
for(var i = 0; i < docRef.artLayers.length; i++){
var LayerRef = docRef.artLayers;
if(LayerRef.kind == LayerKind.TEXT){
var layerText = LayerRef.textItem.contents;
layerText = layerText.replace('\r', ',');
layerText = layerText.replace(/,/g, '\r' + exportLine + '\t');
exportLine = exportLine + '\t' + layerText;
fileWriter2();
}
}
}
function fileWriter2(){
fleLogFile2.writeln(exportLine);
exportLine = docRef.name;
}
fleLogFile2.close();
}
catch(e){
alert(e + e.line);
}
app.displayDialogs = originalDialogMode;
}
}
Copy link to clipboard
Copied
Try this
https://abdulkarimmia.blogspot.com/2021/04/batch-save-by-layer-combination-photoshop-script.html
Find more inspiration, events, and resources on the new Adobe Community
Explore Now