Repository navigation
Resolve template tileset source relative to the template file - #187
Merged
Merged
Conversation
Tiled writes the tileset source inside a .tx file relative to the template, but it was resolved against the map directory, so a template in a subfolder failed to load its tileset. The template path itself was built with map dir + "/", which became "/templates/x.tx" when the map was loaded from the current directory. Use resolveFilePath for both.
Owner
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Object templates in a subfolder could not load their tileset.
Tiled writes
<tileset source>inside a.txfile relative to the template file, butparseTemplateresolved it against the map directory.Loading
data/maps/m.tmxbefore this change:The template path was also built as
getWorkingDirectory() + "/" + path, so loadingm.tmxfrom its own folder (empty working dir) tried/templates/enemy.tx:Both now go through
resolveFilePath, and the template tileset gets the template's directory as its working dir. Templates next to the map resolve exactly as before.Tested with MinGW g++ on Windows: the case above loads from
data/maps/m.tmx, from insidedata/maps, and with an absoluteC:\...path. ParseTest output is identical before and after (all resolveFilePath checks OK).