Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@nesnausk.org>2022-09-07 13:27:27 +0300
committerAras Pranckevicius <aras@nesnausk.org>2022-09-07 13:27:27 +0300
commit13a7516f436597e7f60d0696afa16e8e6d6735fb (patch)
tree50672e9b503e3e875b7789006d0009d540041151 /source/blender/editors/io/io_usd.c
parent97bd04d665cb8c964e9159da94a3c7941cd4841c (diff)
Cleanup: factor out "set default filepath" into a ED_fileselect_ensure_default_filepath
Follow up to D15904, a bunch of places had exact same logic for "is filepath set? if not, set some default one", so factor all that out into a separate ED_fileselect_ensure_default_filepath function.
Diffstat (limited to 'source/blender/editors/io/io_usd.c')
-rw-r--r--source/blender/editors/io/io_usd.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c
index 14b8c6e4184..74ce0cca16c 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -21,6 +21,7 @@
# include "BLT_translation.h"
+# include "ED_fileselect.h"
# include "ED_object.h"
# include "MEM_guardedalloc.h"
@@ -84,21 +85,7 @@ static int wm_usd_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
options->as_background_job = true;
op->customdata = options;
- if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
- Main *bmain = CTX_data_main(C);
- char filepath[FILE_MAX];
- const char *main_blendfile_path = BKE_main_blendfile_path(bmain);
-
- if (main_blendfile_path[0] == '\0') {
- BLI_strncpy(filepath, DATA_("untitled"), sizeof(filepath));
- }
- else {
- BLI_strncpy(filepath, main_blendfile_path, sizeof(filepath));
- }
-
- BLI_path_extension_replace(filepath, sizeof(filepath), ".usdc");
- RNA_string_set(op->ptr, "filepath", filepath);
- }
+ ED_fileselect_ensure_default_filepath(C, op, ".usdc");
WM_event_add_fileselect(C, op);