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:
Diffstat (limited to 'source/blender/editors/io/io_gpencil_export.c')
-rw-r--r--source/blender/editors/io/io_gpencil_export.c40
1 files changed, 12 insertions, 28 deletions
diff --git a/source/blender/editors/io/io_gpencil_export.c b/source/blender/editors/io/io_gpencil_export.c
index 6e5ae9f3cba..12d87113a66 100644
--- a/source/blender/editors/io/io_gpencil_export.c
+++ b/source/blender/editors/io/io_gpencil_export.c
@@ -20,6 +20,8 @@
# include "BLT_translation.h"
+# include "ED_fileselect.h"
+
# include "RNA_access.h"
# include "RNA_define.h"
@@ -71,24 +73,6 @@ static void gpencil_export_common_props_definition(wmOperatorType *ot)
"Normalize",
"Export strokes with constant thickness");
}
-
-static void set_export_filepath(bContext *C, wmOperator *op, const char *extension)
-{
- if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
- Main *bmain = CTX_data_main(C);
- char filepath[FILE_MAX];
-
- if (BKE_main_blendfile_path(bmain)[0] == '\0') {
- BLI_strncpy(filepath, "untitled", sizeof(filepath));
- }
- else {
- BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
- }
-
- BLI_path_extension_replace(filepath, sizeof(filepath), extension);
- RNA_string_set(op->ptr, "filepath", filepath);
- }
-}
# endif
/* <-------- SVG single frame export. --------> */
@@ -109,7 +93,7 @@ static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *
static int wm_gpencil_export_svg_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- set_export_filepath(C, op, ".svg");
+ ED_fileselect_ensure_default_filepath(C, op, ".svg");
WM_event_add_fileselect(C, op);
@@ -121,7 +105,7 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- 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;
}
@@ -153,9 +137,9 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
.v3d = v3d,
.ob = ob,
.mode = GP_EXPORT_TO_SVG,
- .frame_start = CFRA,
- .frame_end = CFRA,
- .frame_cur = CFRA,
+ .frame_start = scene->r.cfra,
+ .frame_end = scene->r.cfra,
+ .frame_cur = scene->r.cfra,
.flag = flag,
.scale = 1.0f,
.select_mode = select_mode,
@@ -264,7 +248,7 @@ static bool wm_gpencil_export_pdf_common_check(bContext *UNUSED(C), wmOperator *
static int wm_gpencil_export_pdf_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- set_export_filepath(C, op, ".pdf");
+ ED_fileselect_ensure_default_filepath(C, op, ".pdf");
WM_event_add_fileselect(C, op);
@@ -276,7 +260,7 @@ static int wm_gpencil_export_pdf_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- 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;
}
@@ -306,9 +290,9 @@ static int wm_gpencil_export_pdf_exec(bContext *C, wmOperator *op)
.v3d = v3d,
.ob = ob,
.mode = GP_EXPORT_TO_PDF,
- .frame_start = SFRA,
- .frame_end = EFRA,
- .frame_cur = CFRA,
+ .frame_start = scene->r.sfra,
+ .frame_end = scene->r.efra,
+ .frame_cur = scene->r.cfra,
.flag = flag,
.scale = 1.0f,
.select_mode = select_mode,