mirror of https://github.com/aseprite/aseprite.git
Merge f160b27aa5
into 2ba051b59b
This commit is contained in:
commit
257e2b7b57
|
@ -273,6 +273,7 @@ Doc* generate_sprite_sheet_from_params(DocExporter& exporter,
|
|||
exporter.setSplitTags(splitTags);
|
||||
exporter.setIgnoreEmptyCels(ignoreEmpty);
|
||||
exporter.setMergeDuplicates(mergeDuplicates);
|
||||
exporter.setSelectedTag(tagName);
|
||||
if (listLayers)
|
||||
exporter.setListLayers(true);
|
||||
if (listTags)
|
||||
|
|
|
@ -1529,6 +1529,10 @@ void DocExporter::createDataFile(const Samples& samples, std::ostream& os, doc::
|
|||
includedSprites.insert(sprite->id());
|
||||
|
||||
for (Tag* tag : sprite->tags()) {
|
||||
// Ignore unselected tags if we picked a specific one.
|
||||
if (!m_selectedTagName.empty() && m_selectedTagName != tag->name())
|
||||
continue;
|
||||
|
||||
if (firstTag)
|
||||
firstTag = false;
|
||||
else
|
||||
|
@ -1539,12 +1543,22 @@ void DocExporter::createDataFile(const Samples& samples, std::ostream& os, doc::
|
|||
format = "{tag}";
|
||||
}
|
||||
|
||||
frame_t fromFrame = tag->fromFrame();
|
||||
frame_t toFrame = tag->toFrame();
|
||||
|
||||
// Reset the frame offset when we're only exporting one frame tag so they're consistent
|
||||
// with the exported frame list.
|
||||
if (!m_selectedTagName.empty()) {
|
||||
toFrame = toFrame - fromFrame;
|
||||
fromFrame = 0;
|
||||
}
|
||||
|
||||
FilenameInfo fnInfo;
|
||||
fnInfo.filename(doc->filename()).innerTagName(tag->name());
|
||||
std::string tagname = filename_formatter(format, fnInfo);
|
||||
os << "\n { \"name\": \"" << escape_for_json(tagname) << "\","
|
||||
<< " \"from\": " << (tag->fromFrame()) << ","
|
||||
<< " \"to\": " << (tag->toFrame())
|
||||
<< " \"from\": " << fromFrame << ","
|
||||
<< " \"to\": " << toFrame
|
||||
<< ","
|
||||
" \"direction\": \""
|
||||
<< escape_for_json(convert_anidir_to_string(tag->aniDir())) << "\"";
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
void setListLayers(bool value) { m_listLayers = value; }
|
||||
void setListLayerHierarchy(bool value) { m_listLayerHierarchy = value; }
|
||||
void setListSlices(bool value) { m_listSlices = value; }
|
||||
void setSelectedTag(const std::string& tagName) { m_selectedTagName = tagName; }
|
||||
|
||||
void addImage(Doc* doc, const doc::ImageRef& image);
|
||||
|
||||
|
@ -153,6 +154,7 @@ private:
|
|||
std::string m_textureFilename;
|
||||
std::string m_filenameFormat;
|
||||
std::string m_tagnameFormat;
|
||||
std::string m_selectedTagName;
|
||||
int m_textureWidth;
|
||||
int m_textureHeight;
|
||||
int m_textureColumns;
|
||||
|
|
Loading…
Reference in New Issue