[Bf-blender-cvs] [4c83d6b51af] greasepencil-object: GPencil: Include scene name at the bottom of SVG export

Antonio Vazquez noreply at git.blender.org
Tue Aug 4 16:42:05 CEST 2020


Commit: 4c83d6b51af4d908c4ea989dd47f8e9595bc532a
Author: Antonio Vazquez
Date:   Tue Aug 4 16:39:30 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB4c83d6b51af4d908c4ea989dd47f8e9595bc532a

GPencil: Include scene name at the bottom of SVG export

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

M	source/blender/editors/io/io_gpencil.c
M	source/blender/io/gpencil/intern/gpencil_io_base.cc
M	source/blender/io/gpencil/intern/gpencil_io_base.h
M	source/blender/io/gpencil/intern/gpencil_io_capi.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 2865cc4726f..9a963ed191b 100644
--- a/source/blender/editors/io/io_gpencil.c
+++ b/source/blender/editors/io/io_gpencil.c
@@ -433,7 +433,7 @@ void WM_OT_gpencil_export(wmOperatorType *ot)
   RNA_def_boolean(ot->srna,
                   "use_storyboard",
                   false,
-                  "Storyboard Mode",
+                  "Storyboard",
                   "Export several frames by page (valid only in camera view)");
   RNA_def_enum(ot->srna, "page_type", paper_items, 0, "Page", "Page orientation");
   RNA_def_enum(ot->srna,
diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.cc b/source/blender/io/gpencil/intern/gpencil_io_base.cc
index 514a2e8ef87..56405685dff 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_base.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_base.cc
@@ -86,6 +86,7 @@ GpencilExporter::GpencilExporter(const struct GpencilExportParams *iparams)
   /* Easy access data. */
   bmain = CTX_data_main(params_.C);
   depsgraph = CTX_data_depsgraph_pointer(params_.C);
+  scene = CTX_data_scene(params_.C);
   rv3d = (RegionView3D *)params_.region->regiondata;
   gpd = (bGPdata *)params_.obact->data;
   const bool is_storyboard = ((params_.flag & GP_EXPORT_STORYBOARD_MODE) != 0);
diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.h b/source/blender/io/gpencil/intern/gpencil_io_base.h
index 240787961de..b43ac6cd3ce 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_base.h
+++ b/source/blender/io/gpencil/intern/gpencil_io_base.h
@@ -74,6 +74,7 @@ class GpencilExporter {
   struct Depsgraph *depsgraph;
   struct bGPdata *gpd;
   struct Main *bmain;
+  struct Scene *scene;
   struct RegionView3D *rv3d;
 
   int winx_, winy_;
diff --git a/source/blender/io/gpencil/intern/gpencil_io_capi.cc b/source/blender/io/gpencil/intern/gpencil_io_capi.cc
index c0e77c7abde..9172ba9337f 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_capi.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_capi.cc
@@ -118,8 +118,12 @@ static bool gpencil_export_storyboard(
   render_ratio[0] = frame_box[0] / ((scene->r.xsch * scene->r.size) / 100);
   render_ratio[1] = render_ratio[0];
 
-  const float gap[2] = {frame_box[0] / ((float)blocks[0] + 1.0f),
-                        frame_box[1] / ((float)blocks[1] + 1.0f)};
+  // float ysize = (iparams->paper_size[1] / ((float)blocks[1] + 1.0f)) / ((float)blocks[1]
+  // + 1.0f);
+  float ysize = iparams->paper_size[1] - (frame_box[1] * (float)blocks[1]);
+  ysize /= (float)blocks[1] + 1.0f;
+
+  const float gap[2] = {frame_box[0] / ((float)blocks[0] + 1.0f), ysize};
   float frame_offset[2] = {gap[0], gap[1]};
 
   int col = 1;
diff --git a/source/blender/io/gpencil/intern/gpencil_io_svg.cc b/source/blender/io/gpencil/intern/gpencil_io_svg.cc
index 4f12ce079e9..8e9561731d4 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_svg.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_svg.cc
@@ -37,6 +37,7 @@
 #include "DNA_gpencil_types.h"
 #include "DNA_material_types.h"
 #include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_view3d_types.h"
 
@@ -136,8 +137,17 @@ void GpencilExporterSVG::create_document_header(void)
   main_node.append_attribute("height").set_value((height + "px").c_str());
   std::string viewbox = "0 0 " + width + " " + height;
   main_node.append_attribute("viewBox").set_value(viewbox.c_str());
-}
 
+  /* Scene name. */
+  if ((params_.flag & GP_EXPORT_STORYBOARD_MODE) != 0) {
+    create_text(main_node,
+                30.0f,
+                params_.paper_size[1] - 30.0f,
+                std::string(scene->id.name + 2),
+                12.0f,
+                "#000000");
+  }
+}
 /* Main layer loop. */
 void GpencilExporterSVG::export_layers(void)
 {



More information about the Bf-blender-cvs mailing list