[Bf-extensions-cvs] [970011f] master: Fix T47580: Can not import specific SVG
Sergey Sharybin
noreply at git.blender.org
Tue Apr 19 15:38:38 CEST 2016
Commit: 970011fdcd0b68358d0c10ed2ad214ad65f3937b
Author: Sergey Sharybin
Date: Tue Apr 19 15:38:22 2016 +0200
Branches: master
https://developer.blender.org/rBA970011fdcd0b68358d0c10ed2ad214ad65f3937b
Fix T47580: Can not import specific SVG
===================================================================
M io_curve_svg/import_svg.py
===================================================================
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py
index a1df220..2f137c2 100644
--- a/io_curve_svg/import_svg.py
+++ b/io_curve_svg/import_svg.py
@@ -205,8 +205,9 @@ def SVGMatrixFromNode(node, context):
m = Matrix.Translation(Vector((x, y, 0.0)))
if len(context['rects']) > 1:
- m = m * Matrix.Scale(w / rect[0], 4, Vector((1.0, 0.0, 0.0)))
- m = m * Matrix.Scale(h / rect[1], 4, Vector((0.0, 1.0, 0.0)))
+ if rect[0] != 0 and rect[1] != 0:
+ m = m * Matrix.Scale(w / rect[0], 4, Vector((1.0, 0.0, 0.0)))
+ m = m * Matrix.Scale(h / rect[1], 4, Vector((0.0, 1.0, 0.0)))
if node.getAttribute('viewBox'):
viewBox = node.getAttribute('viewBox').replace(',', ' ').split()
@@ -215,6 +216,9 @@ def SVGMatrixFromNode(node, context):
vw = SVGParseCoord(viewBox[2], w)
vh = SVGParseCoord(viewBox[3], h)
+ if vw == 0 or vh == 0:
+ return m
+
sx = w / vw
sy = h / vh
scale = min(sx, sy)
More information about the Bf-extensions-cvs
mailing list