mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-29 21:33:12 +00:00
Add support to save multiple files with -save-as {title} etc.
Fixes #2442, fixes #3629, and https://community.aseprite.org/t/16491
This commit is contained in:
parent
5309991d0d
commit
ae6f9c22ba
@ -403,9 +403,7 @@ int CliProcessor::process(Context* ctx)
|
||||
|
||||
// Automatic --filename-format
|
||||
// in case the output filename already contains template elements.
|
||||
bool hasTemplateElement = is_template_in_filename(fn);
|
||||
|
||||
if (hasTemplateElement) {
|
||||
if (is_template_in_filename(fn)) {
|
||||
cof.filenameFormat = fn;
|
||||
// Automatic --split-layer, --split-tags, --split-slices
|
||||
// in case the output filename already contains {layer},
|
||||
@ -420,13 +418,21 @@ int CliProcessor::process(Context* ctx)
|
||||
cof.splitTags = (cof.splitTags || hasTagTemplate);
|
||||
cof.splitSlices = (cof.splitSlices || hasSliceTemplate);
|
||||
}
|
||||
|
||||
// Save all documents
|
||||
for (auto doc : ctx->documents()) {
|
||||
ctx->setActiveDocument(doc);
|
||||
cof.filename = doc->filename();
|
||||
cof.document = doc;
|
||||
saveFile(ctx, cof);
|
||||
}
|
||||
ctx->setActiveDocument(lastDoc);
|
||||
}
|
||||
else {
|
||||
cof.filename = fn;
|
||||
cof.document = lastDoc;
|
||||
saveFile(ctx, cof);
|
||||
}
|
||||
|
||||
cof.document = lastDoc;
|
||||
saveFile(ctx, cof);
|
||||
}
|
||||
else
|
||||
console.printf("A document is needed before --save-as argument\n");
|
||||
|
@ -267,3 +267,12 @@ expect "groups2.png
|
||||
groups3abc.png
|
||||
link0.png
|
||||
link1.png" "list_files $d"
|
||||
|
||||
d=$t/save-as-title-multiplefiles
|
||||
$ASEPRITE -b sprites/groups2.aseprite \
|
||||
sprites/groups3abc.aseprite \
|
||||
sprites/link.aseprite -save-as "$d/{title}-{frame1}.png" || exit 1
|
||||
expect "groups2-1.png
|
||||
groups3abc-1.png
|
||||
link-1.png
|
||||
link-2.png" "list_files $d"
|
||||
|
Loading…
x
Reference in New Issue
Block a user