tilecount attribute on tileset property is wrong after resizing texture and resaving tileset
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 12.9k
- Forks
- 2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 8
Description
Hi @bjorn. I've found a small bug with Tiled after a texture in a tileset is resized and we resave the tileset. The columns will get updated but the number of tiles is wrong and we end up with extra, full-on-white, tiles.
To repro: I start with a simple 4x4 tileset in a texture image:

This looks okay in tiled and the xml is correct:

```
```
However, if I skim off a full column of tiles on this texture sheet but only a portion of a row ...

... I am, as expected, told by Tiled that my number of columns has changed.

But, in Tiled, I end up with the wrong number of tiles, with the extra tiles being all white.

And looking at the xml, Tiled still thinks we still have 16 tiles in an image that should only support 9.
```
```
Oddly, this bug only seems to happen if I remove a whole column of tiles from the image. If I were to remove a partial column and row from the image then the number of tiles is correctly set to 9 (in other words, the extra space in the image that doesn't fill a full tile is correctly ignored.)
FWIW, I'm working around this on SuperTiled2Unity so no rush on my part to fix but I thought you'd like to know all the same. Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in Tiled with the 4x4 tileset and the resized image described in the report, then inspect the saved tileset XML. Done means a resized image with three columns and a partial final row reports tilecount 9 and does not show extra white tiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100