godot-tiled-importer icon indicating copy to clipboard operation
godot-tiled-importer copied to clipboard

add compatibility with tiled 1.9

Open cromerc opened this issue 1 year ago • 5 comments

This PR adds compatibility with tiled 1.9. A major breaking change is that they changed the type attribute to now be called class.

I left the old type attribute in for now so that it should work with both 1.8 and 1.9.

This fixes the issue #157.

cromerc avatar Jul 13 '22 20:07 cromerc

I created a setup like this in 1.9 (custom class with object attributes):

Capture

but currently get these errors when loading the tilemap:

 Missing information in custom properties (around line 0).
 res://addons/vnen.tiled_importer/tiled_xml_to_dict.gd:291 - Invalid get index 'properties' (on base: 'int').
 res://addons/vnen.tiled_importer/tiled_map_reader.gd:1151 - Invalid get index 'y' (on base: 'Nil').
 res://addons/vnen.tiled_importer/tiled_map_reader.gd:1151 - Invalid get index 'y' (on base: 'Nil').
 res://addons/vnen.tiled_importer/tiled_map_reader.gd:1151 - Invalid get index 'y' (on base: 'Nil').
 res://addons/vnen.tiled_importer/tiled_map_reader.gd:366 - Invalid operands 'String' and 'Nil' in operator 'in'

Another thing to consider is how we want to store this information of child attributes (those can then again have child attributes in a cascading manner) within Godot. One way could be to create a child node of type Node and configure meta information on those.

bitbrain avatar Jul 19 '22 06:07 bitbrain

Do you have a demo project I can use to debug the issue?

cromerc avatar Jul 19 '22 18:07 cromerc

@cromerc there you go. It contains a simple class that contains another class as an attribute. That class then has a bunch of objects it references in the world.

tiled-1.9-demo-project.zip

bitbrain avatar Jul 19 '22 20:07 bitbrain

I just did some testing, and those errors also appear when using 1.8.6 of tiled as well. So this PR and the 1.9 changes have nothing to do with your problem and should be a separate issue.

Please open a separate issue with your problem to keep this PR clean, and I will try to see what is causing the error once I get a chance.

cromerc avatar Jul 22 '22 01:07 cromerc

Created https://github.com/vnen/godot-tiled-importer/issues/161 on the back of that!

bitbrain avatar Jul 22 '22 11:07 bitbrain