Kaynağa Gözat

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 ay önce
ebeveyn
işleme
b1c117e747

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

@@ -336,12 +336,22 @@ func _on_file_button_index_pressed(index: int) -> void:
 			else:
 			else:
 				new_patch()
 				new_patch()
 				currentfile = "none" #reset current file to none for save tracking
 				currentfile = "none" #reset current file to none for save tracking
+			
+			print("new patch, changes made =")
+			print(changesmade)
+			print("current file =")
+			print(currentfile)
 		1:
 		1:
 			if currentfile == "none":
 			if currentfile == "none":
 				savestate = "saveas"
 				savestate = "saveas"
 				$SaveDialog.popup_centered()
 				$SaveDialog.popup_centered()
 			else:
 			else:
 				save_load.save_graph_edit(currentfile)
 				save_load.save_graph_edit(currentfile)
+			
+			print("save pressed, changes made =")
+			print(changesmade)
+			print("current file =")
+			print(currentfile)
 		2:
 		2:
 			savestate = "saveas"
 			savestate = "saveas"
 			$SaveDialog.popup_centered()
 			$SaveDialog.popup_centered()
@@ -368,6 +378,8 @@ func _on_save_dialog_file_selected(path: String) -> void:
 	elif savestate == "quit":
 	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
 		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()
 		get_tree().quit()
+	elif savestate == "saveas":
+		currentfile = path
 		
 		
 	savestate = "none" #reset save state, not really needed but feels good
 	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.")
 	print("Graph saved.")
 	control_script.changesmade = false
 	control_script.changesmade = false
 	get_window().title = "SoundThread - " + path.get_file().trim_suffix(".thd")
 	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):
 func load_graph_edit(path: String):