• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Combinaison de calques sauvegardé / saved layers combinaison

New Here ,
Aug 16, 2020 Aug 16, 2020

Copy link to clipboard

Copied

Je dispose d'un dessin d'un personnage, et je dispose de plusieurs calques pour les différentes couleurs de cheveux, de peau, de vêtement, etc... et je souhaites enregistrer toutes les variantes possibles.

Inutiles de préciser qu'individuellement, c'est très peu pas beaucoup faisable, et donc j'aimerai savoir s'il existe un script, une commande ou une option qui permettent d'enregistrer chaque variante du personnage. Si quelqu'un a ça, je suis preneur...
P.S. je suis Francophone et je me débrouille pour l'anglais; si un anglophone donne la solution, je traduirais pour ceux qui dormaient en cours d'anglais.

 

I drew of a character and a lot of layers for each color of his skin, eyes, hairs, and so on... and I wish to save each possible variant . It's needless to say that save and hide all of them individully is almost impossible, so I'd like to know if there's a script, an option, a tool... that can save every variant of my character. If someone has it, I would be happy to know...
P.S. Since I'm French and that I'm good at English, if a french guy give me the answer; I'll translate it in English because I know French isn't very attractive...

 

Merci d'avance
Thanks In advance

TOPICS
Actions and scripting

Views

473

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 20, 2020 Aug 20, 2020

Oui tu peux utiliser les compositions de calques. c'est simple et efficace. Chaque composition enregistre une combinaison donnée  avec claques visibles, effets positions etc qu'en plus tu peux afficher ensuite en mode pleine écran pour présentation

Votes

Translate

Translate
Adobe
Community Expert ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

You omitted to give a meaningful description of the image’s Layer structure, please provide the file in question or at least post a screenshot including the (complete) Layers Panel. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

Capture d’écran (1).pngHere you are

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2020 Aug 20, 2020

Copy link to clipboard

Copied

So am I correct that this would be 192 resulting files? Or would »none« also be an option for each Group? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2020 Aug 20, 2020

Copy link to clipboard

Copied

Oui tu peux utiliser les compositions de calques. c'est simple et efficace. Chaque composition enregistre une combinaison donnée  avec claques visibles, effets positions etc qu'en plus tu peux afficher ensuite en mode pleine écran pour présentation

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2020 Aug 21, 2020

Copy link to clipboard

Copied

En effet, ça a fonctionné à merveille.

 

Merci, j'ai gagné beaucoup de temps grâce à votre astuce.

Voici une vidéo qui m'a également aidé à comprendre et à utiliser les compositions, si quelqu'un d'autre a besoin de cette fonctionnalité:

https://youtu.be/87ka111wNB4

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 27, 2020 Aug 27, 2020

Copy link to clipboard

Copied

You could give this a try: 

