Browse Source

Moved copy and paste for nodes into the actual graph edits control and added select and copy options in the console

Jonathan Higgins 6 months ago
parent
commit
b290ed455a

+ 1 - 1
export_presets.cfg

@@ -76,7 +76,7 @@ custom_features=""
 export_filter="all_resources"
 include_filter="*.thd, export_presets.cfg"
 exclude_filter=""
-export_path="../SoundThread_Exports/v0.2.0-beta/SoundThread_v0.2.0-beta_macOS/SoundThread-v0.1.8-alpha_macos.zip"
+export_path="../SoundThread_Exports/v0.2.1-beta/SoundThread-v0.1.8-alpha_macos.zip"
 patches=PackedStringArray()
 encryption_include_filters=""
 encryption_exclude_filters=""

+ 0 - 10
project.godot

@@ -46,16 +46,6 @@ theme/custom_font="uid://cc7mj053bhfvh"
 
 [input]
 
-copy_node={
-"deadzone": 0.2,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
-]
-}
-paste_node={
-"deadzone": 0.2,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":0,"physical_keycode":86,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
-]
-}
 undo={
 "deadzone": 0.2,
 "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)

+ 16 - 1
scenes/main/control.tscn

@@ -1,10 +1,11 @@
-[gd_scene load_steps=10 format=3 uid="uid://bcs87y7ptx3ke"]
+[gd_scene load_steps=11 format=3 uid="uid://bcs87y7ptx3ke"]
 
 [ext_resource type="Script" uid="uid://bdlfvuljckmu1" path="res://scenes/main/scripts/control.gd" id="1_2f0aq"]
 [ext_resource type="Script" uid="uid://l2yejnjysupr" path="res://scenes/main/scripts/graph_edit.gd" id="2_3ioqo"]
 [ext_resource type="PackedScene" uid="uid://b0wdj8v6o0wq0" path="res://scenes/menu/menu.tscn" id="3_dtf4o"]
 [ext_resource type="Texture2D" uid="uid://cdwux1smquvpi" path="res://theme/images/logo.png" id="4_3ioqo"]
 [ext_resource type="PackedScene" uid="uid://dta7rfalv4uvd" path="res://scenes/main/audio_settings.tscn" id="5_dtf4o"]
+[ext_resource type="Script" uid="uid://cyhaucukdha8a" path="res://scenes/main/scripts/console.gd" id="5_fbaj0"]
 [ext_resource type="Script" uid="uid://wja0lo4nobh1" path="res://scenes/main/scripts/about_menu.gd" id="5_yf4wl"]
 [ext_resource type="Script" uid="uid://dlcbmyu3s2phc" path="res://scenes/menu/search_menu.gd" id="6_fyarh"]
 [ext_resource type="Script" uid="uid://b6r7k326k3vif" path="res://scenes/Nodes/check_for_updates.gd" id="7_1kc3g"]
@@ -190,6 +191,7 @@ size = Vector2i(600, 400)
 visible = false
 unresizable = true
 always_on_top = true
+script = ExtResource("5_fbaj0")
 
 [node name="Panel" type="Panel" parent="Console"]
 offset_left = 10.0
@@ -202,6 +204,8 @@ offset_left = 12.0
 offset_top = 8.0
 offset_right = 588.0
 offset_bottom = 344.0
+focus_mode = 2
+selection_enabled = true
 
 [node name="ConsoleOpenFolder" type="Button" parent="Console"]
 offset_left = 308.0
@@ -217,6 +221,13 @@ offset_right = 292.0
 offset_bottom = 393.0
 text = "Stop Running Thread"
 
+[node name="ConsoleRightClick" type="PopupMenu" parent="Console"]
+item_count = 2
+item_0/text = "Select All"
+item_0/id = 0
+item_1/text = "Copy"
+item_1/id = 1
+
 [node name="ColorRect" type="ColorRect" parent="."]
 layout_mode = 1
 anchors_preset = 10
@@ -438,10 +449,12 @@ offset_bottom = 100.0
 text = "Stop Running Thread"
 
 [connection signal="connection_request" from="GraphEdit" to="GraphEdit" method="_on_connection_request"]
+[connection signal="copy_nodes_request" from="GraphEdit" to="GraphEdit" method="_on_copy_nodes_request"]
 [connection signal="delete_nodes_request" from="GraphEdit" to="GraphEdit" method="_on_graph_edit_delete_nodes_request"]
 [connection signal="disconnection_request" from="GraphEdit" to="GraphEdit" method="_on_graph_edit_disconnection_request"]
 [connection signal="node_deselected" from="GraphEdit" to="GraphEdit" method="_on_graph_edit_node_deselected"]
 [connection signal="node_selected" from="GraphEdit" to="GraphEdit" method="_on_graph_edit_node_selected"]
+[connection signal="paste_nodes_request" from="GraphEdit" to="GraphEdit" method="_on_paste_nodes_request"]
 [connection signal="popup_request" from="GraphEdit" to="." method="_on_graph_edit_popup_request"]
 [connection signal="dir_selected" from="FileDialog" to="." method="_on_file_dialog_dir_selected"]
 [connection signal="close_requested" from="mainmenu" to="." method="_on_mainmenu_close_requested"]
@@ -454,8 +467,10 @@ text = "Stop Running Thread"
 [connection signal="canceled" from="CdpLocationDialog" to="." method="_on_cdp_location_dialog_canceled"]
 [connection signal="dir_selected" from="CdpLocationDialog" to="." method="_on_cdp_location_dialog_dir_selected"]
 [connection signal="close_requested" from="Console" to="." method="_on_console_close_requested"]
+[connection signal="gui_input" from="Console/ConsoleOutput" to="Console" method="_on_console_output_gui_input"]
 [connection signal="button_down" from="Console/ConsoleOpenFolder" to="." method="_on_console_open_folder_button_down"]
 [connection signal="button_down" from="Console/KillProcess" to="." method="_on_kill_process_button_down"]
+[connection signal="index_pressed" from="Console/ConsoleRightClick" to="Console" method="_on_console_right_click_index_pressed"]
 [connection signal="index_pressed" from="MenuBar/FileButton" to="." method="_on_file_button_index_pressed"]
 [connection signal="index_pressed" from="MenuBar/SettingsButton" to="." method="_on_settings_button_index_pressed"]
 [connection signal="index_pressed" from="MenuBar/HelpButton" to="." method="_on_help_button_index_pressed"]

+ 27 - 0
scenes/main/scripts/console.gd

@@ -0,0 +1,27 @@
+extends Window
+
+
+# Called when the node enters the scene tree for the first time.
+func _ready() -> void:
+	pass # Replace with function body.
+
+
+func _on_console_output_gui_input(event: InputEvent) -> void:
+	#check if right click on console and if so open context menu
+	if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
+		var local_pos = DisplayServer.mouse_get_position()
+		$ConsoleRightClick.position = local_pos
+		$ConsoleRightClick.popup()
+
+
+
+func _on_console_right_click_index_pressed(index: int) -> void:
+	match index:
+		0:
+			#select all text in the console
+			$ConsoleOutput.select_all()
+		1:
+			#copy selected text in the console to the clipboard
+			var selection = $ConsoleOutput.get_selected_text()
+			if selection != "":
+				DisplayServer.clipboard_set(selection)

+ 1 - 0
scenes/main/scripts/console.gd.uid

@@ -0,0 +1 @@
+uid://cyhaucukdha8a

+ 2 - 9
scenes/main/scripts/control.gd

@@ -207,16 +207,9 @@ func _on_cdp_location_dialog_canceled() -> void:
 	
 
 func _input(event):
-	if event.is_action_pressed("copy_node"):
-		graph_edit.copy_selected_nodes()
-		get_viewport().set_input_as_handled()
-
-	elif event.is_action_pressed("paste_node"):
-		simulate_mouse_click() #hacky fix to stop tooltips getting stuck
+	if event.is_action_pressed("undo"):
+		simulate_mouse_click()
 		await get_tree().process_frame
-		graph_edit.paste_copied_nodes()
-		get_viewport().set_input_as_handled()
-	elif event.is_action_pressed("undo"):
 		undo_redo.undo()
 	elif event.is_action_pressed("redo"):
 		undo_redo.redo()

+ 11 - 0
scenes/main/scripts/graph_edit.gd

@@ -454,3 +454,14 @@ func _on_any_input_changed():
 
 func _track_changes():
 	control_script.changesmade = true
+
+
+func _on_copy_nodes_request() -> void:
+	graph_edit.copy_selected_nodes()
+	#get_viewport().set_input_as_handled()
+
+
+func _on_paste_nodes_request() -> void:
+	control_script.simulate_mouse_click() #hacky fix to stop tooltips getting stuck
+	await get_tree().process_frame
+	graph_edit.paste_copied_nodes()

+ 16 - 1
theme/main_theme.tres

@@ -1,4 +1,4 @@
-[gd_resource type="Theme" load_steps=67 format=3 uid="uid://cefwkdcoxihro"]
+[gd_resource type="Theme" load_steps=68 format=3 uid="uid://cefwkdcoxihro"]
 
 [ext_resource type="Texture2D" uid="uid://b4o8vm5o4uptk" path="res://theme/images/toggle_checked.png" id="1_cibxr"]
 [ext_resource type="Texture2D" uid="uid://d0dubcywvqtkw" path="res://theme/images/toggle_unchecked.png" id="2_adhqp"]
@@ -440,6 +440,19 @@ content_margin_bottom = 2.0
 bg_color = Color(0.101961, 0.101961, 0.101961, 0.6)
 corner_detail = 6
 
+[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0ipho"]
+content_margin_left = 4.0
+content_margin_top = 4.0
+content_margin_right = 4.0
+content_margin_bottom = 4.0
+bg_color = Color(1, 1, 1, 0)
+draw_center = false
+corner_detail = 5
+expand_margin_left = 2.0
+expand_margin_top = 2.0
+expand_margin_right = 2.0
+expand_margin_bottom = 2.0
+
 [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ffxfl"]
 content_margin_left = 0.0
 content_margin_top = 0.0
@@ -612,6 +625,8 @@ PopupMenu/styles/hover = SubResource("StyleBoxFlat_cibxr")
 PopupMenu/styles/panel = SubResource("StyleBoxFlat_75705")
 ProgressBar/styles/background = SubResource("StyleBoxFlat_g78kk")
 ProgressBar/styles/fill = SubResource("StyleBoxFlat_m7qrk")
+RichTextLabel/colors/selection_color = Color(0.101961, 0.101961, 0.101961, 0.937255)
+RichTextLabel/styles/focus = SubResource("StyleBoxFlat_0ipho")
 TabContainer/styles/panel = SubResource("StyleBoxFlat_ffxfl")
 TabContainer/styles/tab_focus = SubResource("StyleBoxFlat_tpkcg")
 TabContainer/styles/tab_hovered = SubResource("StyleBoxFlat_xxa0j")