From cfb57592274275edafa8d86a6ae62d4d76dba1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 17 Jan 2024 05:07:24 +0300 Subject: [PATCH] change bottom dock to be a tab container --- graph_node_renderer/bottom_dock.gd | 11 +++++++++++ graph_node_renderer/bottom_dock.tscn | 13 +++++++++++++ graph_node_renderer/deck_holder_renderer.gd | 6 +++--- graph_node_renderer/deck_holder_renderer.tscn | 4 ++-- project.godot | 2 +- 5 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 graph_node_renderer/bottom_dock.gd create mode 100644 graph_node_renderer/bottom_dock.tscn diff --git a/graph_node_renderer/bottom_dock.gd b/graph_node_renderer/bottom_dock.gd new file mode 100644 index 0000000..3a867c2 --- /dev/null +++ b/graph_node_renderer/bottom_dock.gd @@ -0,0 +1,11 @@ +# (c) 2023-present Eroax +# (c) 2023-present Yagich +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +extends TabContainer +class_name BottomDock + +@export var tab_names := ["Console"] + +func _ready() -> void: + for i in get_child_count(): + set_tab_title(i, tab_names[i]) diff --git a/graph_node_renderer/bottom_dock.tscn b/graph_node_renderer/bottom_dock.tscn new file mode 100644 index 0000000..0778d41 --- /dev/null +++ b/graph_node_renderer/bottom_dock.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=3 format=3 uid="uid://dayri1ejk20bc"] + +[ext_resource type="PackedScene" uid="uid://duvh3r740w2p5" path="res://graph_node_renderer/logger_renderer.tscn" id="1_6yuco"] +[ext_resource type="Script" path="res://graph_node_renderer/bottom_dock.gd" id="1_mu1hf"] + +[node name="BottomDock" type="TabContainer"] +offset_right = 122.0 +offset_bottom = 95.0 +script = ExtResource("1_mu1hf") + +[node name="LoggerRenderer" parent="." instance=ExtResource("1_6yuco")] +unique_name_in_owner = true +layout_mode = 2 diff --git a/graph_node_renderer/deck_holder_renderer.gd b/graph_node_renderer/deck_holder_renderer.gd index cfe36d8..f5973a1 100644 --- a/graph_node_renderer/deck_holder_renderer.gd +++ b/graph_node_renderer/deck_holder_renderer.gd @@ -65,7 +65,7 @@ var _deck_to_save: WeakRef @onready var obs_setup_dialog := $OBSWebsocketSetupDialog as OBSWebsocketSetupDialog @onready var twitch_setup_dialog := $Twitch_Setup_Dialog as TwitchSetupDialog -@onready var logger_renderer: LoggerRenderer = %LoggerRenderer +@onready var bottom_dock: TabContainer = %BottomDock func _ready() -> void: @@ -445,8 +445,8 @@ func _on_unsaved_changes_dialog_confirmed() -> void: func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("toggle_console"): - logger_renderer.visible = !logger_renderer.visible + if event.is_action_pressed("toggle_bottom_dock"): + bottom_dock.visible = !bottom_dock.visible accept_event() diff --git a/graph_node_renderer/deck_holder_renderer.tscn b/graph_node_renderer/deck_holder_renderer.tscn index d2b2864..ec9988b 100644 --- a/graph_node_renderer/deck_holder_renderer.tscn +++ b/graph_node_renderer/deck_holder_renderer.tscn @@ -3,8 +3,8 @@ [ext_resource type="Script" path="res://graph_node_renderer/deck_holder_renderer.gd" id="1_67g2g"] [ext_resource type="PackedScene" uid="uid://b84f2ngtcm5b8" path="res://graph_node_renderer/tab_container_custom.tscn" id="1_s3ug2"] [ext_resource type="Theme" uid="uid://dqqdqscid2iem" path="res://graph_node_renderer/default_theme.tres" id="1_tgul2"] +[ext_resource type="PackedScene" uid="uid://dayri1ejk20bc" path="res://graph_node_renderer/bottom_dock.tscn" id="4_gwnhy"] [ext_resource type="Script" path="res://addons/no-obs-ws/NoOBSWS.gd" id="4_nu72u"] -[ext_resource type="PackedScene" uid="uid://duvh3r740w2p5" path="res://graph_node_renderer/logger_renderer.tscn" id="4_pvexk"] [ext_resource type="Script" path="res://addons/no_twitch/twitch_connection.gd" id="5_3n36q"] [ext_resource type="PackedScene" uid="uid://eioso6jb42jy" path="res://graph_node_renderer/obs_websocket_setup_dialog.tscn" id="5_uo2gj"] [ext_resource type="PackedScene" uid="uid://bq2lxmbnic4lc" path="res://graph_node_renderer/twitch_setup_dialog.tscn" id="7_7rhap"] @@ -151,7 +151,7 @@ item_1/id = 1 unique_name_in_owner = true layout_mode = 2 -[node name="LoggerRenderer" parent="MarginContainer/VSplitContainer" instance=ExtResource("4_pvexk")] +[node name="BottomDock" parent="MarginContainer/VSplitContainer" instance=ExtResource("4_gwnhy")] unique_name_in_owner = true visible = false layout_mode = 2 diff --git a/project.godot b/project.godot index 1b21f61..e784511 100644 --- a/project.godot +++ b/project.godot @@ -44,7 +44,7 @@ rename_node={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194333,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) ] } -toggle_console={ +toggle_bottom_dock={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":78,"key_label":0,"unicode":110,"echo":false,"script":null) ]