-
Notifications
You must be signed in to change notification settings - Fork 106
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
Support Tiled 1.9 class
property
#238
Support Tiled 1.9 class
property
#238
Conversation
Thank you! Could you also update the changelog (On the "Unreleased" section)? |
|
37f9794
to
1875cb2
Compare
@bjorn Could you check this out? I'm still not 100% familiar with Tiled 1.9 changes |
Actually, I found out, that layers (all kinds of them?) and maps can have a So my PR only fixes this for existing entities which previously had |
Bjorn plans to rename
|
Ok, in this case it would be good to just add support for the type/class property to all entities, without renaming it. I pushed a proposal commit. |
If we go for And indeed, I plan to rename |
Yes, in this case, using the
I have found one inconsistency. For tiles, the |
This inconsistency also exists in the TMX docs, so I guess we should leave it as is. @bjorn Thoughts? |
Eh, it's good enough 🙂 |
Thank you! 🙏 |
Hmm, I guess the docs have to be fixed. While this property is optional in the file, storage wise I've always defaulted to an empty string rather than having an explicit "type has not been specified" state. Is it helpful to have such a state in Rust? |
Is it helpful to distinguish between having an empty text attribute vs not having it at all? I don't know 🙂 Depends on the format and editor, not the language really |
Regarding Option vs empty string, I have mixed feelings about that:
|
Right, then I think we should not use |
Why
Closes #234
In Tiled 1.9 the "type" property was renamed to "class". My PR addresses this.
How
In addition to "type", the "class" property is parsed. If the former is not present, the latter takes its place. This way, the solution is compatible with both 1.9+ and older maps.
After the below conversation, this is what I did:
obj_type
for Objects andtile_type
for Tiles in favor ofuser_type
. Added deprecation noticesuser_type
to Maps, Tilesets and Layers.class
andtype
XML params now resolve touser_type
everywhere.Support for type/class is now implemented for the following entities:
Tile
)These are all places that I'm aware of.
Test plan
Tested locally on both old and new maps.
I didn't add tests as I haven't found any existing ones (nor test fixtures) which have the "type" or "class" property set. Eventually, I can create/modify one if requested.