Skip to content

Commit

Permalink
Lua plugin: Don't embed external tilesets
Browse files Browse the repository at this point in the history
Just writes out their name and relative file name. If embedding is
desired, the "Embed tilesets" option can be enabled in the export
preferences.

For those exporting their tilesets as separate files, a relative
"exportfilename" property is also included.

Closes #2120
  • Loading branch information
bjorn committed Dec 16, 2020
1 parent b30d37f commit 56033ba
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/plugins/lua/luaplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,25 @@ void LuaWriter::writeTileset(const Tileset &tileset,
}

mWriter.writeKeyAndValue("name", tileset.name());
if (embedded)
if (embedded) {
mWriter.writeKeyAndValue("firstgid", firstGid);

if (!tileset.fileName().isEmpty() && embedded) {
const QString rel = mDir.relativeFilePath(tileset.fileName());
mWriter.writeKeyAndValue("filename", rel);
if (tileset.isExternal()) {
const QString rel = mDir.relativeFilePath(tileset.fileName());
mWriter.writeKeyAndValue("filename", rel);

// For those exporting their tilesets separately, it could be
// helpful to include a relative reference to the exported file as
// well. For consistency I decided to include this separately from
// the "filename".
if (!tileset.exportFileName.isEmpty()) {
const QString rel = mDir.relativeFilePath(tileset.exportFileName);
mWriter.writeKeyAndValue("exportfilename", rel);
}

mWriter.writeEndTable(); // tileset
return;
}
}

/* Include all tileset information even for external tilesets, since the
Expand Down

0 comments on commit 56033ba

Please sign in to comment.