[Bf-blender-cvs] [74ebba2f97a] greasepencil-object: GPencil: Reorganize SVG export parameters This fix several compiler warnings
Antonio Vazquez
noreply at git.blender.org
Thu Aug 13 11:27:05 CEST 2020
Commit: 74ebba2f97a65811d448a07ee1f5c631a4bcc5e9
Author: Antonio Vazquez
Date: Thu Aug 13 11:11:27 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB74ebba2f97a65811d448a07ee1f5c631a4bcc5e9
GPencil: Reorganize SVG export parameters This fix several compiler warnings
===================================================================
M source/blender/editors/io/io_gpencil.c
M source/blender/io/gpencil/gpencil_io_exporter.h
M source/blender/io/gpencil/intern/gpencil_io_capi.cc
M source/blender/io/gpencil/intern/gpencil_io_export_base.cc
M source/blender/io/gpencil/intern/gpencil_io_export_base.h
===================================================================
diff --git a/source/blender/editors/io/io_gpencil.c b/source/blender/editors/io/io_gpencil.c
index 5692b1f04a4..653d46d8931 100644
--- a/source/blender/editors/io/io_gpencil.c
+++ b/source/blender/editors/io/io_gpencil.c
@@ -244,7 +244,6 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
.region = region,
.v3d = v3d,
.obact = ob,
- .filename = filename,
.mode = GP_EXPORT_TO_SVG,
.frame_start = CFRA,
.frame_end = CFRA,
@@ -260,7 +259,7 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
/* Do export. */
WM_cursor_wait(1);
- bool done = gpencil_io_export(¶ms);
+ bool done = gpencil_io_export(filename, ¶ms);
WM_cursor_wait(0);
if (done) {
@@ -291,7 +290,7 @@ static void ui_gpencil_export_svg_settings(uiLayout *layout, PointerRNA *imfptr)
ui_gpencil_export_common_settings(layout, imfptr, false);
}
-static void wm_gpencil_export_svg_draw(bContext *C, wmOperator *op)
+static void wm_gpencil_export_svg_draw(bContext *UNUSED(C), wmOperator *op)
{
PointerRNA ptr;
@@ -422,7 +421,6 @@ static int wm_gpencil_export_stb_exec(bContext *C, wmOperator *op)
.region = region,
.v3d = v3d,
.obact = ob,
- .filename = filename,
.mode = GP_EXPORT_TO_SVG,
.frame_start = RNA_int_get(op->ptr, "start"),
.frame_end = RNA_int_get(op->ptr, "end"),
@@ -446,7 +444,7 @@ static int wm_gpencil_export_stb_exec(bContext *C, wmOperator *op)
/* Do export. */
WM_cursor_wait(1);
- bool done = gpencil_io_export(¶ms);
+ bool done = gpencil_io_export(filename, ¶ms);
WM_cursor_wait(0);
if (done) {
diff --git a/source/blender/io/gpencil/gpencil_io_exporter.h b/source/blender/io/gpencil/gpencil_io_exporter.h
index 26ce7a5055e..e4e91dd6bcc 100644
--- a/source/blender/io/gpencil/gpencil_io_exporter.h
+++ b/source/blender/io/gpencil/gpencil_io_exporter.h
@@ -36,8 +36,6 @@ struct GpencilExportParams {
View3D *v3d;
/** Grease pencil object. */
struct Object *obact;
- /** Output filename. */
- char *filename;
/** Export mode. */
short mode;
/** Start frame. */
@@ -102,7 +100,7 @@ typedef enum eGpencilExportText {
GP_EXPORT_TXT_SHOT_FRAME = 3,
} eGpencilExportText;
-bool gpencil_io_export(struct GpencilExportParams *iparams);
+bool gpencil_io_export(const char *filename, struct GpencilExportParams *iparams);
#ifdef __cplusplus
}
diff --git a/source/blender/io/gpencil/intern/gpencil_io_capi.cc b/source/blender/io/gpencil/intern/gpencil_io_capi.cc
index 69c8720df32..93213f2781e 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_capi.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_capi.cc
@@ -202,7 +202,7 @@ static bool gpencil_export_storyboard(
}
/* Main export entry point function. */
-bool gpencil_io_export(GpencilExportParams *iparams)
+bool gpencil_io_export(const char *filename, GpencilExportParams *iparams)
{
Main *bmain = CTX_data_main(iparams->C);
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(iparams->C);
@@ -218,6 +218,9 @@ bool gpencil_io_export(GpencilExportParams *iparams)
if (!is_storyboard) {
GpencilExporterSVG writter = GpencilExporterSVG(iparams);
+ /* Prepare output filename with full path. */
+ writter.set_out_filename(filename);
+
float no_offset[2] = {0.0f, 0.0f};
float ratio[2] = {1.0f, 1.0f};
writter.set_frame_ratio(ratio);
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_base.cc b/source/blender/io/gpencil/intern/gpencil_io_export_base.cc
index b3cddea67dd..9f1dc0d5b98 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_base.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_base.cc
@@ -63,7 +63,6 @@ GpencilExporter::GpencilExporter(const struct GpencilExportParams *iparams)
params_.region = iparams->region;
params_.v3d = iparams->v3d;
params_.C = iparams->C;
- params_.filename = iparams->filename;
params_.mode = iparams->mode;
params_.flag = iparams->flag;
params_.select = iparams->select;
@@ -129,9 +128,6 @@ GpencilExporter::GpencilExporter(const struct GpencilExportParams *iparams)
offset_[1] = boundbox.ymin;
}
}
-
- /* Prepare output filename with full path. */
- set_out_filename(params_.filename);
}
/** Create a list of selected objects sorted from back to front */
@@ -187,7 +183,7 @@ void GpencilExporter::create_object_list(void)
* \param C: Context.
* \param filename: Path of the file provided by save dialog.
*/
-void GpencilExporter::set_out_filename(char *filename)
+void GpencilExporter::set_out_filename(const char *filename)
{
BLI_strncpy(out_filename_, filename, FILE_MAX);
BLI_path_abs(out_filename_, BKE_main_blendfile_path(bmain));
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_base.h b/source/blender/io/gpencil/intern/gpencil_io_export_base.h
index b43ac6cd3ce..b6519806a84 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_base.h
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_base.h
@@ -49,11 +49,11 @@ class GpencilExporter {
const bool body,
const bool savepage) = 0;
+ void set_out_filename(const char *filename);
void set_frame_number(int value);
void set_frame_offset(float value[2]);
void set_frame_ratio(float value[2]);
void set_frame_box(float value[2]);
- void set_file_subfix(char *value);
void set_shot(int value);
protected:
@@ -128,8 +128,6 @@ class GpencilExporter {
float avg_opacity;
bool is_camera;
rctf select_box;
-
- void set_out_filename(char *filename);
};
} // namespace blender::io::gpencil
More information about the Bf-blender-cvs
mailing list