[Bf-blender-cvs] [2d8c9efbad0] greasepencil-object: GPencil: Some tweaks to create filled areas

Antonio Vazquez noreply at git.blender.org
Sat Jul 25 21:17:07 CEST 2020


Commit: 2d8c9efbad007bbff7be25454de2db6531c22a36
Author: Antonio Vazquez
Date:   Sat Jul 25 21:17:00 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2d8c9efbad007bbff7be25454de2db6531c22a36

GPencil: Some tweaks to create filled areas

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

M	source/blender/io/gpencil/intern/gpencil_io_svg.cc

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

diff --git a/source/blender/io/gpencil/intern/gpencil_io_svg.cc b/source/blender/io/gpencil/intern/gpencil_io_svg.cc
index 8b41afb2a67..5057395dba6 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_svg.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_svg.cc
@@ -128,6 +128,10 @@ void GpencilExporterSVG::export_layers(void)
 
   bGPdata *gpd = (bGPdata *)ob->data;
   LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+    if (gpl->flag & GP_LAYER_HIDE) {
+      continue;
+    }
+
     /* Layer node. */
     std::string txt = "Layer: ";
     txt.append(gpl->info);
@@ -145,17 +149,24 @@ void GpencilExporterSVG::export_layers(void)
 
     LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
       Material *ma = BKE_object_material_get(ob, gps->mat_nr + 1);
+      MaterialGPencilStyle *gp_style = ma->gp_style;
+      /* Fill. */
+      if (gp_style->flag & GP_MATERIAL_FILL_SHOW) {
+        export_stroke(gpl_node, gps, ma, diff_mat);
+      }
+      /* Stroke. */
+      if (gp_style->flag & GP_MATERIAL_STROKE_SHOW) {
+        bGPDstroke *gps_perimeter = BKE_gpencil_stroke_perimeter_from_view(
+            rv3d, gpd, gpl, gps, 3, diff_mat);
 
-      bGPDstroke *gps_perimeter = BKE_gpencil_stroke_perimeter_from_view(
-          rv3d, gpd, gpl, gps, 3, diff_mat);
-
-      /* Reproject and sample stroke. */
-      // ED_gpencil_project_stroke_to_view(params.C, gpl, gps_perimeter);
-      BKE_gpencil_stroke_sample(gps_perimeter, 0.03f, false);
+        /* Reproject and sample stroke. */
+        // ED_gpencil_project_stroke_to_view(params.C, gpl, gps_perimeter);
+        BKE_gpencil_stroke_sample(gps_perimeter, 0.03f, false);
 
-      export_stroke(gpl_node, gps_perimeter, ma, diff_mat);
+        export_stroke(gpl_node, gps_perimeter, ma, diff_mat);
 
-      BKE_gpencil_free_stroke(gps_perimeter);
+        BKE_gpencil_free_stroke(gps_perimeter);
+      }
     }
   }
 }
@@ -221,12 +232,17 @@ void GpencilExporterSVG::export_style_list(void)
 
     txt.append("{");
     if (gp_style->flag & GP_MATERIAL_FILL_SHOW) {
-      copy_v3_v3(col, gp_style->fill_rgba);
+      linearrgb_to_srgb_v3_v3(col, gp_style->fill_rgba);
+
       txt.append("fill:" + rgb_to_hex(col) + ";");
+      if ((gp_style->flag & GP_MATERIAL_STROKE_SHOW) == 0) {
+        txt.append("stroke:" + rgb_to_hex(col) + ";");
+      }
     }
 
     if (gp_style->flag & GP_MATERIAL_STROKE_SHOW) {
-      copy_v3_v3(col, gp_style->stroke_rgba);
+      linearrgb_to_srgb_v3_v3(col, gp_style->stroke_rgba);
+
       txt.append("stroke:" + rgb_to_hex(col) + ";");
       if ((gp_style->flag & GP_MATERIAL_FILL_SHOW) == 0) {
         txt.append("fill:" + rgb_to_hex(col) + ";");



More information about the Bf-blender-cvs mailing list