-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add custom tile properties to Godot .tscn export format #3653
Conversation
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.
Overall it looks fine to me, but it would be good if @Skrapion would also have a look since he wrote this plugin.
Also, I personally can't really judge the Godot part since I don't know if there would be any other ways of associating custom data with tiles.
I implemented your feedback and added support for custom classes and enums. |
Just wondering, but this double call seems a bit superfluous. Could we also make I had a look at Godot and I think the way this should work is to set up a Custom Data Layer for each individual property, rather than exporting all properties as a Variant. This allows nicely visualizing each property's value for all tiles in a tileset, for example a custom "Depth" float property on the tiles: It is a little strange that the layer name doesn't show up here though, and instead it shows the layer ID: But that looks to me like something that might eventually be improved in the Godot UI and not a reason to export the properties as nested in a Variant. |
Just for your information, I'm currently working on making the changes to achieve the above change in the export, but I don't know if I will be able to finish it today. |
Sounds good 👍 Let me know if you want my assistance in any way. |
Each different top-level property used on the tiles of a map's tilesets will now get its own Custom Data Layer.
@keharriso I think I managed to get it to work. It would be great if you could review my change and do some testing as well. :-) There are some todo's left in the code regarding support for QColor, FilePath and ObjectRef properties. It would be great to handle those in case they have any equivalent in Godot (QColor would certainly have, and FilePath could probably be written as string). |
* Colors are written out like "Color(r, g, b, a)" * Files are currently written out as strings and absolute paths. Would be good to change this to relative, assuming files within the Godot project are referenced. * Object references are just written out as the object ID, though this isn't very useful at the moment since the exporter doesn't support exporting objects yet.
@keharriso Thank you very much for getting this change started! I think it turned out quite well now so I've updated the news / docs and merged this for Tiled 1.10.2! Since you've got some experience with this plugin and with Godot, maybe you could help get #3615 finished as well? @Skrapion has been silent since opening the PR so I'm not sure we can still expect feedback from them, but it's another important feature of the exporter that needs testing and polish. |
This is my attempt at adding feature #3652.
Tile properties are exported as custom property layer 0, named "Properties".
Allows code like:
get_custom_data("Properties").get(<Property>)
Feedback welcome.