control.gd 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. extends Control
  2. var mainmenu_visible : bool = false #used to test if mainmenu is open
  3. var effect_position = Vector2(40,40) #tracks mouse position for node placement offset
  4. @onready var graph_edit = $GraphEdit
  5. var cdpprogs_location #stores the cdp programs location from user prefs for easy access
  6. var delete_intermediate_outputs # tracks state of delete intermediate outputs toggle
  7. @onready var console_output: RichTextLabel = $Console/ConsoleOutput
  8. var undo_redo := UndoRedo.new()
  9. var output_audio_player #tracks the node that is the current output player for linking
  10. var input_audio_player #tracks node that is the current input player for linking
  11. var currentfile = "none" #tracks dir of currently loaded file for saving
  12. var changesmade = false #tracks if user has made changes to the currently loaded save file
  13. var savestate # tracks what the user is trying to do when savechangespopup is called
  14. var helpfile #tracks which help file the user was trying to load when savechangespopup is called
  15. var outfilename #links to the user name for outputfile field
  16. var foldertoggle #links to the reuse folder button
  17. var lastoutputfolder = "none" #tracks last output folder, this can in future be used to replace global.outfile but i cba right now
  18. var uiscale = 1.0 #tracks scaling for retina screens
  19. #scripts
  20. var open_help
  21. var run_thread
  22. var save_load
  23. # Called when the node enters the scene tree for the first time.
  24. func _ready() -> void:
  25. Nodes.hide()
  26. $mainmenu.hide()
  27. $NoLocationPopup.hide()
  28. $Console.hide()
  29. $NoInputPopup.hide()
  30. $MultipleConnectionsPopup.hide()
  31. $AudioSettings.hide()
  32. $AudioDevicePopup.hide()
  33. $SearchMenu.hide()
  34. $Settings.hide()
  35. $ProgressWindow.hide()
  36. $SaveDialog.access = FileDialog.ACCESS_FILESYSTEM
  37. $SaveDialog.file_mode = FileDialog.FILE_MODE_SAVE_FILE
  38. $SaveDialog.filters = ["*.thd"]
  39. $LoadDialog.access = FileDialog.ACCESS_FILESYSTEM
  40. $LoadDialog.file_mode = FileDialog.FILE_MODE_OPEN_FILE
  41. $LoadDialog.filters = ["*.thd"]
  42. get_tree().set_auto_accept_quit(false) #disable closing the app with the x and instead handle it internally
  43. load_scripts()
  44. make_signal_connections()
  45. check_user_preferences()
  46. hidpi_adjustment()
  47. new_patch()
  48. load_from_filesystem()
  49. check_cdp_location_set()
  50. func load_scripts():
  51. #load and initialise scripts
  52. open_help = preload("res://scenes/main/scripts/open_help.gd").new()
  53. open_help.init(self)
  54. add_child(open_help)
  55. run_thread = preload("res://scenes/main/scripts/run_thread.gd").new()
  56. run_thread.init(self, $ProgressWindow, $ProgressWindow/ProgressLabel, $ProgressWindow/ProgressBar, $GraphEdit, $Console, $Console/ConsoleOutput)
  57. add_child(run_thread)
  58. graph_edit.init(self, $GraphEdit, Callable(open_help, "show_help_for_node"), $MultipleConnectionsPopup)
  59. save_load = preload("res://scenes/main/scripts/save_load.gd").new()
  60. save_load.init(self, $GraphEdit, Callable(open_help, "show_help_for_node"), Callable(graph_edit, "_register_node_movement"), Callable(graph_edit, "_register_inputs_in_node"), Callable(self, "link_output"))
  61. add_child(save_load)
  62. func make_signal_connections():
  63. get_node("SearchMenu").make_node.connect(graph_edit._make_node)
  64. get_node("mainmenu").make_node.connect(graph_edit._make_node)
  65. get_node("mainmenu").open_help.connect(open_help.show_help_for_node)
  66. get_node("Settings").open_cdp_location.connect(show_cdp_location)
  67. get_node("Settings").console_on_top.connect(change_console_settings)
  68. func hidpi_adjustment():
  69. #checks if display is hidpi and scales ui accordingly hidpi - 144
  70. if DisplayServer.screen_get_dpi(0) >= 144:
  71. uiscale = 2.0
  72. get_window().content_scale_factor = uiscale
  73. #goes through popup_windows group and scales all popups and resizes them
  74. for window in get_tree().get_nodes_in_group("popup_windows"):
  75. window.size = window.size * uiscale
  76. window.content_scale_factor = uiscale
  77. func load_from_filesystem():
  78. #checks if user has opened a file from the system file menu and loads it
  79. var args = OS.get_cmdline_args()
  80. for arg in args:
  81. var path = arg.strip_edges()
  82. if FileAccess.file_exists(path) and path.get_extension().to_lower() == "thd":
  83. save_load.load_graph_edit(path)
  84. break
  85. func new_patch():
  86. #clear old patch
  87. graph_edit.clear_connections()
  88. for node in graph_edit.get_children():
  89. if node is GraphNode:
  90. node.queue_free()
  91. await get_tree().process_frame # Wait for nodes to actually be removed
  92. graph_edit.scroll_offset = Vector2(0, 0)
  93. #Generate input and output nodes
  94. var effect: GraphNode = Nodes.get_node(NodePath("inputfile")).duplicate()
  95. effect.name = "inputfile"
  96. get_node("GraphEdit").add_child(effect, true)
  97. effect.connect("open_help", Callable(open_help, "show_help_for_node"))
  98. effect.position_offset = Vector2(20,80)
  99. effect = Nodes.get_node(NodePath("outputfile")).duplicate()
  100. effect.name = "outputfile"
  101. get_node("GraphEdit").add_child(effect, true)
  102. effect.init() #initialise ui from user prefs
  103. effect.connect("open_help", Callable(open_help, "show_help_for_node"))
  104. effect.position_offset = Vector2((DisplayServer.screen_get_size().x - 480) / uiscale, 80)
  105. graph_edit._register_node_movement() #link nodes for tracking position changes for changes tracking
  106. changesmade = false #so it stops trying to save unchanged empty files
  107. get_window().title = "SoundThread"
  108. link_output()
  109. func link_output():
  110. #links various buttons and function in the input nodes - this is called after they are created so that it still works on new and loading files
  111. for control in get_tree().get_nodes_in_group("outputnode"): #check all items in outputnode group
  112. if control.get_meta("outputfunction") == "deleteintermediate": #link delete intermediate files toggle to script
  113. control.toggled.connect(_toggle_delete)
  114. _toggle_delete(control.button_pressed)
  115. #control.button_pressed = interface_settings.get("delete_intermediate", true)
  116. elif control.get_meta("outputfunction") == "runprocess": #link runprocess button
  117. control.button_down.connect(_run_process)
  118. elif control.get_meta("outputfunction") == "audioplayer": #link output audio player
  119. output_audio_player = control
  120. elif control.get_meta("outputfunction") == "filename":
  121. control.text = "outfile"
  122. outfilename = control
  123. elif control.get_meta("outputfunction") == "reusefolder":
  124. foldertoggle = control
  125. #foldertoggle.button_pressed = interface_settings.get("reuse_output_folder", true)
  126. elif control.get_meta("outputfunction") == "openfolder":
  127. control.button_down.connect(_open_output_folder)
  128. #for control in get_tree().get_nodes_in_group("inputnode"):
  129. #if control.get_meta("inputfunction") == "audioplayer": #link input for recycle function
  130. #print("input player found")
  131. #input_audio_player = control
  132. func check_user_preferences():
  133. var interface_settings = ConfigHandler.load_interface_settings()
  134. var audio_settings = ConfigHandler.load_audio_settings()
  135. var audio_devices = AudioServer.get_output_device_list()
  136. $Console.always_on_top = interface_settings.console_on_top
  137. if audio_devices.has(audio_settings.device):
  138. AudioServer.set_output_device(audio_settings.device)
  139. else:
  140. $AudioDevicePopup.popup_centered()
  141. match interface_settings.theme:
  142. 0:
  143. RenderingServer.set_default_clear_color(Color("#2f4f4e"))
  144. 1:
  145. RenderingServer.set_default_clear_color(Color("#000807"))
  146. 2:
  147. RenderingServer.set_default_clear_color(Color("#98d4d2"))
  148. 3:
  149. RenderingServer.set_default_clear_color(Color(interface_settings.theme_custom_colour))
  150. func show_cdp_location():
  151. $CdpLocationDialog.show()
  152. func check_cdp_location_set():
  153. #checks if the location has been set and prompts user to set it
  154. var cdpprogs_settings = ConfigHandler.load_cdpprogs_settings()
  155. if cdpprogs_settings.location == "no_location":
  156. $NoLocationPopup.popup_centered()
  157. else:
  158. #if location is set, stores it in a variable
  159. cdpprogs_location = str(cdpprogs_settings.location)
  160. print(cdpprogs_location)
  161. func _on_ok_button_button_down() -> void:
  162. #after user has read dialog on where to find cdp progs this loads the file browser
  163. $NoLocationPopup.hide()
  164. if OS.get_name() == "Windows":
  165. $CdpLocationDialog.current_dir = "C:/"
  166. else:
  167. $CdpLocationDialog.current_dir = OS.get_environment("HOME")
  168. $CdpLocationDialog.show()
  169. func _on_cdp_location_dialog_dir_selected(dir: String) -> void:
  170. #saves default location for cdp programs in config file
  171. ConfigHandler.save_cdpprogs_settings(dir)
  172. cdpprogs_location = dir
  173. func _on_cdp_location_dialog_canceled() -> void:
  174. #cycles around the set location prompt if user cancels the file dialog
  175. check_cdp_location_set()
  176. func _input(event):
  177. if event.is_action_pressed("undo"):
  178. simulate_mouse_click()
  179. await get_tree().process_frame
  180. undo_redo.undo()
  181. elif event.is_action_pressed("redo"):
  182. undo_redo.redo()
  183. elif event.is_action_pressed("save"):
  184. if currentfile == "none":
  185. savestate = "saveas"
  186. $SaveDialog.popup_centered()
  187. else:
  188. save_load.save_graph_edit(currentfile)
  189. elif event.is_action_pressed("open_explore"):
  190. open_explore()
  191. func simulate_mouse_click():
  192. #simulates clicking the middle mouse button in order to hide any visible tooltips
  193. var click_pos = get_viewport().get_mouse_position()
  194. var down_event := InputEventMouseButton.new()
  195. down_event.button_index = MOUSE_BUTTON_MIDDLE
  196. down_event.pressed = true
  197. down_event.position = click_pos
  198. Input.parse_input_event(down_event)
  199. var up_event := InputEventMouseButton.new()
  200. up_event.button_index = MOUSE_BUTTON_MIDDLE
  201. up_event.pressed = false
  202. up_event.position = click_pos
  203. Input.parse_input_event(up_event)
  204. func _run_process() -> void:
  205. #check if any of the inputfile nodes don't have files loaded
  206. for node in graph_edit.get_children():
  207. if node.get_meta("command") == "inputfile" and node.get_node("AudioPlayer").has_meta("inputfile") == false:
  208. $NoInputPopup.popup_centered()
  209. return
  210. #check if the reuse folder toggle is set and a folder has been previously chosen
  211. if foldertoggle.button_pressed == true and lastoutputfolder != "none":
  212. _on_file_dialog_dir_selected(lastoutputfolder)
  213. else:
  214. $FileDialog.show()
  215. func _on_file_dialog_dir_selected(dir: String) -> void:
  216. lastoutputfolder = dir
  217. console_output.clear()
  218. var interface_settings = ConfigHandler.load_interface_settings()
  219. if interface_settings.disable_progress_bar == false:
  220. $ProgressWindow.show()
  221. else:
  222. if $Console.is_visible():
  223. $Console.hide()
  224. await get_tree().process_frame # Wait a frame to allow hide to complete
  225. $Console.popup_centered()
  226. else:
  227. $Console.popup_centered()
  228. await get_tree().process_frame
  229. run_thread.log_console("Generating processing queue", true)
  230. await get_tree().process_frame
  231. #get the current time in hh-mm-ss format as default : causes file name issues
  232. var time_dict = Time.get_time_dict_from_system()
  233. # Pad with zeros to ensure two digits for hour, minute, second
  234. var hour = str(time_dict.hour).pad_zeros(2)
  235. var minute = str(time_dict.minute).pad_zeros(2)
  236. var second = str(time_dict.second).pad_zeros(2)
  237. var time_str = hour + "-" + minute + "-" + second
  238. Global.outfile = dir + "/" + outfilename.text.get_basename() + "_" + Time.get_date_string_from_system() + "_" + time_str
  239. run_thread.log_console("Output directory and file name(s):" + Global.outfile, true)
  240. await get_tree().process_frame
  241. run_thread.run_thread_with_branches()
  242. func _toggle_delete(toggled_on: bool):
  243. delete_intermediate_outputs = toggled_on
  244. print(toggled_on)
  245. func _on_console_close_requested() -> void:
  246. $Console.hide()
  247. func _on_console_open_folder_button_down() -> void:
  248. $Console.hide()
  249. OS.shell_open(Global.outfile.get_base_dir())
  250. func _on_ok_button_2_button_down() -> void:
  251. $NoInputPopup.hide()
  252. func _on_ok_button_3_button_down() -> void:
  253. $MultipleConnectionsPopup.hide()
  254. func _on_settings_button_index_pressed(index: int) -> void:
  255. var interface_settings = ConfigHandler.load_interface_settings()
  256. match index:
  257. 0:
  258. $Settings.popup_centered()
  259. 1:
  260. $AudioSettings.popup_centered()
  261. 2:
  262. if $Console.is_visible():
  263. $Console.hide()
  264. await get_tree().process_frame # Wait a frame to allow hide to complete
  265. $Console.popup_centered()
  266. else:
  267. $Console.popup_centered()
  268. func _on_file_button_index_pressed(index: int) -> void:
  269. match index:
  270. 0:
  271. if changesmade == true:
  272. savestate = "newfile"
  273. $SaveChangesPopup.popup_centered()
  274. else:
  275. new_patch()
  276. currentfile = "none" #reset current file to none for save tracking
  277. print("new patch, changes made =")
  278. print(changesmade)
  279. print("current file =")
  280. print(currentfile)
  281. 1:
  282. if currentfile == "none":
  283. savestate = "saveas"
  284. $SaveDialog.popup_centered()
  285. else:
  286. save_load.save_graph_edit(currentfile)
  287. print("save pressed, changes made =")
  288. print(changesmade)
  289. print("current file =")
  290. print(currentfile)
  291. 2:
  292. savestate = "saveas"
  293. $SaveDialog.popup_centered()
  294. 3:
  295. if changesmade == true:
  296. savestate = "load"
  297. $SaveChangesPopup.popup_centered()
  298. else:
  299. $LoadDialog.popup_centered()
  300. func _on_save_dialog_file_selected(path: String) -> void:
  301. save_load.save_graph_edit(path) #save file
  302. #check what the user was trying to do before save and do that action
  303. if savestate == "newfile":
  304. new_patch()
  305. currentfile = "none" #reset current file to none for save tracking
  306. elif savestate == "load":
  307. $LoadDialog.popup_centered()
  308. elif savestate == "helpfile":
  309. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  310. save_load.load_graph_edit(helpfile)
  311. elif savestate == "quit":
  312. await get_tree().create_timer(0.25).timeout #little pause so that it feels like it actually saved even though it did
  313. get_tree().quit()
  314. elif savestate == "saveas":
  315. currentfile = path
  316. savestate = "none" #reset save state, not really needed but feels good
  317. func _on_load_dialog_file_selected(path: String) -> void:
  318. currentfile = path #tracking path here only means "save" only saves patches the user has loaded rather than overwriting help files
  319. save_load.load_graph_edit(path)
  320. func _on_help_button_index_pressed(index: int) -> void:
  321. match index:
  322. 0:
  323. pass
  324. 1:
  325. if changesmade == true:
  326. savestate = "helpfile"
  327. helpfile = "res://examples/getting_started.thd"
  328. $SaveChangesPopup.popup_centered()
  329. else:
  330. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  331. save_load.load_graph_edit("res://examples/getting_started.thd")
  332. 2:
  333. if changesmade == true:
  334. savestate = "helpfile"
  335. helpfile = "res://examples/navigating.thd"
  336. $SaveChangesPopup.popup_centered()
  337. else:
  338. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  339. save_load.load_graph_edit("res://examples/navigating.thd")
  340. 3:
  341. if changesmade == true:
  342. savestate = "helpfile"
  343. helpfile = "res://examples/building_a_thread.thd"
  344. $SaveChangesPopup.popup_centered()
  345. else:
  346. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  347. save_load.load_graph_edit("res://examples/building_a_thread.thd")
  348. 4:
  349. if changesmade == true:
  350. savestate = "helpfile"
  351. helpfile = "res://examples/frequency_domain.thd"
  352. $SaveChangesPopup.popup_centered()
  353. else:
  354. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  355. save_load.load_graph_edit("res://examples/frequency_domain.thd")
  356. 5:
  357. if changesmade == true:
  358. savestate = "helpfile"
  359. helpfile = "res://examples/automation.thd"
  360. $SaveChangesPopup.popup_centered()
  361. else:
  362. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  363. save_load.load_graph_edit("res://examples/automation.thd")
  364. 6:
  365. if changesmade == true:
  366. savestate = "helpfile"
  367. helpfile = "res://examples/trimming.thd"
  368. $SaveChangesPopup.popup_centered()
  369. else:
  370. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  371. save_load.load_graph_edit("res://examples/trimming.thd")
  372. 7:
  373. pass
  374. 8:
  375. if changesmade == true:
  376. savestate = "helpfile"
  377. helpfile = "res://examples/wetdry.thd"
  378. $SaveChangesPopup.popup_centered()
  379. else:
  380. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  381. save_load.load_graph_edit("res://examples/wetdry.thd")
  382. 9:
  383. if changesmade == true:
  384. savestate = "helpfile"
  385. helpfile = "res://examples/resonant_filters.thd"
  386. $SaveChangesPopup.popup_centered()
  387. else:
  388. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  389. save_load.load_graph_edit("res://examples/resonant_filters.thd")
  390. 10:
  391. pass
  392. 11:
  393. OS.shell_open("https://www.composersdesktop.com/docs/html/ccdpndex.htm")
  394. 12:
  395. OS.shell_open("https://github.com/j-p-higgins/SoundThread/issues")
  396. #func _recycle_outfile():
  397. #if outfile != "no file":
  398. #input_audio_player.recycle_outfile(outfile)
  399. func _on_save_changes_button_down() -> void:
  400. $SaveChangesPopup.hide()
  401. if currentfile == "none":
  402. $SaveDialog.show()
  403. else:
  404. save_load.save_graph_edit(currentfile)
  405. if savestate == "newfile":
  406. new_patch()
  407. currentfile = "none" #reset current file to none for save tracking
  408. elif savestate == "load":
  409. $LoadDialog.popup_centered()
  410. elif savestate == "helpfile":
  411. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  412. save_load.load_graph_edit(helpfile)
  413. elif savestate == "quit":
  414. await get_tree().create_timer(0.25).timeout #little pause so that it feels like it actually saved even though it did
  415. get_tree().quit()
  416. savestate = "none"
  417. func _on_dont_save_changes_button_down() -> void:
  418. $SaveChangesPopup.hide()
  419. if savestate == "newfile":
  420. new_patch()
  421. currentfile = "none" #reset current file to none for save tracking
  422. elif savestate == "load":
  423. $LoadDialog.popup_centered()
  424. elif savestate == "helpfile":
  425. currentfile = "none" #reset current file to none for save tracking so user cant save over help file
  426. save_load.load_graph_edit(helpfile)
  427. elif savestate == "quit":
  428. get_tree().quit()
  429. savestate = "none"
  430. func _notification(what):
  431. if what == NOTIFICATION_WM_CLOSE_REQUEST:
  432. run_thread._on_kill_process_button_down()
  433. $Console.hide()
  434. if changesmade == true:
  435. savestate = "quit"
  436. $SaveChangesPopup.popup_centered()
  437. #$HelpWindow.hide()
  438. else:
  439. get_tree().quit() # default behavior
  440. func _open_output_folder():
  441. if lastoutputfolder != "none":
  442. OS.shell_open(lastoutputfolder)
  443. func _on_rich_text_label_meta_clicked(meta: Variant) -> void:
  444. print(str(meta))
  445. OS.shell_open(str(meta))
  446. func _on_graph_edit_popup_request(at_position: Vector2) -> void:
  447. effect_position = graph_edit.get_local_mouse_position()
  448. #get the mouse position in screen coordinates
  449. var mouse_screen_pos = DisplayServer.mouse_get_position()
  450. #get the window position in screen coordinates
  451. var window_screen_pos = get_window().position
  452. #get the window size relative to its scaling for retina displays
  453. var window_size = get_window().size * DisplayServer.screen_get_scale()
  454. #calculate the xy position of the mouse clamped to the size of the window and menu so it doesn't go off the screen
  455. var clamped_x = clamp(mouse_screen_pos.x, window_screen_pos.x, window_screen_pos.x + window_size.x - $SearchMenu.size.x)
  456. var clamped_y = clamp(mouse_screen_pos.y, window_screen_pos.y, window_screen_pos.y + window_size.y - (420 * DisplayServer.screen_get_scale()))
  457. #position and show the menu
  458. $SearchMenu.position = Vector2(clamped_x, clamped_y)
  459. $SearchMenu.popup()
  460. func _on_audio_settings_close_requested() -> void:
  461. $AudioSettings.hide()
  462. func _on_open_audio_settings_button_down() -> void:
  463. $AudioDevicePopup.hide()
  464. $AudioSettings.popup_centered()
  465. func _on_audio_device_popup_close_requested() -> void:
  466. $AudioDevicePopup.hide()
  467. func _on_mainmenu_close_requested() -> void:
  468. #closes menu if click is anywhere other than the menu as it is a window with popup set to true
  469. $mainmenu.hide()
  470. func open_explore():
  471. effect_position = graph_edit.get_local_mouse_position()
  472. #get the mouse position in screen coordinates
  473. var mouse_screen_pos = DisplayServer.mouse_get_position()
  474. #get the window position in screen coordinates
  475. var window_screen_pos = get_window().position
  476. #get the window size relative to its scaling for retina displays
  477. var window_size = get_window().size * DisplayServer.screen_get_scale()
  478. #get the size of the popup menu
  479. var popup_size = $mainmenu.size
  480. #calculate the xy position of the mouse clamped to the size of the window and menu so it doesn't go off the screen
  481. var clamped_x = clamp(mouse_screen_pos.x, window_screen_pos.x, window_screen_pos.x + window_size.x - popup_size.x)
  482. var clamped_y = clamp(mouse_screen_pos.y, window_screen_pos.y, window_screen_pos.y + window_size.y - popup_size.y)
  483. #position and show the menu
  484. $mainmenu.position = Vector2(clamped_x, clamped_y)
  485. $mainmenu.popup()
  486. func change_console_settings(toggled: bool):
  487. $Console.always_on_top = toggled
  488. func _on_kill_process_button_down() -> void:
  489. run_thread._on_kill_process_button_down()