Commit: b00bc42dd00ee83d6599720a996fd171252f529a
Author: Antonio Vazquez
Date:   Sat Aug 1 20:53:43 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb00bc42dd00ee83d6599720a996fd171252f529a

GPencil: Add sampling parameter to SVG export

===================================================================

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_base.cc
M       source/blender/io/gpencil/intern/gpencil_io_svg.cc

===================================================================

diff --git a/source/blender/editors/io/io_gpencil.c 
b/source/blender/editors/io/io_gpencil.c
index d24d9236add..75a7cf52735 100644
--- a/source/blender/editors/io/io_gpencil.c
+++ b/source/blender/editors/io/io_gpencil.c
@@ -188,6 +188,7 @@ static int wm_gpencil_export_exec(bContext *C, wmOperator 
*op)
       .frame_start = RNA_int_get(op->ptr, "start"),
       .frame_end = RNA_int_get(op->ptr, "end"),
       .flag = flag,
+      .stroke_sample = RNA_float_get(op->ptr, "stroke_sample"),
   };
   /* Take some defaults from the scene, if not specified explicitly. */
   Scene *scene = CTX_data_scene(C);
@@ -269,6 +270,7 @@ static void ui_gpencil_export_settings(uiLayout *layout, 
PointerRNA *imfptr)
   uiItemR(sub, imfptr, "use_fill", 0, NULL, ICON_NONE);
   uiItemR(sub, imfptr, "use_normalized_thickness", 0, NULL, ICON_NONE);
   uiItemR(sub, imfptr, "use_clip_camera", 0, NULL, ICON_NONE);
+  uiItemR(sub, imfptr, "stroke_sample", 0, NULL, ICON_NONE);
 }
 
 static void wm_gpencil_export_draw(bContext *C, wmOperator *op)
@@ -385,6 +387,15 @@ void WM_OT_gpencil_export(wmOperatorType *ot)
                   false,
                   "Clip Camera",
                   "Clip drawings to camera size when export in camera view");
+  RNA_def_float(ot->srna,
+                "stroke_sample",
+                0.03f,
+                0.0f,
+                100.0f,
+                "Sampling",
+                "Precision of sampling stroke, set to zero to disable",
+                0.0f,
+                100.0f);
 
   /* This dummy prop is used to check whether we need to init the start and
    * end frame values to that of the scene's, otherwise they are reset at
diff --git a/source/blender/io/gpencil/gpencil_io_exporter.h 
b/source/blender/io/gpencil/gpencil_io_exporter.h
index 7cbd0b460d5..cfcb7fc1296 100644
--- a/source/blender/io/gpencil/gpencil_io_exporter.h
+++ b/source/blender/io/gpencil/gpencil_io_exporter.h
@@ -49,6 +49,8 @@ struct GpencilExportParams {
   char frame[5];
   /** Flags. */
   int flag;
+  /** Stroke sampling. */
+  float stroke_sample;
 };
 
 typedef enum eGpencilExportParams_Flag {
diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.cc 
b/source/blender/io/gpencil/intern/gpencil_io_base.cc
index 320bf18b294..8d5255c2942 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_base.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_base.cc
@@ -67,6 +67,7 @@ GpencilExporter::GpencilExporter(const struct 
GpencilExportParams *iparams)
   params_.filename = iparams->filename;
   params_.mode = iparams->mode;
   params_.flag = iparams->flag;
+  params_.stroke_sample = iparams->stroke_sample;
 
   /* Easy access data. */
   bmain = CTX_data_main(params_.C);
diff --git a/source/blender/io/gpencil/intern/gpencil_io_svg.cc 
b/source/blender/io/gpencil/intern/gpencil_io_svg.cc
index 10bf8c7973a..395cdd9915f 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_svg.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_svg.cc
@@ -218,7 +218,9 @@ void GpencilExporterSVG::export_layers(void)
               gps_current_set(ob, gps_perimeter, false);
 
               /* Sample stroke. */
-              BKE_gpencil_stroke_sample(gps_perimeter, 0.03f, false);
+              if (params_.stroke_sample > 0.0f) {
+                BKE_gpencil_stroke_sample(gps_perimeter, 
params_.stroke_sample, false);
+              }
 
               export_stroke_path(gpl_node, false);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to