diff --git a/graph_node_renderer/variable_viewer.gd b/graph_node_renderer/variable_viewer.gd index a2fb11a..680d94f 100644 --- a/graph_node_renderer/variable_viewer.gd +++ b/graph_node_renderer/variable_viewer.gd @@ -25,8 +25,20 @@ func rebuild_variable_tree(data: Dictionary = {}) -> void: i.free() for i in data: - var item := variable_tree.create_item(root) - item.set_text(0, i) - item.set_text(1, data[i]) - var type: DeckType.Types = DeckType.INVERSE_GODOT_TYPES_MAP[typeof(data[i])] - item.set_text(2, DeckType.type_str(type)) + add_item(i, data[i]) + + +func add_item(item_name: String, item_value: Variant, parent: TreeItem = root) -> TreeItem: + var item := variable_tree.create_item(parent) + item.set_text(0, item_name) + item.set_text(1, str(item_value)) + var type: DeckType.Types = DeckType.INVERSE_GODOT_TYPES_MAP[typeof(item_value)] + item.set_text(2, DeckType.type_str(type)) + if item_value is Dictionary: + for i in item_value: + add_item(i, item_value[i], item) + if item_value is Array: + for i in (item_value as Array).size(): + add_item(str(i), item_value[i], item) + item.collapsed = true + return item diff --git a/graph_node_renderer/variable_viewer.tscn b/graph_node_renderer/variable_viewer.tscn index ad576f8..64cdad5 100644 --- a/graph_node_renderer/variable_viewer.tscn +++ b/graph_node_renderer/variable_viewer.tscn @@ -22,5 +22,4 @@ size_flags_vertical = 3 columns = 3 column_titles_visible = true allow_search = false -hide_folding = true hide_root = true