Do you want to work on this issue?
You can request for a bounty in order to promote it!
Switching tilesets overwrites current brush #3654
eishiya posted onGitHub
When switching tilesets in the Tilesets panel, the brush is set to the currently selected tiles in that tileset. This overwrites any currently set brush, and if the tileset previously had multiple tiles selected, as happens when painting with a larger brush, it's overwritten by the arrangement of those tiles in the tileset, which is rarely useful.
To Reproduce This requires that at least two tilesets are available in the Tilesets panel.
- Sample some tiles from a map into a brush, or choose a saved stamp. For the clearest results, this brush should consist of tiles that aren't all together in the tileset.
- Go to another tileset tab.
- Observe that the brush you just spent time making has been overwritten by whatever tiles were selected in that tileset.
- Switch back to the previous tileset.
- Observe that your brush is again changed, this time to the relevant tiles from your sampled brush, but as they occur in the tileset rather than your original brush.
Expected behaviour Switching to a different tileset should not modify the brush if doing so would be destructive or would be likely to produce a garbage brush. I can think of two concrete ways to make this decision:
- Simple: Do not modify the current brush if it has an area larger than 1x1 or has more than one layer. This would prevent complex brushes from being overwritten, but would also result in "false positives" - for example, if I select a 3x3 tree in Tileset A and switch to Tileset B where previously had a 5x5 house selected, I probably wouldn't mind having my tree overwritten by that house, and then having the house overwritten by the tree when I switch back to Tileset A. It would also overwrite 1x1 brushes that have been flipped/rotated, but this is not a big loss. Lastly, it would still produce nonsense brushes like in the above GIF, if the previous brush was a single tile - you wouldn't lose anything, but you'd still get garbage.
- Complex: Do not modify the current brush if the tile(s) in the newly selected tileset and/or in the current brush were selected by means other than manually selecting from a tileset or sampling a single tile from a map/selecting a single-tile, single-layer stamp. Brushes with multiple layers or using tiles from multiple tilesets should never be overwritten. This would prevent the aforementioned false positives, because it would allow Tiled to distinguish between multi-tile arrangements selected from the tileset by the user (=probably sensible) from multiple tiles that are selected from being in some other arrangement in a map or stamp. This one would probably not overwrite any brush that has been flipped, for better or worse. This one can be further improved by counting map selections and saved stamps that are identical to the tiles' arrangement in the tileset as direct selections. Perhaps trivial flips can also be ignored (i.e. if you select a bunch of tiles from a tileset and flip them, that can count as a simple brush that can be overwritten).
The above GIF is from Tiled 1.10.1 64-bit on Windows 10, but I'm pretty sure this has been happening since 1.8 and quite likely much earlier.
This is a usability problem rather than a bug, but it sure feels like a bug when your brush gets mangled by switching tilesets xP