[Bf-blender-cvs] [d3407405cbc] greasepencil-object: GPencil: Add a prefix to styles

Antonio Vazquez noreply at git.blender.org
Sat Jul 25 23:46:11 CEST 2020


Commit: d3407405cbcfb1a56076d14351dc11f759812f36
Author: Antonio Vazquez
Date:   Sat Jul 25 23:46:04 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rBd3407405cbcfb1a56076d14351dc11f759812f36

GPencil: Add a prefix to styles

The style name cannot start with numbers

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

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

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

diff --git a/source/blender/io/gpencil/intern/gpencil_io_svg.cc b/source/blender/io/gpencil/intern/gpencil_io_svg.cc
index 9678b6d65df..f422ef61e14 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_svg.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_svg.cc
@@ -196,7 +196,8 @@ void GpencilExporterSVG::export_stroke(pugi::xml_node gpl_node,
   // gps_node.append_attribute("fill").set_value("#000000");
   // gps_node.append_attribute("stroke").set_value("#000000");
 
-  gps_node.append_attribute("class").set_value(to_lower_string(ma->id.name + 2).c_str());
+  gps_node.append_attribute("class").set_value(
+      (GP_EXP_SVG_STYLE_PREFIX + to_lower_string(ma->id.name + 2)).c_str());
 
   gps_node.append_attribute("stroke-width").set_value("1.0");
 
@@ -243,7 +244,7 @@ void GpencilExporterSVG::export_style_list(void)
                     (gp_style->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH));
 
     txt.append("\n\t.");
-    txt.append(to_lower_string(ma->id.name + 2).c_str());
+    txt.append((GP_EXP_SVG_STYLE_PREFIX + to_lower_string(ma->id.name + 2)).c_str());
 
     txt.append("{");
     if (is_fill) {
diff --git a/source/blender/io/gpencil/intern/gpencil_io_svg.h b/source/blender/io/gpencil/intern/gpencil_io_svg.h
index 0f7f6f91535..1c1e333adc7 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_svg.h
+++ b/source/blender/io/gpencil/intern/gpencil_io_svg.h
@@ -32,6 +32,8 @@ struct ARegion;
 
 struct bGPDstroke;
 
+#define GP_EXP_SVG_STYLE_PREFIX "m_"
+
 namespace blender {
 namespace io {
 namespace gpencil {



More information about the Bf-blender-cvs mailing list