Repository navigation
feat: Inherit template values, translate template gids and copy external tileset version - #98
Merged
Merged
Conversation
# Description When an external tileset is merged into the tileset entry of the map, `version` and `type` were the only attributes that were not copied over, so a map tileset backed by a `.tsx` file always reported the default version `1.0`. Stacked on #72 (base branch `spydon/tsx-provider` mirrors its head). Once #72 is merged this PR will be rebased onto `main`. ## Checklist - [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc). - [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs. - [x] I have updated/added tests for ALL new/updated/fixed functionality. - [x] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`. - [ ] I have updated/added relevant examples in `examples`. ## Breaking Change - [ ] Yes, this is a breaking change. - [x] No, this is *not* a breaking change. ## Related Issues Follow-up to #72. <!-- Links --> [Contributor Guide]: https://github.com/flame-engine/flame/blob/main/CONTRIBUTING.md [Conventional Commit]: https://conventionalcommits.org https://claude.ai/code/session_01LxYRD4TGF9St5Cmj7h1GNe
…97) # Description Completes template support from #72. Until now an object that referenced a template only carried the parsed `Template`, while its own values stayed at their defaults and the gid of the template was unusable since it refers to the tileset of the template file, not to the tilesets of the map. - `TiledObject.parse` inherits every value the object does not specify itself (`name`, `type`, `width`, `height`, `rotation`, `visible`, `text`, shape, polygon and polyline) from the object of the template, and merges the properties of the template with the ones of the object, where the object wins. This is what Tiled writes: an instance only contains what differs from its template. - `TiledMap.parse` translates inherited gids to the tilesets of the map afterwards, keeping the flip flags. When the map does not contain the tileset of the template it is added to `TiledMap.tilesets` with the next free `firstgid`, like Tiled does when loading such a map. An object that specifies its own `gid` keeps it. `TiledObject.gid` stays null for an inherited gid until the map translates it, so parsing a layer on its own never produces a gid that points into the wrong tileset. - Tilesets are matched by `source`, which is now always stored relative to the map, also for tilesets referenced from template files in other directories. `TiledObject.templatePath` follows the same rule. Added `Parser.resolvePath` for that. - Adds `Gid.flagMask`. Stacked on #96 (which is stacked on #72). Once those are merged this PR will be rebased onto `main`. ## Checklist - [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc). - [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs. - [x] I have updated/added tests for ALL new/updated/fixed functionality. - [x] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`. - [ ] I have updated/added relevant examples in `examples`. ## Breaking Change - [ ] Yes, this is a breaking change. - [x] No, this is *not* a breaking change. `Tileset.source` of tilesets referenced from template files changes from the path as written in the template to the path relative to the map, which is what #72 already documents for provider paths and what nobody could rely on before, since those tilesets were never resolved. ## Related Issues Follow-up to #72 and #73. <!-- Links --> [Contributor Guide]: https://github.com/flame-engine/flame/blob/main/CONTRIBUTING.md [Conventional Commit]: https://conventionalcommits.org https://claude.ai/code/session_01LxYRD4TGF9St5Cmj7h1GNe
erickzanardo
approved these changes
Aug 31, 2026
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.
Description
#96 and #97 were merged into
spydon/tsx-providerinstead ofmain, and #72 was squash-merged before they landed on that branch, so their changes never reachedmain. This PR cherry-picks both commits on top ofmain.Included:
versionandtypefrom external tilesets when merging them.gids are translated to the tilesets of the map, and the tileset of a template is added toTiledMap.tilesetswhen the map does not contain it, like Tiled does. External tileset and template paths are now resolved relative to the map.Checklist
fix:,feat:,docs:etc).docsand added dartdoc comments with///.examples.Breaking Change
Related Issues
Re-lands #96 and #97 on
main.