tiled
tiled copied to clipboard
Rearrange Tiles (Swap) + Rearrange Tiles (Displacement)
Currently, the rearrange tiles feature uses displacement, which is not ideal for single image tilesets. Larger objects comprised of multiple tiles like trees are pre-arranged on rows to be together. This all gets shifted out of position with displacement. Displacement and Swap should be separate available techniques.
This is a critical issue for my use case. I really need the Swap!
I'm reverse engineering TSX tile sets from retro games to help artists make graphic packs.
I challenge you to rearrange the attached tsx tile set using the current mode!

@lilo-san I would suggest you create a map and place each tile on the map in the arrangement you'd like, and then export that map as an image to create the re-arranged tileset. The ability to change the order of the tiles in Tiled wasn't meant to cover this use-case.
This issue is about adding a swap action in addition to the displacement. Currently, a swap needs to be done in two steps, but it could be more efficient if swap could be done directly. However, even with a swap action, rearranging your tileset should be a lot easier if you use a tile layer.
Hi @bjorn, thanks for the suggestions.
If a tsx file has metadata properties they will be lost when going the map route.
On the another hand the two step swap is a bit clunky at best.
Any way I can encourage tackling this issue or is just not happening?
If a tsx file has metadata properties they will be lost when going the map route.
That's true, though a script could be written to adjust these, say by using two layers on a map with one layer having the tiles in their old arrangement and the other layer in the new arrangement.
Any way I can encourage tackling this issue or is just not happening?
If the swap action would help you, one way to encourage tackling this issue (beyond explaining the need, like you are doing already), is by putting a bounty. You can do this at Rysolv, by importing this issue at https://rysolv.com/issues/add and then adding the bounty. I may handle it, but that could also encourage other contributors. :-)
lilo-san has contributed $5.00 to this issue on Rysolv.
The total bounty is now $5.00. Solve this issue on Rysolv to earn this bounty.
lilo-san has contributed $5.00 to this issue on Rysolv.
The total bounty is now $10.00. Solve this issue on Rysolv to earn this bounty.
A quick note when implementing the swap:
When a tile set is made by several images, these can be considered organised.
When a tile set is made by a single image the underlining png image with the tile set should ideally also reflect the logical order.
This would facilitate the labor of pixel artists than can open a well organised file on their editors.
Modifying the source image is out of scope for this issue, though. It also would affect the tile IDs, which breaks maps that have already been created using the tileset. The "rearrange tiles" feature specifically avoids changing the tile IDs and just changes their display order. One approach to allow for the image to be modified while keeping tile IDs stable is covered by issue #2863.
Understood. As you point out it also requires to fix the maps.
I'm going to include a transformation rule in my tool so both tile sets and maps get fixed together.
Sometimes I wish have the patience to write these things in C++ so you can pick them for Tiled, sure more people want these features.
sure more people want these features.
Tiled already has metatilesets, which let you rearrange your tileset in a map, and then use that map as the source of a new tileset. If that's too much indirection, the hopefully-planned scratch pad panel feature would let you use the rearranged map to sample the tiles directly, without having to make another tileset from it. There are already Tiled scripts to aid in updating maps after a tileset image is rearranged. Eventually we'll also get a "spritesheet" tileset type, which will let you easily change which segment of an image a given tile uses, so that maps don't need to be modified at all.
Modifying images is out of scope for Tiled IMO, but it's already not a significant problem because there are tools available both to reduce the need to modify images, or to work with images that have been modified. And once spritesheet-type tilesets are implemented, image modifications should be no trouble at all.
Lastly, I can't speak for your artists, but I'd much prefer to do my tileset rearranging in the same software I use to design the tileset, and not in a separate program like Tiled xP So, modify image -> adjust tileset and/or maps seems a more intuitive flow for me than modify tileset -> adjust image.
The "rearrange tiles" feature specifically avoids changing the tile IDs and just changes their display order.
I think this is a big design mistake. It's not THAT hard to bucket fill the map until it looks right again (non-contiguous fill would be even faster). Trying to create some "id of an id" system is more complicated, and it seems like there would be issues if you reduced the size of the tileset in photoshop or removed tiles that once had ids. There's just no getting around the aftermath of seriously editing tilesets.
(non-contiguous fill would be even faster).
Tiled already has this: you can Select Same Tile (which is just non-contiguous magic wand), and then shift+Bucket Fill.
The reason the rearrange tiles tool was added and works the way it does was because a lot of people asked for it. While I also don't care for it, the fact is a lot of people use finished tilesets (e.g. stock tilesets) that they just want to arrange into a more useful configuration to them, without breaking existing maps or modifying the image in an image editor that they might not even have. The arrange tiles tool also allows multiple level designers to use the same tileset image in different arrangements based on their own taste, while producing completely compatible maps. Although you say it's not "that hard to bucket fill the map until it looks right again", it's actually nigh impossible when you're using a large tileset and more than a few tiles have changed IDs. There are scripts that can help with this (e.g. my mass tile replacer), but when the goal is just to use arrange tiles a little more conveniently, then having to use such additional tools (on potentially hundreds of maps!) is not ideal.