diff --git a/graph_node_renderer/bottom_dock.gd b/graph_node_renderer/bottom_dock.gd index 3632bd5..e40df61 100644 --- a/graph_node_renderer/bottom_dock.gd +++ b/graph_node_renderer/bottom_dock.gd @@ -13,5 +13,5 @@ func _ready() -> void: set_tab_title(i, tab_names[i]) -func rebuild_variable_tree(data: Dictionary) -> void: +func rebuild_variable_tree(data: Dictionary = {}) -> void: variable_viewer.rebuild_variable_tree(data) diff --git a/graph_node_renderer/deck_holder_renderer.gd b/graph_node_renderer/deck_holder_renderer.gd index 777fb8d..c1b110d 100644 --- a/graph_node_renderer/deck_holder_renderer.gd +++ b/graph_node_renderer/deck_holder_renderer.gd @@ -315,6 +315,8 @@ func close_tab(tab: int) -> void: tab_container.close_tab(tab) if tab_container.get_tab_count() == 0: bottom_dock.variable_viewer.disable_new_button() + bottom_dock.rebuild_variable_tree() + sidebar.clear_node_list() sidebar.set_edited_deck() diff --git a/graph_node_renderer/sidebar/sidebar.gd b/graph_node_renderer/sidebar/sidebar.gd index 6ad7368..95c4c76 100644 --- a/graph_node_renderer/sidebar/sidebar.gd +++ b/graph_node_renderer/sidebar/sidebar.gd @@ -88,6 +88,11 @@ func refresh_node_list(_unused = null) -> void: node_list_menu.add_child(hb) +func clear_node_list() -> void: + for i in node_list_menu.get_children(): + i.queue_free() + + #func _set_button_text(new_text: String, button: Button) -> void: # this was also bad. "Cannot convert argument 2 from Object to Object" 🙃 #button.text = "\"%s\"" % new_text diff --git a/graph_node_renderer/variable_viewer.gd b/graph_node_renderer/variable_viewer.gd index e8998c4..5c0c403 100644 --- a/graph_node_renderer/variable_viewer.gd +++ b/graph_node_renderer/variable_viewer.gd @@ -145,6 +145,8 @@ func add_item(item_name: String, item_value: Variant, parent: TreeItem = root, c set_item_value(item, item_value) + # TODO: TreeItem has a barely-documented quirk that can make the RANGE cell mode + # into a dropdown if the item text is comma-separated values, so use that item.set_text(2, DeckType.type_str(type)) item.set_metadata(2, type) if item_value is Dictionary: