mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-06 06:58:15 +00:00
Don't duplicate meta data (tags/slices) when -split-layers is used (fix #1582)
This commit is contained in:
parent
4bafbe461a
commit
ae9a8128be
@ -50,6 +50,7 @@
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#define DX_TRACE(...) // TRACEARGS
|
||||
@ -1336,11 +1337,21 @@ void DocExporter::createDataFile(const Samples& samples,
|
||||
os << ",\n"
|
||||
<< " \"frameTags\": ["; // TODO rename this someday in the future
|
||||
|
||||
std::set<doc::ObjectId> includedSprites;
|
||||
|
||||
bool firstTag = true;
|
||||
for (auto& item : m_documents) {
|
||||
Doc* doc = item.doc;
|
||||
Sprite* sprite = doc->sprite();
|
||||
|
||||
// Avoid including tags two or more times in the list (e.g. when
|
||||
// -split-layers is specified, several calls of addDocument()
|
||||
// are used for each layer, so we have to avoid iterating the
|
||||
// same sprite several times)
|
||||
if (includedSprites.find(sprite->id()) != includedSprites.end())
|
||||
continue;
|
||||
includedSprites.insert(sprite->id());
|
||||
|
||||
for (Tag* tag : sprite->tags()) {
|
||||
if (firstTag)
|
||||
firstTag = false;
|
||||
@ -1433,11 +1444,21 @@ void DocExporter::createDataFile(const Samples& samples,
|
||||
os << ",\n"
|
||||
<< " \"slices\": [";
|
||||
|
||||
std::set<doc::ObjectId> includedSprites;
|
||||
|
||||
bool firstSlice = true;
|
||||
for (auto& item : m_documents) {
|
||||
Doc* doc = item.doc;
|
||||
Sprite* sprite = doc->sprite();
|
||||
|
||||
// Avoid including slices two or more times in the list
|
||||
// (e.g. when -split-layers is specified, several calls of
|
||||
// addDocument() are used for each layer, so we have to avoid
|
||||
// iterating the same sprite several times)
|
||||
if (includedSprites.find(sprite->id()) != includedSprites.end())
|
||||
continue;
|
||||
includedSprites.insert(sprite->id());
|
||||
|
||||
// TODO add possibility to export some slices
|
||||
|
||||
for (Slice* slice : sprite->slices()) {
|
||||
|
Loading…
Reference in New Issue
Block a user