How can I fill an Object up with a Terrain Set?

You would have to script this, correct.

The tile-rectangle example uses your current brush (which is stored as its own little TileMap) to decide what to paint, it’s basically like an impromptu simplified terrain definition.

I’d previously tried writing a tool to make it easy to draw big rectangles filled with a given Terrain, but ran into the problem that scripting has no way to access which Terrain or TerrainSet is currently selected in the GUI. A way around it would be to require the user to select a tile and its its wangId to decide what Terrain to paint with. You’ll still need some way to decide which WangSet to use though, some tiles may be labelled in multiple sets.

The scripting API also offers no way to find a tile by wangId, so you’d need to search by iterating all the tiles, or build your own data structures sorted by wangId.

As you said, you’ll need to reimplement the Terrain logic yourself. Since you know the shape you’re building though, you can probably implement a simpler version that just places a bunch of tiles that have wangId = all corners and/or edges are of the desired colour and then adjusts the edges of the shape to match the surrounding tiles where such tiles are available.

1 Like