Skip to content

Tiled 1.9 future compatibility: API renamed "type" object property to "className" #50

@sixthgear

Description

@sixthgear

Tiled 1.9 was recently released. I noticed that one of the changes is renaming the property "type" to "class" for all data types as per the release notes.

Object Types have been merged into the Property Types, now simply called “Custom Types”. This means custom classes can now have a color and can be used as “object type”. If your project refers to an object types file, these types will be automatically imported as custom classes. If you used globally stored object types before, they can be manually imported to your project.

In addition, the “Type” property previously available only for objects and tiles is now available for all data types as the new “Class” property. For consistency, this value is written out as “class” also for objects and tiles, but a project-wide compatibility option is provided to make it still write out as “type”:

This is confirmed by the plugin API documentation.

This API change shouldn't affect this project today, as I believe the new className property is still accessible as "type" (although marked deprecated), but it might be worth taking note in case it becomes a future issue. As far as I can tell, this would affects us when we want to distinguish which type of Node to create for a given Tiled object.

One consideration is making sure the plugin remains compatible with previous versions of Tiled. We could simply test for the presence of a "className" property on the object and fallback to "type", or we could also test tiled.version to switch behaviors. It's also worth noting that Tiled projects (but not individual maps) now have the ability to save files in "compatibility mode", which keeps the 1.8 API intact, but I'm not sure this would affect us since we are using the export path.

I'm reporting this simply as a TODO. The changes seem simple enough and I'd be happy to contribute if the maintainer would prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions