[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1725] trunk/py/scripts/addons/ io_curve_svg/import_svg.py: fix for loading some svg' s with viewBox like this: viewBox="0, 0 360, 240"

Campbell Barton ideasman42 at gmail.com
Mon Mar 21 00:59:39 CET 2011


Revision: 1725
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1725
Author:   campbellbarton
Date:     2011-03-20 23:59:38 +0000 (Sun, 20 Mar 2011)
Log Message:
-----------
fix for loading some svg's with viewBox like this: viewBox="0,0 360,240"
eg: XFCE file - /usr/share/xfce4/xkb/flags/tr.svg

Modified Paths:
--------------
    trunk/py/scripts/addons/io_curve_svg/import_svg.py

Modified: trunk/py/scripts/addons/io_curve_svg/import_svg.py
===================================================================
--- trunk/py/scripts/addons/io_curve_svg/import_svg.py	2011-03-20 15:32:19 UTC (rev 1724)
+++ trunk/py/scripts/addons/io_curve_svg/import_svg.py	2011-03-20 23:59:38 UTC (rev 1725)
@@ -174,7 +174,7 @@
     h = context['rect'][1]
 
     if node.getAttribute('viewBox'):
-        viewBox = node.getAttribute('viewBox').split()
+        viewBox = node.getAttribute('viewBox').replace(',', ' ').split()
         w = SVGParseCoord(viewBox[2], w)
         h = SVGParseCoord(viewBox[3], h)
     else:
@@ -212,7 +212,7 @@
         m = m * m.Scale(h / rect[1], 4, Vector((0.0, 1.0, 0.0)))
 
     if node.getAttribute('viewBox'):
-        viewBox = node.getAttribute('viewBox').split()
+        viewBox = node.getAttribute('viewBox').replace(',', ' ').split()
         vx = SVGParseCoord(viewBox[0], w)
         vy = SVGParseCoord(viewBox[1], h)
         vw = SVGParseCoord(viewBox[2], w)
@@ -324,11 +324,9 @@
     scale SVG transform command
     """
 
-    sx = sy = float(params[0])
+    sx = float(params[0])
+    sy = float(params[1]) if len(params) > 1 else sx
 
-    if len(params) > 1:
-        sy = float(params[1])
-
     m = Matrix()
 
     m = m * m.Scale(sx, 4, Vector((1.0, 0.0, 0.0)))



More information about the Bf-extensions-cvs mailing list