// create all combinations of the layers in the groups, one layer from each group;
// 2020, use it at your own risk;
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var docName = myDocument.name;  
try {var basename = docName.match(/(.*)\.[^\.]+$/)[1]} 
catch (e) {var basename = docName};
try {var docPath = myDocument.path}
catch (e) {var docPath = "~/Desktop"};
// collect layers;
var theLayersPerGroups = getGroupLayersIndexAndID ();
// hide;
for (var m = 0; m < theLayersPerGroups.length; m++) {
    var thisGroup = theLayersPerGroups[m];
	showLayers (thisGroup, true)
};
// jpgs;
	processTheGroups (theLayersPerGroups)
};
////// work through the array of arrays of of layers //////
function processTheGroups (theArray) {
////////////////////////////////////
var aaa = new Array;
var xxx = new Array;
for (var x = 0; x < theArray.length; x++) {
	var yyy = new Array;
	for (var y = 0; y < theArray[x].length; y++) {
		var theY = theArray[x][y];
		if (x == 0) {
			xxx.push([theY]);
		}
		else {
			for (var z = 0; z < xxx.length; z++) {
				var aaa = xxx[z].concat([theY]);
				yyy.push(aaa);
			};
		};
	};
	if (x != 0) {xxx = yyy};
};
////////////////////////////////////
var theLength = String(xxx.length).length;
	for (var n = 0; n < xxx.length; n++) {
		showLayers (xxx[n], false);
		savePNG (docPath+"/"+basename+"_"+bufferNumberWithZeros(n, theLength));
//		saveJpg (docPath+"/"+basename+"_"+bufferNumberWithZeros(n, theLength));
		showLayers (xxx[n], true);
	};
};
////////////////////////////////////
function getGroupLayersIndexAndID () {
	var ref = new ActionReference();
	ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
	var applicationDesc = executeActionGet(ref);
	var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
	var theArray = new Array;
	var theGroupLayers = new Array;
	var theDepth = 0;
	var theCount = 0;
////// work through layers //////
	for (var m = theNumber; m >= 0; m--) {
	try {
	var ref = new ActionReference();
	ref.putIndex( charIDToTypeID( "Lyr " ), m);
	var layerDesc = executeActionGet(ref);
	var layerSet = typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("layerSection")));
	var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
	var theName = layerDesc.getString(stringIDToTypeID('name'));
	var theID = layerDesc.getInteger(stringIDToTypeID('layerID'));
	var thisArray = [theName, m, theID];
////////////////////////////////////
// if group start:
	if (layerSet == "layerSectionStart" && isBackground != true) {
		theGroupLayers.push([]);
		theDepth++;
		var aNumber = theGroupLayers.length-1;
	};
	// if group end;
	if (layerSet == "layerSectionEnd" && isBackground != true) {
		theDepth--;
		aNumber--;
	};
	// if neither group start or end;
	if (layerSet != "layerSectionEnd" && layerSet != "layerSectionStart" && theDepth > 0) {
		theArray.push(thisArray);
		theGroupLayers[aNumber].push(thisArray);
	};
	////////////////////////////////////
	}
	catch (e) {};
	};
// the results;
	return theGroupLayers
	};
////// function to png //////
function savePNG (fileName) {
	// weboptions;
	var webOptions = new ExportOptionsSaveForWeb();
	webOptions.format = SaveDocumentType.PNG;
	webOptions.PNG8 = false;	
	webOptions.transparency = true;
	webOptions.interlaced = 0;
	webOptions.includeProfile = false;
	webOptions.optimized = true;
	myDocument.exportDocument(new File(fileName+".png"), ExportType.SAVEFORWEB, webOptions);
	};
////// save jpg copy //////
function saveJpg (fileName) {
// jpg options;
	var jpegOptions = new JPEGSaveOptions();  
	jpegOptions.quality = 9;  
	jpegOptions.embedColorProfile = true;  
	jpegOptions.matte = MatteType.NONE;
	activeDocument.saveAs(new File(fileName+".jpg"), jpegOptions, true);  
};
////// show layer //////
function showLayers (theIDs, showOrHide) {
	for (var m = 0; m < theIDs.length; m++) {
		var theID = theIDs[m][2];
		if (showOrHide == false) {var idHd = charIDToTypeID( "Shw " )}
		else {var idHd = charIDToTypeID( "Hd  " )};
			var desc2 = new ActionDescriptor();
			var idnull = charIDToTypeID( "null" );
				var list1 = new ActionList();
					var ref1 = new ActionReference();
				ref1.putIdentifier(charIDToTypeID( "Lyr " ), theID);
				list1.putReference( ref1 );
			desc2.putList( idnull, list1 );
		executeAction( idHd, desc2, DialogModes.NO );
		}
	};
////// buffer number with zeros //////
function bufferNumberWithZeros (number, places) {
	var theNumberString = String(number);
	for (var o = 0; o < (places - String(number).length); o++) {
		theNumberString = String("0" + theNumberString)
		};
	return theNumberString
	};

 

 

(edit: the Script creates pngs now)

 

From this image the Script produces … Screenshot 2020-08-27 at 16.54.09.png

… these resulting files: 

Screenshot 2020-08-27 at 16.54.26.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2020 Aug 29, 2020

Copy link to clipboard

Copied

LATEST

Another example with the resulting images loaded as layers and animated as a frame animation: 

Screenshot 2020-08-29 at 15.57.42.pngsaveLayerCombinationsAs_B2_results.gif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines