Browse Source

fixed bug where "save as" didn't set the current file meaning that "save" would look at the last loaded file or no file if something hadn't been loaded

Jonathan Higgins 6 months ago
parent
commit
b1c117e747
2 changed files with 15 additions and 0 deletions
  1. 12 0
      scenes/main/scripts/control.gd
  2. 3 0
      scenes/main/scripts/save_load.gd

+ 12 - 0
scenes/main/scripts/control.gd

@@ -336,12 +336,22 @@ func _on_file_button_index_pressed(index: int) -> void:
 			else:
 				new_patch()
 				currentfile = "none" #reset current file to none for save tracking
+			
+			print("new patch, changes made =")
+			print(changesmade)
+			print("current file =")
+			print(currentfile)
 		1:
 			if currentfile == "none":
 				savestate = "saveas"
 				$SaveDialog.popup_centered()
 			else:
 				save_load.save_graph_edit(currentfile)
+			
+			print("save pressed, changes made =")
+			print(changesmade)
+			print("current file =")
+			print(currentfile)
 		2:
 			savestate = "saveas"
 			$SaveDialog.popup_centered()
@@ -368,6 +378,8 @@ func _on_save_dialog_file_selected(path: String) -> void:
 	elif savestate == "quit":
 		await get_tree().create_timer(0.25).timeout #little pause so that it feels like it actually saved even though it did
 		get_tree().quit()
+	elif savestate == "saveas":
+		currentfile = path
 		
 	savestate = "none" #reset save state, not really needed but feels good
 

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

@@ -95,6 +95,9 @@ func save_graph_edit(path: String):
 	print("Graph saved.")
 	control_script.changesmade = false
 	get_window().title = "SoundThread - " + path.get_file().trim_suffix(".thd")
+	
+	print("thread saved, changes made =")
+	print(control_script.changesmade)
 
 
 func load_graph_edit(path: String):