Closed jpeletier closed 1 year ago
@jpeletier: I'll have a detailed look into your PR and a proper review tomorrow, but thank you very much for your work😄 I've skimmed through the code tho, and can at least say you've done a nice effort to solve the problem in a clean way, for sure!
@SSBMTonberry Thank you for your comments. Awaiting your review to see what changes are needed. I tried to do my best to place things where I thought made sense, but there will be for sure better places or approaches. I have this already working in our internal fork with our application and is running fine. Cheers!
@jpeletier: Sorry for the delay. I didn't get time to do the review yesterday :disappointed:
I am very satisfied with your solution to the problem! The code is clean, and you have solved the problem in a nice manner. Only thing missing is to run the script to generate the tileson.hpp
and tileson_min.hpp
single header files.
To do this you simply go into the tools
folder and run one of these scripts in a terminal / cmd promt:
amalgamate_script.bat
amalgamate_script.sh
amalgamate_osx.sh
If you could do that, it would be nice :slightly_smiling_face:
Will approve this anyway, though, but I'd have to generate the files myself if you don't do it :stuck_out_tongue_winking_eye:
Ideally the generator for these files should be in a more automated process, but as it stands it's not. I might create an issue on that to make it into the next minor version of Tileson
.
Thank you very much for your contribution! Much appreciated! :pray:
@SSBMTonberry done!
@jpeletier: Perfect! :muscle:
Fixes https://github.com/SSBMTonberry/tileson/issues/100
This PR implements parsing of referenced template map objects within map files.
Tiled allows the concept of reusable objects or "templates" that can be instantiated into a map. To that effect, Tiled stores in a template file a JSON representing the object's base properties. When these template objects are instantiated, the map file only keeps a reference to the source JSON template file, plus any overriden properties.
When parsing a Tiled map's map objects, Tileson would only report the overriden properties, but not the object template's base properties.
This PR fixes that by parsing template files and returning a map object where all the base properties have been merged with the instance's properties the way that Tiled shows in its UI.