diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-19 16:38:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-19 16:38:42 +0300 |
commit | 970011fdcd0b68358d0c10ed2ad214ad65f3937b (patch) | |
tree | 751c76dcd57f6df716757e19ca3836928e60e4ff | |
parent | 51b73917ce228d2cfffdf5e41f6d968fffcf3608 (diff) |
Fix T47580: Can not import specific SVG
-rw-r--r-- | io_curve_svg/import_svg.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index a1df2204..2f137c27 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) |