From 5d65e820708ed7586fdb7f0ac4633f7b468ec73d Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Thu, 7 Jul 2022 17:39:16 +0300 Subject: [PATCH] Fix issue with save file dialog taking the name of the first file it sees Instead of using the project's name. This could've caused issues if the user accidentally replaced the previous file. --- src/UI/TopMenuContainer.gd | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/UI/TopMenuContainer.gd b/src/UI/TopMenuContainer.gd index 97811cba2..2acffcf61 100644 --- a/src/UI/TopMenuContainer.gd +++ b/src/UI/TopMenuContainer.gd @@ -357,8 +357,9 @@ func _on_open_last_project_file_menu_option_pressed() -> void: func _save_project_file() -> void: Global.control.is_quitting_on_save = false - var path = OpenSave.current_save_paths[Global.current_project_index] + var path: String = OpenSave.current_save_paths[Global.current_project_index] if path == "": + Global.dialog_open(true) if OS.get_name() == "HTML5": var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog var save_filename = save_dialog.get_node("FileNameContainer/FileNameLineEdit") @@ -366,14 +367,15 @@ func _save_project_file() -> void: save_filename.text = Global.current_project.name else: Global.save_sprites_dialog.popup_centered() - Global.save_sprites_dialog.current_file = Global.current_project.name - Global.dialog_open(true) + yield(get_tree(), "idle_frame") + Global.save_sprites_dialog.get_line_edit().text = Global.current_project.name else: Global.control.save_project(path) func _save_project_file_as() -> void: Global.control.is_quitting_on_save = false + Global.dialog_open(true) if OS.get_name() == "HTML5": var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog var save_filename = save_dialog.get_node("FileNameContainer/FileNameLineEdit") @@ -381,8 +383,8 @@ func _save_project_file_as() -> void: save_filename.text = Global.current_project.name else: Global.save_sprites_dialog.popup_centered() - Global.save_sprites_dialog.current_file = Global.current_project.name - Global.dialog_open(true) + yield(get_tree(), "idle_frame") + Global.save_sprites_dialog.get_line_edit().text = Global.current_project.name func _export_file() -> void: