Sorry for bumping this topic, but I believe I have a use case which got broken by this commit:
When loading tile sets into a tile map from a script, as far as I’m aware, the tile set will be considered embedded (even if it’s simply loaded from an external file). If I now have automapping rules referencing this tile set, these two will not be considered the same anymore, and the automapping rules don’t work. Steps to reproduce the use case:
-
Create automapping rules referencing an external tile set “path/to/my/tileset.tmx”
-
Define script with a map format that creates a tile map using this tile set:
var myMapFormat = {
name: "my Map format",
extension: "mymap",
read: function(fileName) {
var tilemap = new TileMap();
tilemap.setSize(..., ...); // fill in as appropriate
tilemap.setTileSize(..., ...); // fill in as appropriate
var tileset = tiled.tilesetFormat("tsx").read("path/to/my/tileset.tmx");
tilemap.addTileset(tileset);
return tilemap;
},
}
tiled.registerMapFormat("mymap", myMapFormat)
-
Load a map using the newly defined format, place some tiles matching the automapping rules.
-
Try to apply the automapping rules.
This works fine in version <=1.7.1, but stopped working in version >=1.7.2. Commit 5b83b6e
seems like the obvious culprit.
A current workaround for this is to embed the tile set in the automapping rules map,
however that means unnecessarily duplicating data. (It’s not that big of a deal in my
use case as the tile sets are unlikely to change. For reference, my use case: GitHub - geoo89/kidchameleon-tiledextension: Tiled extension for editing Kid Chameleon levels)
I guess the proper solution to this would be to allow explicitly loading external tilesets
without embedding them into the tilemap (something like an ExternalTileset class that behaves like
Tileset but is read-only maybe?)
If you want, I can create an issue on github (feature request or bug, depending
on what you consider this to be.)