Browse Source

Added support for opening .thd files on launch from system files - fixed bug with console blocking quit

Jonathan Higgins 7 months ago
parent
commit
af3599d79f
3 changed files with 17 additions and 19 deletions
  1. 3 3
      export_presets.cfg
  2. 10 10
      scenes/main/control.gd
  3. 4 6
      scenes/main/control.tscn

+ 3 - 3
export_presets.cfg

@@ -9,7 +9,7 @@ custom_features=""
 export_filter="all_resources"
 include_filter="*.thd, export_presets.cfg"
 exclude_filter=""
-export_path="../SoundThread_Exports/v0.1.2-alpha/SoundThread.exe"
+export_path="../SoundThread_Exports/SoundThread.exe"
 patches=PackedStringArray()
 encryption_include_filters=""
 encryption_exclude_filters=""
@@ -37,8 +37,8 @@ application/modify_resources=true
 application/icon=""
 application/console_wrapper_icon=""
 application/icon_interpolation=4
-application/file_version="0.1.2"
-application/product_version="0.1.2"
+application/file_version="0.1.3"
+application/product_version="0.1.3"
 application/company_name="Jonathan Higgins"
 application/product_name="SoundThread"
 application/file_description="Node Based UI for CDP"

+ 10 - 10
scenes/main/control.gd

@@ -68,7 +68,14 @@ func _ready() -> void:
 		for window in get_tree().get_nodes_in_group("popup_windows"):
 			window.size = window.size * 2
 			window.content_scale_factor = 2
-	
+
+	#checks if user has opened a file from the system file menu and loads it
+	var args = OS.get_cmdline_args()
+	for arg in args:
+		var path = arg.strip_edges()
+		if FileAccess.file_exists(path) and path.get_extension().to_lower() == "thd":
+			load_graph_edit(path)
+			break
 	
 func new_patch():
 	#clear old patch
@@ -1459,16 +1466,8 @@ func _on_help_button_index_pressed(index: int) -> void:
 				currentfile = "none" #reset current file to none for save tracking so user cant save over help file
 				load_graph_edit("res://examples/frequency_domain.thd")
 		5:
-			if changesmade == true:
-				savestate = "helpfile"
-				helpfile = "res://examples/quirks.thd"
-				$SaveChangesPopup.show()
-			else:
-				currentfile = "none" #reset current file to none for save tracking so user cant save over help file
-				load_graph_edit("res://examples/quirks.thd")
-		6:
 			pass
-		7:
+		6:
 			OS.shell_open("https://www.composersdesktop.com/docs/html/cdphome.htm")
 
 func _recycle_outfile():
@@ -1515,6 +1514,7 @@ func _on_dont_save_changes_button_down() -> void:
 	
 func _notification(what):
 	if what == NOTIFICATION_WM_CLOSE_REQUEST:
+		$Console.hide()
 		if changesmade == true:
 			savestate = "quit"
 			$SaveChangesPopup.show()

+ 4 - 6
scenes/main/control.tscn

@@ -236,7 +236,7 @@ item_3/id = 3
 [node name="HelpButton" type="PopupMenu" parent="MenuBar"]
 auto_translate_mode = 1
 title = "Help"
-item_count = 8
+item_count = 7
 item_0/text = "Tutorials"
 item_0/id = 0
 item_0/separator = true
@@ -248,13 +248,11 @@ item_3/text = "Building a Thread"
 item_3/id = 3
 item_4/text = "Frequency Domain"
 item_4/id = 4
-item_5/text = "SoundThread Quirks"
+item_5/text = "Other Help"
 item_5/id = 5
-item_6/text = "Other Help"
+item_5/separator = true
+item_6/text = "CDP Documentation"
 item_6/id = 6
-item_6/separator = true
-item_7/text = "CDP Documentation"
-item_7/id = 7
 
 [node name="About" type="PopupMenu" parent="MenuBar"]
 item_count = 1