diff --git a/Translations/Translations.pot b/Translations/Translations.pot index 58b0a4017..80172120d 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -91,6 +91,9 @@ msgstr "" msgid "Export" msgstr "" +msgid "Overwrite" +msgstr "" + msgid "Export..." msgstr "" diff --git a/src/Autoload/Export.gd b/src/Autoload/Export.gd index befd3d9d8..c4b4f55fa 100644 --- a/src/Autoload/Export.gd +++ b/src/Autoload/Export.gd @@ -220,9 +220,14 @@ func export_processed_images(ignore_overwrites: bool, export_dialog: AcceptDialo # Store settings for quick export and when the dialog is opened again was_exported = true Global.current_project.was_exported = true - Global.top_menu_container.file_menu.set_item_text( - 6, tr("Export") + " %s" % (file_name + file_format_string(file_format)) - ) + if Global.current_project.export_overwrite: + Global.top_menu_container.file_menu.set_item_text( + 6, tr("Overwrite") + " %s" % (file_name + Export.file_format_string(file_format)) + ) + else: + Global.top_menu_container.file_menu.set_item_text( + 6, tr("Export") + " %s" % (file_name + file_format_string(file_format)) + ) # Only show when not exporting gif - gif export finishes in thread if not (current_tab == ExportTab.ANIMATION and animation_type == AnimationType.ANIMATED): diff --git a/src/Autoload/OpenSave.gd b/src/Autoload/OpenSave.gd index 0078ba7ac..d8c202176 100644 --- a/src/Autoload/OpenSave.gd +++ b/src/Autoload/OpenSave.gd @@ -598,8 +598,6 @@ func open_image_as_new_layer(image: Image, file_name: String, frame_index := 0) func set_new_imported_tab(project: Project, path: String) -> void: var prev_project_empty: bool = Global.current_project.is_empty() var prev_project_pos: int = Global.current_project_index - Global.tabs.current_tab = Global.tabs.get_tab_count() - 1 - Global.canvas.camera_zoom() Global.window_title = ( path.get_file() @@ -614,8 +612,15 @@ func set_new_imported_tab(project: Project, path: String) -> void: var directory_path := path.get_basename().replace(file_name, "") project.directory_path = directory_path project.file_name = file_name + project.was_exported = true + if path.get_extension().to_lower() == "png": + project.export_overwrite = true Export.directory_path = directory_path Export.file_name = file_name + Export.was_exported = true + + Global.tabs.current_tab = Global.tabs.get_tab_count() - 1 + Global.canvas.camera_zoom() if prev_project_empty: Global.tabs.delete_tab(prev_project_pos) diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 295602e8e..6c27cd2c0 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -43,6 +43,7 @@ var directory_path := "" var file_name := "untitled" var file_format: int = Export.FileFormat.PNG var was_exported := false +var export_overwrite := false var frame_button_node = preload("res://src/UI/Timeline/FrameButton.tscn") var layer_button_node = preload("res://src/UI/Timeline/LayerButton.tscn") @@ -246,9 +247,14 @@ func change_project() -> void: if !was_exported: Global.top_menu_container.file_menu.set_item_text(6, tr("Export")) else: - Global.top_menu_container.file_menu.set_item_text( - 6, tr("Export") + " %s" % (file_name + Export.file_format_string(file_format)) - ) + if export_overwrite: + Global.top_menu_container.file_menu.set_item_text( + 6, tr("Overwrite") + " %s" % (file_name + Export.file_format_string(file_format)) + ) + else: + Global.top_menu_container.file_menu.set_item_text( + 6, tr("Export") + " %s" % (file_name + Export.file_format_string(file_format)) + ) for j in Global.TileMode.values(): Global.top_menu_container.tile_mode_submenu.set_item_checked(j, j == tile_mode) diff --git a/src/UI/Dialogs/ExportDialog.gd b/src/UI/Dialogs/ExportDialog.gd index 94bd1d671..f0e528f05 100644 --- a/src/UI/Dialogs/ExportDialog.gd +++ b/src/UI/Dialogs/ExportDialog.gd @@ -314,6 +314,7 @@ func _on_Interpolation_item_selected(id: int) -> void: func _on_ExportDialog_confirmed() -> void: + Global.current_project.export_overwrite = false if Export.export_processed_images(false, self): hide()