mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
add array and dictionary expansion support to variable viewer
This commit is contained in:
parent
67d90d164f
commit
84ecb41684
2 changed files with 17 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -22,5 +22,4 @@ size_flags_vertical = 3
|
|||
columns = 3
|
||||
column_titles_visible = true
|
||||
allow_search = false
|
||||
hide_folding = true
|
||||
hide_root = true
|
||||
|
|
Loading…
Reference in a new issue