Fix T47580: Can not import specific SVG

This commit is contained in:
Sergey Sharybin 2016-04-19 15:38:22 +02:00
parent 51b73917ce
commit 970011fdcd
Notes: blender-bot 2023-02-14 08:10:07 +01:00
Referenced by issue blender/blender#47580, can not import specific SVG
1 changed files with 6 additions and 2 deletions

View File

@ -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)