godot-tiled-importer
godot-tiled-importer copied to clipboard
"Child" class attributes not mapped in Godot as metadata
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
- Download tiled-1.9-demo-project.zip
- 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.
I'll have a PR up for this soon.