Multiple tileset tabs with exported tilesets


I’m using the latest snapshot version of Tiled on Windows 7, but this issue has been around for a few versions (as long as I can remember actually). The situation is that I have a .json map, although the problem is also there with tmx files. This map has a number of exported tilesets. When opening the map, Tiled now picks a random number, and shows that many tabs in the tileset window, for a specific external tileset. This random number can differ for every tileset. As an example, I’ve added a screenshot from a map with just 3 external tilesets (animations, ground, rockWalls), which can also be seen in the .json source. But it shows multiple tabs. As far as I’ve noticed, this only happens with exported tilesets.

I can’t delete the tilesets from the extra tabs; the trash-bin icon is greyed-out. When using a tile from one of the extra tabs, the map acts as if I placed a tile from the original tab. So it’s not really a bug, but it is kind of annoying.

Looks like a bug indeed, but to fix it I could really use a way to reproduce it. I have not seen this behavior myself yet so far.

Are you able to reproduce the issue after creating some new files? If not, would you be able to share your files so I can try on them whatever steps you’re taking to run into this issue?

I’ve been puzzling around a bit, and have been able to recreate it, and better understand it. We need two maps, map-A and map-B, and each map has a number of external tilesets, say map-A has set-A. And map-B has set-B.

If only map-A is opened, it just shows the set-A tileset belonging to map-A. When map-B is opened as well, the bug occurs: map-A now also shows the external tilesets set-B. And map-B shows the tileset from map-A.
In the picture from my above post, I indeed have multiple map-files opened, so the extra tabs must be the result from those tilesets also being imported in the other map files.

So put together: have multiple map files open, which have external tilesets. The external tilesets from each opened map also show in other opened map files.

Hmm, right, but that’s actually a feature. Tiled no longer requires you to manually add tilesets to the map, at least not if they are external tilesets which are already open in some way (like a directly opened .tsx file or as part of another map).

The bug as far as I could see is that the tilesets are duplicated. But each external tileset is only supposed to show once. Do you happen to have the same tileset saved in multiple locations?

No, all tilesets have a single image file in the entire project.

Hmm, that’s not what I meant to ask. With “same tileset” I meant multiple .tsx files (or JSON files) that are actually referencing the same tileset image / have the same name. Does that happen in your project?

Just asking because normally only one tileset tab should appear for each tileset, so the only way for multiple tabs showing the same tileset to appear should be to have different files storing the same tileset definition.

In any case I’ll add a tool tip to the tileset tab showing its file name.

I’ve added the tileset file name to the tool tip now and pushed it to the snapshot branch.

Please check if those tabs are actually referring to the same file name, because if so there is a bug.

I’ve searched the project files, and I can’t find a double reference to the tileset images. I also checked it with the tooltip, and indeed it looks to be a bug then:

And this is the content of the file (without animations) referencing just one image:

{ "columns":31,

So, as it turns out there was some unfinished work to be done regarding external JSON tilesets, which were essentially always being loaded again even if another open map had already caused the tileset to get loaded.

I’ve fixed this in the following change and triggered a development snapshot build.

Thanks for all the issues you’re reporting, @M4rw! You’re a great help making sure that the next release works like it should. Please let me know if you find any other odd behavior.

No problem, will do. And thank you for your efforts and this awesome tool! :grinning: