From 7f263b45fbfcef3cd1d6b09e47ac4b0b6fdd4464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 17 Jan 2024 12:45:23 +0300 Subject: [PATCH] add range cell for numeric values --- graph_node_renderer/variable_viewer.gd | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/graph_node_renderer/variable_viewer.gd b/graph_node_renderer/variable_viewer.gd index 680d94f..9ca0ed5 100644 --- a/graph_node_renderer/variable_viewer.gd +++ b/graph_node_renderer/variable_viewer.gd @@ -31,8 +31,16 @@ func rebuild_variable_tree(data: Dictionary = {}) -> void: 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)] + + match type: + DeckType.Types.NUMERIC: + item.set_cell_mode(1, TreeItem.CELL_MODE_RANGE) + item.set_range(1, item_value) + item.set_range_config(1, -9999, 9999, 0.0001) + _: + item.set_text(1, str(item_value)) + item.set_text(2, DeckType.type_str(type)) if item_value is Dictionary: for i in item_value: @@ -41,4 +49,5 @@ func add_item(item_name: String, item_value: Variant, parent: TreeItem = root) - for i in (item_value as Array).size(): add_item(str(i), item_value[i], item) item.collapsed = true + return item