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

"Child" class attributes not mapped in Godot as metadata #161

Open
bitbrain opened this issue Jul 22, 2022 · 0 comments
Open

"Child" class attributes not mapped in Godot as metadata #161

bitbrain opened this issue Jul 22, 2022 · 0 comments

Comments

@bitbrain
Copy link

bitbrain commented Jul 22, 2022

Plugin version

Plugin version: 2.4
Godot Version: 3.4
Tiled version: 1.8, 1.9

(downloaded from Github

Issue description

Child object attributes not configured when importing tilemaps. For example, if I create a new class "House" and another class "Sofa" and add attributes to sofa, and I configure "Sofa" to be a child attribute of House, then the attributes of Sofa are not available in Godot.

Additionally, when currently trying to set this up, Godot will show the following errors:

 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').

Steps to reproduce

  1. Download tiled-1.9-demo-project.zip
  2. Try to import the .tmx file with Godot

Expected behaviour: child objects with attributes are accessible in Godot
Current behaviour: child objects with attributes get ignored in Godot

Potential solution

Given a custom class with object references and other attributes that is used as a field within another class, when parsing the object in the world, create a child node of type Node and add it to the current Godot node object. Then, configure the attributes on that child Node as metadata. Repeat this process recursively.

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

1 participant