1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +00:00

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.
This commit is contained in:
Emmanouil Papadeas 2022-07-07 17:39:16 +03:00
parent f8c74948b3
commit 5d65e82070

View file

@ -357,8 +357,9 @@ func _on_open_last_project_file_menu_option_pressed() -> void:
func _save_project_file() -> void: func _save_project_file() -> void:
Global.control.is_quitting_on_save = false 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 == "": if path == "":
Global.dialog_open(true)
if OS.get_name() == "HTML5": if OS.get_name() == "HTML5":
var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog
var save_filename = save_dialog.get_node("FileNameContainer/FileNameLineEdit") 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 save_filename.text = Global.current_project.name
else: else:
Global.save_sprites_dialog.popup_centered() Global.save_sprites_dialog.popup_centered()
Global.save_sprites_dialog.current_file = Global.current_project.name yield(get_tree(), "idle_frame")
Global.dialog_open(true) Global.save_sprites_dialog.get_line_edit().text = Global.current_project.name
else: else:
Global.control.save_project(path) Global.control.save_project(path)
func _save_project_file_as() -> void: func _save_project_file_as() -> void:
Global.control.is_quitting_on_save = false Global.control.is_quitting_on_save = false
Global.dialog_open(true)
if OS.get_name() == "HTML5": if OS.get_name() == "HTML5":
var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog
var save_filename = save_dialog.get_node("FileNameContainer/FileNameLineEdit") 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 save_filename.text = Global.current_project.name
else: else:
Global.save_sprites_dialog.popup_centered() Global.save_sprites_dialog.popup_centered()
Global.save_sprites_dialog.current_file = Global.current_project.name yield(get_tree(), "idle_frame")
Global.dialog_open(true) Global.save_sprites_dialog.get_line_edit().text = Global.current_project.name
func _export_file() -> void: func _export_file() -> void: