Compare commits

...

3 Commits

Author SHA1 Message Date
Michele Caini 3615542cdc
Merge 6015ddb79d into 220d2d3a2d 2025-06-24 22:36:52 +00:00
Michele Caini 6015ddb79d
oops 2024-02-04 00:38:05 +01:00
Michele Caini b0e5db7fb3
add sprite user data when exporting documents 2024-02-04 00:24:28 +01:00
1 changed files with 28 additions and 0 deletions

View File

@ -1505,6 +1505,34 @@ void DocExporter::createDataFile(const Samples& samples, std::ostream& os, doc::
<< "\"h\": " << texture->height() << " },\n"
<< " \"scale\": \"1\"";
{
os << ",\n"
<< " \"documents\": [";
bool firstDoc = true;
std::set<doc::ObjectId> includedSprites;
for (auto& item : m_documents) {
if (firstDoc)
firstDoc = false;
else
os << ",";
Doc* doc = item.doc;
Sprite* sprite = doc->sprite();
// Avoid including the same document more than once
if (includedSprites.find(sprite->id()) != includedSprites.end())
continue;
includedSprites.insert(sprite->id());
os << "\n { \"name\": \"" << doc->name() << "\"" << sprite->userData() << " }";
}
os << "\n ]";
}
// meta.frameTags
if (m_listTags) {
os << ",\n"