pytiled_parser icon indicating copy to clipboard operation
pytiled_parser copied to clipboard

Ability to parse map from already loaded files

Open Cleptomania opened this issue 3 years ago • 1 comments

Currently we are only capable of accepting a file path to parse the map. Instead we should add the ability to pass an already parsed JSON, or a raw JSON string for example. This may have some implications for how we find the tileset files for external tilesets. What is likely is that the user will have to define any external tilesets to the parse function, in a dictionary that maps the tileset to whatever it’s filepath in the map object is.

Tiled stores the reference to tileset and image objects as relative to the map file, so one solution is to also accept a filepath alongside this and use that instead of deriving the parent directory of the map file.

Cleptomania avatar Oct 01 '22 16:10 Cleptomania

The approach of accepting a filepath alongside the JSON dict or XML etree is probably the way to go and should be fairly easy to implement.

Cleptomania avatar Apr 13 '23 00:04 Cleptomania