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/space_sequencer/sequencer_edit.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/space_sequencer/sequencer_edit.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 38d61f02607..415bb5898a9 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -54,6 +54,7 @@
#include "RNA_prototypes.h"
/* For menu, popup, icons, etc. */
+#include "ED_fileselect.h"
#include "ED_keyframing.h"
#include "ED_numinput.h"
#include "ED_outliner.h"
@@ -3088,20 +3089,7 @@ static int sequencer_export_subtitles_invoke(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))
{
- Main *bmain = CTX_data_main(C);
- if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
- char filepath[FILE_MAX];
-
- if (BKE_main_blendfile_path(bmain)[0] == '\0') {
- BLI_strncpy(filepath, DATA_("untitled"), sizeof(filepath));
- }
- else {
- BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
- }
-
- BLI_path_extension_replace(filepath, sizeof(filepath), ".srt");
- RNA_string_set(op->ptr, "filepath", filepath);
- }
+ ED_fileselect_ensure_default_filepath(C, op, ".srt");
WM_event_add_fileselect(C, op);
@@ -3136,7 +3124,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
FILE *file;
char filepath[FILE_MAX];
- if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}