From 0ee4ae89e49bb7036ef9cbd48e00511cf3b5d593 Mon Sep 17 00:00:00 2001 From: Jonas Holzman Date: Mon, 13 Jan 2025 20:06:27 +0100 Subject: [PATCH] UI: Capitalize default filenames from "untitled" to "Untitled" Capitalize the default filename used for .blend files and other savable and exportable file formats (like images, 3D formats, etc.) from "untitled" to "Untitled". Pull Request: https://projects.blender.org/blender/blender/pulls/132424 --- scripts/modules/bpy_extras/io_utils.py | 2 +- source/blender/blenkernel/intern/file_handler.cc | 4 +++- source/blender/blenkernel/intern/image_save.cc | 2 +- source/blender/editors/space_file/filesel.cc | 2 +- source/blender/windowmanager/intern/wm_files.cc | 6 +++--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/modules/bpy_extras/io_utils.py b/scripts/modules/bpy_extras/io_utils.py index dddc868d6cb..341200a4a51 100644 --- a/scripts/modules/bpy_extras/io_utils.py +++ b/scripts/modules/bpy_extras/io_utils.py @@ -64,7 +64,7 @@ class ExportHelper: if not self.filepath: blend_filepath = context.blend_data.filepath if not blend_filepath: - blend_filepath = data_("untitled") + blend_filepath = data_("Untitled") else: blend_filepath = os.path.splitext(blend_filepath)[0] diff --git a/source/blender/blenkernel/intern/file_handler.cc b/source/blender/blenkernel/intern/file_handler.cc index c21d5499ba5..c9026e70c4e 100644 --- a/source/blender/blenkernel/intern/file_handler.cc +++ b/source/blender/blenkernel/intern/file_handler.cc @@ -9,6 +9,8 @@ #include "BLI_path_utils.hh" #include "BLI_string.h" +#include "BLT_translation.hh" + namespace blender::bke { static Vector> &file_handlers_vector() @@ -130,7 +132,7 @@ std::string FileHandlerType::get_default_filename(const StringRefNull name) std::all_of(name.begin(), name.end(), [](char c) { return c == ' '; }); char filename[FILE_MAXFILE]; - STRNCPY(filename, all_blank ? "untitled" : name.c_str()); + STRNCPY(filename, all_blank ? DATA_("Untitled") : name.c_str()); BLI_path_extension_ensure(filename, sizeof(filename), file_extensions.is_empty() ? "" : file_extensions.first().c_str()); diff --git a/source/blender/blenkernel/intern/image_save.cc b/source/blender/blenkernel/intern/image_save.cc index 5a5947c345d..87d113ea1c3 100644 --- a/source/blender/blenkernel/intern/image_save.cc +++ b/source/blender/blenkernel/intern/image_save.cc @@ -173,7 +173,7 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts, STRNCPY(opts->filepath, G.filepath_last_image); } else { - BLI_path_join(opts->filepath, sizeof(opts->filepath), "//", DATA_("untitled")); + BLI_path_join(opts->filepath, sizeof(opts->filepath), "//", DATA_("Untitled")); BLI_path_abs(opts->filepath, BKE_main_blendfile_path(bmain)); } } diff --git a/source/blender/editors/space_file/filesel.cc b/source/blender/editors/space_file/filesel.cc index 734a2ab91f6..a054d84e86f 100644 --- a/source/blender/editors/space_file/filesel.cc +++ b/source/blender/editors/space_file/filesel.cc @@ -1471,7 +1471,7 @@ void ED_fileselect_ensure_default_filepath(bContext *C, wmOperator *op, const ch const char *blendfile_path = BKE_main_blendfile_path(bmain); if (blendfile_path[0] == '\0') { - STRNCPY(filepath, DATA_("untitled")); + STRNCPY(filepath, DATA_("Untitled")); } else { STRNCPY(filepath, blendfile_path); diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index 942bcca74d1..87ad824fdf7 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -3558,7 +3558,7 @@ static void wm_filepath_default(const Main *bmain, char *filepath) { if (bmain->filepath[0] == '\0') { char filename_untitled[FILE_MAXFILE]; - SNPRINTF(filename_untitled, "%s.blend", DATA_("untitled")); + SNPRINTF(filename_untitled, "%s.blend", DATA_("Untitled")); BLI_path_filename_ensure(filepath, FILE_MAX, filename_untitled); } } @@ -4402,7 +4402,7 @@ static uiBlock *block_create_save_file_overwrite_dialog(bContext *C, ARegion *re BLI_path_split_file_part(blendfile_path, filename, sizeof(filename)); } else { - SNPRINTF(filename, "%s.blend", DATA_("untitled")); + SNPRINTF(filename, "%s.blend", DATA_("Untitled")); /* Since this dialog should only be shown when re-saving an existing file, current filepath * should never be empty. */ BLI_assert_unreachable(); @@ -4621,7 +4621,7 @@ static uiBlock *block_create__close_file_dialog(bContext *C, ARegion *region, vo BLI_path_split_file_part(blendfile_path, filename, sizeof(filename)); } else { - SNPRINTF(filename, "%s.blend", DATA_("untitled")); + SNPRINTF(filename, "%s.blend", DATA_("Untitled")); } uiItemL(layout, filename, ICON_NONE);