You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It was found out that the map editor found in tools\editor.py cannot save correctly to xml a map if the xml contains other elements than rectmap. A workaround was to include such elements using the requires tag.
The text was updated successfully, but these errors were encountered:
Digging in the problem raised many questions. Do we want to be able to load a .tmx file and be able to save it to *.xml ? It's quite a challenge to do so. Do we want to be able to change the resource in any way we can think of and still be able to save as XML representation ?
At the moment, the editor sole purpose is to edit the RectMapLayer. We add or remove Tiles in the map. The RectMapLayer can save itself correctly to xml. So I decided to only update the rectmap tag in the original xml file with whatever RectMapLayer._as_xml method is providing. Any other tags like tileset, image, imagealtas, ... are left unchanged.
I have also changed a bit the way the code was structured. I found it strange that the load_tiles function would instantiate a Resource object but then parse itself the XML file to give it to the Resource file. I thought all this logic should go in the Resource class. Recognizing that there are difference behaviours between XML and TMX files, I decided to make an Abstract Base ClassResource and derive two classes XMLResource and TMXresource to implement the different behaviours.
I've made some unit tests while I was making the changes. See file utest/test_p_resource_tiles.py. As per naming convention, I used the _p_ to show that those unit tests are to be used with py.test. They are certainly not exhaustive, but helped me during the refactoring.
It was found out that the map editor found in
tools\editor.py
cannot save correctly to xml a map if the xml contains other elements thanrectmap
. A workaround was to include such elements using therequires
tag.The text was updated successfully, but these errors were encountered: