Browse Source

fixed bug with redo not existing throwing tons of errors to the console and added experimental option to load soundfiles directly with soundthread

Jonathan Higgins 3 months ago
parent
commit
0d2a583ac8
4 changed files with 16 additions and 3 deletions
  1. 1 1
      export_presets.cfg
  2. 4 0
      project.godot
  3. 8 2
      scenes/main/scripts/control.gd
  4. 3 0
      scenes/main/scripts/graph_edit.gd

+ 1 - 1
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.3.0-beta/SoundThread_v0.3.0-beta_windows/SoundThread.exe"
+export_path="../SoundThread_Exports/SoundThread_test.exe"
 patches=PackedStringArray()
 encryption_include_filters=""
 encryption_exclude_filters=""

+ 4 - 0
project.godot

@@ -88,6 +88,10 @@ auto_link_nodes={
 "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":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
 ]
 }
+redo={
+"deadzone": 0.2,
+"events": []
+}
 
 [rendering]
 

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

@@ -19,6 +19,7 @@ var lastoutputfolder = "none" #tracks last output folder, this can in future be
 var uiscale = 1.0 #tracks scaling for retina screens
 var use_anyway #used to store the folder selected for cdprogs when it appears the wrong folder is selected but the user wants to use it anyway
 var main_theme = preload("res://theme/main_theme.tres") #load the theme
+var default_input_node #stores a reference to the input node created on launch to allow auto loading a wav file
 
 
 #scripts
@@ -58,6 +59,7 @@ func _ready() -> void:
 	check_user_preferences()
 	hidpi_adjustment()
 	new_patch()
+	await get_tree().process_frame
 	load_from_filesystem()
 	check_cdp_location_set()
 	
@@ -105,6 +107,9 @@ func load_from_filesystem():
 		if FileAccess.file_exists(path) and path.get_extension().to_lower() == "thd":
 			save_load.load_graph_edit(path)
 			break
+		if FileAccess.file_exists(path) and path.get_extension().to_lower() == "wav":
+			default_input_node.get_node("AudioPlayer")._on_file_selected(path)
+			break
 
 func new_patch():
 	#clear old patch
@@ -124,6 +129,7 @@ func new_patch():
 	get_node("GraphEdit").add_child(effect, true)
 	effect.connect("open_help", Callable(open_help, "show_help_for_node"))
 	effect.position_offset = Vector2(20,80)
+	default_input_node = effect #store a reference to this node to allow for loading into it directly if software launched with a wav file argument
 	
 	effect = Nodes.get_node(NodePath("outputfile")).duplicate()
 	effect.name = "outputfile"
@@ -263,8 +269,8 @@ func _input(event):
 		simulate_mouse_click()
 		await get_tree().process_frame
 		undo_redo.undo()
-	elif event.is_action_pressed("redo"):
-		undo_redo.redo()
+	#elif event.is_action_pressed("redo"):
+		#undo_redo.redo()
 	elif event.is_action_pressed("save"):
 		if currentfile == "none":
 			savestate = "saveas"

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

@@ -760,6 +760,7 @@ func _auto_link_nodes(node: GraphNode, rect: Rect2):
 				#connect in the middle of the two nodes if they are the same port type
 				var from_matches = _same_port_type(from, from_port, new_node_name, 0)
 				var to_matches = _same_port_type(new_node_name, 0, to, to_port)
+				
 				if from_matches:
 					_on_connection_request(from, from_port, new_node_name, 0)
 				if to_matches:
@@ -769,10 +770,12 @@ func _auto_link_nodes(node: GraphNode, rect: Rect2):
 					_on_graph_edit_disconnection_request(from, from_port, to, to_port)
 
 			elif new_node_has_inputs:
+				#only has inputs check if the ports match and if they do connect but leave original connection in place
 				if _same_port_type(from, from_port, new_node_name, 0):
 					_on_connection_request(from, from_port, new_node_name, 0)
 					
 			elif new_node_has_outputs:
+				#only has outputs check if the ports match and if they do connect but leave original connection in place
 				if _same_port_type(new_node_name, 0, to, to_port):
 					_on_connection_request(new_node_name, 0, to, to_port)