Do you want to work on this issue?
You can request for a bounty in order to promote it!
Terrain Bucket Fill #3614
eishiya posted onGitHub
This has been requested several times in the past on the forum and on Discord: Allow bucket filling an area with a terrain, filling the middle of the shape with the solid terrain as much as possible, and adjusting the edges of the shape to match the terrains of existing tiles.
Some mocked up examples. Let's say we start with this map and a tileset that has Grass, Sand, and Water Terrains. There are Grass-Sand and Grass-Water transitions available.
Here's what we'd get filling the Sand terrain area with the Water terrain:
And if we fill the Grass with Water instead, we'd get one of these results:
In this case, there is no Sand-Water transition, so Terrains had to add Grass between Sand and Water. These different mock-ups differ in whether the transitional terrains are added within the filled region so some of what we wanted to be Water is changed to Grass instead, or whether they expand the filled region so that all the previously Grass terrains are now Water but some of the neighbouring terrains are modified. I personally prefer the first option, but I included both mock-ups for others to give their opinion on. Edit: Maybe both can be made available, with changing only the fill region being default, and changing outside the region to ensure the fill region is entirely filled with the desired terrain being used with Ctrl.
This feature can probably entirely replace the current "Terrain Fill Mode" on the Bucket Fill Tool, as that mode is generally not useful. Perhaps the current random-terrain behaviour could be used if both the Terrain Fill Mode and Random Mode are enabled.
One open question is what Tiled should fill the bulk of the shape with if there are no tiles that have the chosen terrain on all relevant sides. I guess Tiled could do whatever it does in Ctrl+Terrain mode in that case. which can occasionally result in the centre of the shape being empty or unchanged. A better solution would be to find some pattern of terrains that can cover as many of the relevant edges/corners in the terrain as it can. For example, if I have an edge terrain that's just horizontal sections of fence, I'd expect this sort of fill (here, I'm using Empty-Grass and Empty-Fence transition tiles):
Related feature: Terrain shape fill (#3047). In the end, both of these features would fill some arbitrary shape with a terrain, the difference is where that arbitrary shape comes from. I think they can probably share a lot of code, and they should have the same behaviour regarding multi-terrain transitions.
Credits: Tileset from here, full credits are linked in the description.