mapeditor / tiled

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

Make stamps part of the tileSet file #3145

Open sdsnatcher opened 3 years ago

sdsnatcher commented 3 years ago

Currently, stamps are saved in a .stamps file inside the Tile config folder. This approach has many limitations:

  1. You cannot easily distribute the stamps for other persons of the team who only edit maps.
  2. The stamp files even have absolute paths to the tileSet, so if you need to move the tileSet to some other folder, the stamps might break

So, IMHO, the best approach to stamps would be:

  1. Make the stamps part of the tileSet (.tsx) file, since they only make sense with the respective tileSet
  2. Allow each stamp variation to have their own name
  3. Add a flag to select wether a stamp is enforceable or not. IOW, when the "enforceable" flag is enabled, individual tiles of the stamp cannot be used separately, since they form a single object: Selecting one tile of the stamp on the tileset will always automatically select all the tiles of the stamp. OTOH, when the "enforceable" flag is disabled, any of the stamp files can be freely selected on the tileSet. The "enforceable" flag also wouldn't allow the stamps to be partially overwritten on the map.
  4. Allow Stamps to easily use transformed tiles: flipped and rotated
bjorn commented 3 years ago

I'm all for making stamps shareable, which I think could be achieved by adding a "stamps directory" to the project settings and using that instead of the global one, as well as storing relative paths in the stamp files.

We could allow naming stamp variations without much trouble I guess.

Storing the stamps inside of the tileset is a little problematic. The most basic problem is, that a tile stamp can use multiple tilesets. But since you're also suggesting a "enforceable" flag, I wonder if it would make sense to introduce a kind of groups within a tileset, such that selecting any tile from that group will by default automatically select the entire group. This feature would be rather separate from the tile stamps feature.

Since currently stamps can already easily use transformed tiles, I'm not sure what you meant with the 4th point.

sdsnatcher commented 3 years ago

Ok, tile groups inside the tileSet is also a good solution. I wasn't aware that stamps could use multiple tileSets.

Since currently stamps can already easily use transformed tiles, I'm not sure what you meant with the 4th point.

Sorry but I couldn't find, in the documentation, how I can do this for stamps. So, how can I do it?

I also could not find a way to rearrange the stamp layout to create more variations from the same tiles.

For example, I have the following tiles:

Tiles

That I would like to arrange some Stamp variations with the following pair combinations:

TileStamps

I created the two diagonal variations and tried to adjust the layout to be side-by-side by manually editing the stamp file, but the layout information is stored on a base64 binary blob that doesn't allow me to do that... It would be nice if grouping could support that too.

eishiya commented 3 years ago

Sorry but I couldn't find, in the documentation, how I can do this for stamps. So, how can I do it?

You would create a stamp (or variation) from a selection with the flipped tiles, just as you would any other stamp.