mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.28k stars 1.76k forks source link

Search and replace #3335

Open ghost opened 2 years ago

ghost commented 2 years ago

Is your feature request related to a problem? Please describe. A way to easy replace a tile (or tiles) by another. This feature does not exist at all.

Describe the solution you'd like

I don't know if multiple tilesets can be used for source and/or destination. But all properties of a tile like collisions, ... Should be cloned in the destination tile.

This feature lets you edit existing maps quickly. The feature could be expanded by allowing multiple source -> destinations operations happening after each other by entering a queue of them. An even more: queues could be saved to a file to load and apply to many maps (using the same tilesets). In this way you could run replacement 'batches' on your maps to edit them in the same way.

UliAbo commented 2 years ago

Very well described, ghost. Thanks for bringing this up, I think this would make it easier to maintain existing Maps. Especially, when you have lots of them.

bjorn commented 1 year ago

Currently a simple "search & replace" for tile layers is only possible per-layer using the following tools:

Another option is to use Automapping rules that use the same input and output layer to search & replace tiles, but it's not ideal since each layer currently needs to be named explicitly.

Finally, there is the MassReplaceTiles.js extension by @eishiya to help with replacing tiles in general, which scales well for executing many replacements over many layers and even multiple maps.

eishiya commented 1 year ago

Currently a simple "search & replace" for tile layers is only possible per-layer using the following tools:

  • Use "Select Same Tile" to select all occurrences of a certain tile.

  • Select replacement tile.

  • Use "Bucket Fill Tool" with Shift modifier to fill the entire selection.

It's worth mentioning this method and Automapping treat every rotation/flip as if it were a separate tile, so if you want to replace all instances of a particular tile regardless of its rotation, you may have to do this up to eight times per layer xP The MassReplaceTiles script bjorn linked above will replace tiles regardless of orientation, resolving the current orientation with the replacement's orientation.

However, I think my Replace Tile Tool is closer to what OP wanted - unlike the mass replace tiles script, this one respects your selection (area and layers; though it can optionally ignore both if you hold Shift), and it just lets you pick your replacement tile and then click an instance of the tile you want to replace, and while you hover, it shows a preview of the tiles that would be replaced, which I think is more informative than a tile count.

ghost commented 1 year ago

Will this be implemented then? So it's easy to use and for all layers?