[Bf-blender-cvs] [fc34653ce2c] greasepencil-object: Gpencil: Basic SVG export callback is running OK.

YimingWu noreply at git.blender.org
Wed Jul 10 04:48:38 CEST 2019


Commit: fc34653ce2cd401b8fd952cb2b0798c0efdf5295
Author: YimingWu
Date:   Wed Jul 10 10:48:10 2019 +0800
Branches: greasepencil-object
https://developer.blender.org/rBfc34653ce2cd401b8fd952cb2b0798c0efdf5295

Gpencil: Basic SVG export callback is running OK.

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

M	source/blender/blenkernel/intern/writesvg.c

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

diff --git a/source/blender/blenkernel/intern/writesvg.c b/source/blender/blenkernel/intern/writesvg.c
index af2f50273db..86ab34051fe 100644
--- a/source/blender/blenkernel/intern/writesvg.c
+++ b/source/blender/blenkernel/intern/writesvg.c
@@ -42,7 +42,7 @@
 
 static void write_svg_head(Text* ta){
     BKE_text_write(ta, NULL, "<?xml version=\"1.0\" standalone=\"no\"?>\n");
-    BKE_text_write(ta, NULL, "<svg width=\"10cm\" height=\"10cm\" viewbox=\"0 0 10 10\""
+    BKE_text_write(ta, NULL, "<svg width=\"10\" height=\"10\" viewBox=\"-5 -5 10 10\" "
         "xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n");
 }
 
@@ -78,8 +78,8 @@ static void write_paths_from_callback(void* iterator, Text* ta, svg_get_path_cal
         CLAMP3(stroke_color,0,1);
 
         /* end the path */
-        sprintf(buf,"\" fill=#%X%X%X; stroke=#%X%X%X; stroke-width=\"%f\" />\n",
-            FAC_255_COLOR3(fill_color), FAC_255_COLOR3(stroke_color), stroke_width);
+        sprintf(buf,"\" fill=\"#%02X%02X%02X\" stroke=\"#%02X%02X%02X\" stroke-width=\"%f\" />\n",
+            FAC_255_COLOR3(fill_color), FAC_255_COLOR3(stroke_color), stroke_width/1000.0f);
         BKE_text_write(ta, NULL, buf);
     }
     
@@ -153,7 +153,8 @@ bool BKE_svg_data_from_gpencil(bGPdata* gpd, Text* ta, bGPDlayer* layer, int fra
         return false;
     }
     
-    BKE_text_free_lines(ta);
+    /* Will cause nothing to be written into the text block.(Why?) */
+    /* BKE_text_free_lines(ta); */
 
     write_svg_head(ta);



More information about the Bf-blender-cvs mailing list