Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sixthgear opened this issue Aug 6, 2022 · 1 comment

Comments

@sixthgear
Copy link

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.

@bjorn
Copy link
Member

bjorn commented Aug 6, 2022

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.

I think it's good to have this issue as reminder, but currently I don't really see a reason to remove the deprecated properties so there is no need to act on this now.

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.

Indeed, this only affects the saved files, not the scripting API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants