-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix image collection id gaps #3864
Comments
Nitpick: You're talking about local tile IDs, not GIDs - the gaps in tile IDs just indirectly create gaps in GIDs as well. You would generally never use a GID as an index into an array of tiles (i.e. anywhere where the gaps would matter), because while multiple Maps may use the same Tileset, they may use different GIDs to refer to those tiles. Why do you "need to" remove the gaps? Is it something to do with how you're storing and accessing the tiles in your code? Regardless of need, I agree that it would be nice to be able to renumber the tiles in "image collection" Tilesets to remove gaps and "bake in" any tile reordering that's been done with the Rearrange Tiles tool. But Tiled would then need to provide some method to update all the maps using those tilesets, which is not as simple as it sounds, because Tiled can't know about the state of any maps that aren't currently open in the editor. Since Tiled has Projects now, perhaps it can prompt whether you'd like to adjust all the maps in the current Project when you choose to renumber tiles. Some discussion related to this is in #2866, which is about "based on tileset image" Tilesets, but perhaps a similar approach could be used for this - both involve some form of oldTile->newTile mapping that is only valid for a single moment in time, after all. In the interim, I'd like to suggest a couple of workarounds you didn't mention in your post:
|
Yes, the performance is not negligible since I'm rendering a huge chunked tilemap, even so it's wasted perfomance since it can be done offline, I need to access the array for every tile, so
This seems like a good solution, I saw your mass replace tiles but it's too manual, as I'm frequently removing and adding tiles to the collection, I find it much easier to just edit the exported tmj. And I don't want to mess with tiled scripts and explode everything. |
The script as linked is indeed "too manual", but the action or the code can easily be incorporated into another script that automates the entire process, and the creation of the mapping from one group of tiles to another is simple to automate. |
Is your feature request related to a problem? Please describe.
Image collections are too bothersome to use because of tile id gaps, you need to remove them in order to index each tile. This must be done as build step (after tiled exports the tmj), or during startup.
Describe the solution you'd like
Tiled before 0.15 (according to the wiki), had consecutive ids. The feature was removed because there was no way to guarantee every map was loaded in order to update its tiles if I got it right. Discuss solutions/workarounds. I'm using a lua script which removes the gaps after exporting, I wouldn't mind a builtin solution along the lines. (Tiled script)
The text was updated successfully, but these errors were encountered: