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

Default properties are not imported and show Null #160

Open
al0fdf opened this issue Jul 22, 2022 · 2 comments
Open

Default properties are not imported and show Null #160

al0fdf opened this issue Jul 22, 2022 · 2 comments

Comments

@al0fdf
Copy link

al0fdf commented Jul 22, 2022

Plugin version
Tiled Map Importer v2.4
Godot v3.4.stable.official 206ba70f4
Plugin downloaded from github

Issue description
Default or "unmodified" properties from Tiled (ones that are grey) are not imported, showing Null

Steps to reproduce

  1. Specify a new object type. View->Object Types Editor
    image

  2. Use the object type in a tileset.
    image

  3. Create an object out of that tile (use Insert Tile on an object layer)
    image

  4. When trying to import level in Godot, the "type" property of the object is null

  5. When going into the map file and adding and removing a space to make to property no longer grey, the property is imported.

Sample map or tileset
.zip file contains test-map.tmx, test-tileset.tsx, game.gd and objecttypes.xml

reproCase.zip

@bitbrain
Copy link

bitbrain commented Jul 24, 2022

The main problem is that class-specific information is only stored within the .tiled-project file which currently is not parsed anywhere. As a result, this plugin is unable to set the default values for those. I'd actually expect us not to parse the .tiled-project file but rather on tiled map export, those class default values being auto-populated inside the templates and objects, however, this is currently not the case.

This seems to be indeed a bug within the Tiled editor itself: mapeditor/tiled#3411

The only workaround for this is to manually set the attributes on each node, unfortunately.

@eishiya
Copy link

eishiya commented Jul 26, 2022

This seems to be indeed a bug within the Tiled editor itself: mapeditor/tiled#3411

The linked bug is only about properties that are classes, Tiled doesn't correctly resolve their members, plain custom properties like the ones in OP's example are correctly resolved with the resolve properties export option in Tiled. The issue in this thread is unrelated.

However, OP mentioned the "type" on the object is null - could this perhaps be related to the change from "type" to "class" in 1.9? Is the importer perhaps looking for the "type" attribute that no longer exists? Try setting the 1.8 compatibility mode in the project settings in Tiled, and see if saving the files with that enabled helps. (Though their screenshots seem to be from 1.8 or earlier, so maybe that's not it.)

Lastly, the class (type) information can be exported into JSON and XML files that work the same as objecttypes.xml did in older versions, as well, so if someone wanted to extend the importer to support default values, parsing the entire project is not necessary.

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

3 participants