diff --git a/graph_node_renderer/deck_holder_renderer.gd b/graph_node_renderer/deck_holder_renderer.gd index 795ca54..2ba48b5 100644 --- a/graph_node_renderer/deck_holder_renderer.gd +++ b/graph_node_renderer/deck_holder_renderer.gd @@ -43,6 +43,12 @@ enum ConnectionsMenuId { TWITCH, } +enum DebugMenuId{ + DECKS, + EMBED_SUBWINDOWS, +} +@onready var debug_popup_menu: PopupMenu = %Debug + ## Weak Reference to the Deck that is currently going to be saved. var _deck_to_save: WeakRef @@ -58,6 +64,13 @@ func _ready() -> void: tab_container.add_button_pressed.connect(add_empty_deck) RendererPersistence.init_namespace(PERSISTENCE_NAMESPACE) + debug_popup_menu.set_item_checked( + DebugMenuId.EMBED_SUBWINDOWS, + RendererPersistence.get_or_create(PERSISTENCE_NAMESPACE, "config", "embed_subwindows", true) + ) + + get_tree().get_root().gui_embed_subwindows = RendererPersistence.get_value(PERSISTENCE_NAMESPACE, "config", "embed_subwindows") + recent_files = RendererPersistence.get_or_create( PERSISTENCE_NAMESPACE, "config", "recent_files", [] @@ -281,14 +294,21 @@ func _process(delta: float) -> void: func _on_debug_id_pressed(id: int) -> void: - var d := AcceptDialog.new() - var debug_decks: DebugDecksList = DEBUG_DECKS_LIST.instantiate() - d.add_child(debug_decks) - d.canceled.connect(d.queue_free) - d.confirmed.connect(d.queue_free) - debug_decks.item_pressed.connect(_on_debug_decks_viewer_item_pressed) - add_child(d) - d.popup_centered() + match id: + DebugMenuId.DECKS: + var d := AcceptDialog.new() + var debug_decks: DebugDecksList = DEBUG_DECKS_LIST.instantiate() + d.add_child(debug_decks) + d.canceled.connect(d.queue_free) + d.confirmed.connect(d.queue_free) + debug_decks.item_pressed.connect(_on_debug_decks_viewer_item_pressed) + add_child(d) + d.popup_centered() + DebugMenuId.EMBED_SUBWINDOWS: + var c := debug_popup_menu.is_item_checked(id) + debug_popup_menu.set_item_checked(id, !c) + get_tree().get_root().gui_embed_subwindows = !c + RendererPersistence.set_value(PERSISTENCE_NAMESPACE, "config", "embed_subwindows", !c) func _on_debug_decks_viewer_item_pressed(deck_id: String, instance_id: String) -> void: diff --git a/graph_node_renderer/deck_holder_renderer.tscn b/graph_node_renderer/deck_holder_renderer.tscn index 1e4d948..45aa250 100644 --- a/graph_node_renderer/deck_holder_renderer.tscn +++ b/graph_node_renderer/deck_holder_renderer.tscn @@ -129,9 +129,14 @@ item_1/text = "Twitch.." item_1/id = 1 [node name="Debug" type="PopupMenu" parent="MarginContainer/VSplitContainer/VBoxContainer/MenuBar"] -item_count = 1 +unique_name_in_owner = true +item_count = 2 item_0/text = "Decks..." item_0/id = 0 +item_1/text = "Embed subwindows" +item_1/checkable = 1 +item_1/checked = true +item_1/id = 1 [node name="TabContainerCustom" parent="MarginContainer/VSplitContainer/VBoxContainer" instance=ExtResource("1_s3ug2")] unique_name_in_owner = true