A possible resolution when a map refers to a no longer available file would be to remove the reference to that file (including any assets or tiles on the map relying on this reference).
Tiled could provide this action as an option in the broken references view (that pops up when opening a map with broken references).
Suggested at http://forum.mapeditor.org/t/art-study-castlevania-legends/1070
First the broken references thing needs to be fixed on the wip/tilesetdocument branch, to avoid creating unnecessary conflicts.
@bjorn, what exactly is being worked upon in the wip/tilesetdocument branch? I'd like to pick this issue as my next conrribution :-)
@ketanhwr That was already done and this branch has been merged into master last year. It was the major reorganization to allow editing of external tilesets.
Why is this issue still open then?
@ketanhwr Because only the thing that needed to be done first is done, not what this task is actually about.
Alright.
This might be a stupid doubt, but there is an Ignore option when it comes to broken links. How exactly is it different from the one you've mentioned in this issue?
This might be a stupid doubt, but there is an Ignore option when it comes to broken links. How exactly is it different from the one you've mentioned in this issue?
"Ignore" means don't do anything and hide the widget, whereas "Remove" would change the map to remove the broken reference (which generally means tiles and tile objects may need to be removed).
So I've started working on this now. When a particular tileset is missing (MapTilesetReference), then I'm using the RemoveTileset class to remove the reference of that tileset.
What exactly is the difference between TilesetTileImageSource and TilesetImageSource? I think I should do the same in both of these cases as well?
After removing that Tileset from the references, I'm thinking of replacing all the Tiles linked with that Tileset with a blank Cell just like the Erase function. Is this fine?
What exactly is the difference between TilesetTileImageSource and TilesetImageSource? I think I should do the same in both of these cases as well?
TilesetImageSource means that the image source for a tileset can't be found. Removing that would mean removing the tileset from the map, which should indeed be the same as handling MapTilesetReference.
TilesetTileImageSource means that an image for one particular tile could not be found. In that case, you don't want to remove the entire tileset but you'd rather want to remove that single tile from the tileset (and clear any usages of that tile on the map). See TilesetEditor::removeTiles for how to do this.
After removing that Tileset from the references, I'm thinking of replacing all the Tiles linked with that Tileset with a blank Cell just like the Erase function. Is this fine?
You will have to do this, yes. See TilesetDock::removeTileset for this and its call to removeTileReferences. It uses a macro to make sure there is only one undo step.