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
Making tile.type
and layer.class_
compatible with Tiled 1.9's new Unified Custom Types ("class")
#50
Conversation
…es ("class") https://www.mapeditor.org/2022/06/25/tiled-1-9-released.html New in tiled 1.9: ```xml <tile id="98" class="Slope"> <properties> <property name="LeftTop" type="int" value="0"/> <property name="RightTop" type="int" value="8"/> </properties> </tile> ``` Previously: ```xml <tile id="98" type="Slope"> <properties> <property name="LeftTop" type="int" value="0"/> <property name="RightTop" type="int" value="8"/> </properties> </tile> ```
tile.type
compatible with Tiled 1.9's new Unified Custom Typ…tile.type
compatible with Tiled 1.9's new Unified Custom Types ("class")
CHANGELOG.md
Outdated
## 0.8.3 | ||
* Downgrade meta dependency | ||
|
||
## 0.8.2 | ||
* Add support for class, which is replacing type in tiled 1.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should never remove entries from the changelog, if the entry was wrong it should be explained in the new entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, I got the versions mixed up because when I forked this wasn't here, I'll undelete this
@@ -1,5 +1,5 @@ | |||
name: tiled | |||
version: 0.8.3 | |||
version: 0.8.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should normally not be bumped in this PR, but since I'll do a release after this is merged it doesn't matter this time.
Didn't #48 already solve this? |
No, #48 addressed this problem only for the tilemap files. This PR seems to fix it for tileset files as well. I didn't know that tilesets also had type property. |
lib/src/tileset/tile.dart
Outdated
type: parser.getStringOrNull('type'), | ||
|
||
/// Tiled 1.9 "type" has been moved to "class" | ||
type: parser.getStringOrNull('type') ?? parser.getStringOrNull('class'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make it consistent with #48, you can make it check for class
first, and then type
. As more and more people will migrate to Tiled 1.9, chances of finding class
property instead of type
are more likely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the ordering.
I think with Tiled 1.9 you can add class
to nearly anything, which is why they did the rename. We'd probably need to got through and test this for a bunch of other objects, but Layers for one could be useful. Although it raises the question, should we add a tiledClass
attribute or keep calling them type
even though they property in the new Tiled UI is "Class", I guess they named it that because layers already have a "type" which means something else.
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”
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For TiledObject
class I kept type
attribute as it was and just added a getter called class_
which returns type
. That way it won't break anyone's existing code and if someone using tiled with newer map files, tries to find class attribute, class_
will pop-up in auto-complete list.
tile.type
compatible with Tiled 1.9's new Unified Custom Types ("class")tile.type
and layer.class_
compatible with Tiled 1.9's new Unified Custom Types ("class")
@ufrshubham I added the |
Also adding |
ImageLayer repeats
Adding
ImageLayer.repeatX
andImageLayer.repeatY
Unified Custom Types
Tiled 1.9 changelog:
https://www.mapeditor.org/2022/06/25/tiled-1-9-released.html
Layer
Adding
layer.class_
for all for layer types.Tile
Adding
tile.class_
and makingtile.type
forward compatible with "class" attribute.New in tiled 1.9:
Previously: