Add explicit support for 3.13, previous versions work on 3.13 but it was not explicitly labeled as supported or being tested by CI.
Converts all file loading to use UTF-8 encoding by default. In most cases, all Tiled files will be exported from Tiled in UTF-8 encoding, however the python open()
function uses the system default locale. The only case where Tiled would not have used UTF-8 is for JSON files when Tiled was compiled against Qt 5, which is only in some builds of Tiled from older systems. All XML files exported from Tiled will always be UTF-8. If someone happens to have a JSON file which was exported from Tiled on an encoding other than UTF-8, or for some other reason is in a different encoding. This can be switched using a new optional argument named encoding
in the various public API parse
functions such as parse_map()
. This value is handed down through the pipeline of file loading in pytiled-parser, and will apply to every file loaded during the chain from this. This means that every file in a chain(for example, Map, Tileset, and Template File) must share the same encoding. This new argument is a string which is ultimately passed to the Python open() function. This change does introduce breaking changes in the underlying API which is not intended to be public facing, but if you are going deeper than the top level parse functions, you may need to adjust for this, as many of the underlying internal functions now have a mandatory encoding argument.
Property values which are of type "int" in Tiled will now be loaded as Python ints. Previously these values were loaded as floats, which for most purposes is fine, but not exactly correct. If a float value happens to find it's way into an int type property, pytiled-parser will mimic Tiled's functionality and round it up/down to the nearest integer value. This may technically be a breaking change for some obscure runtime type checking use cases, but shouldn't really break too much.
Previously when loading object templates, if the template had a name
key defined, it would override the object instance name
value. This has been changed such that the object instance name
will be respected, and override any name provided by a template. This is in line with Tiled, and it does not appear to actually be possible to provide a name
value in an object template, but you can technically put the field into the template file manually, and with JSON, Tiled actually stores an empty string in the field(as opposed to it just not existing in the TMX file), so with JSON the fields were being overwritten to an empty string.
Previously with the TMX format, the order of layers within a Group Layer were not guaranteed, this has been fixed and all layers and group layers should be in their proper order.