From d98814b21c773137b01c8c94db875790cbbfb389 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Mon, 16 Apr 2012 07:33:47 +0000
Subject: [PATCH] fix [#30971] viewBox attribute in exported svg wrong

---
 io_mesh_uv_layout/__init__.py      | 6 +-----
 io_mesh_uv_layout/export_uv_svg.py | 4 ++--
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/io_mesh_uv_layout/__init__.py b/io_mesh_uv_layout/__init__.py
index 178f32a23..6bd3aae61 100644
--- a/io_mesh_uv_layout/__init__.py
+++ b/io_mesh_uv_layout/__init__.py
@@ -158,9 +158,6 @@ class ExportUVLayout(bpy.types.Operator):
                     end = start + p.loop_total
                     uvs = tuple((uv.uv[0], uv.uv[1])
                                 for uv in uv_layer[start:end])
-                    #~ uv = uv_elem.uv
-                    #~ if False not in uv_elem.select_uv[:len(uv)]:
-                    #~     yield (i, uv)
 
                     # just write what we see.
                     yield (i, uvs)
@@ -192,7 +189,7 @@ class ExportUVLayout(bpy.types.Operator):
         elif mode == 'PNG':
             from . import export_uv_png
             func = export_uv_png.write
-        if mode == 'SVG':
+        elif mode == 'SVG':
             from . import export_uv_svg
             func = export_uv_svg.write
 
@@ -202,7 +199,6 @@ class ExportUVLayout(bpy.types.Operator):
             mesh = obj.data
 
         func(fw, mesh, self.size[0], self.size[1], self.opacity,
-#             self.tessellated,
              lambda: self._face_uv_iter(context, mesh, self.tessellated))
 
         if self.modified:
diff --git a/io_mesh_uv_layout/export_uv_svg.py b/io_mesh_uv_layout/export_uv_svg.py
index ff504a0fe..764f0d341 100644
--- a/io_mesh_uv_layout/export_uv_svg.py
+++ b/io_mesh_uv_layout/export_uv_svg.py
@@ -29,7 +29,7 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func):
     fw('<?xml version="1.0" standalone="no"?>\n')
     fw('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" \n')
     fw('  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')
-    fw('<svg width="%dpx" height="%dpx" viewBox="0px 0px %dpx %dpx"\n' %
+    fw('<svg width="%d" height="%d" viewBox="0 0 %d %d"\n' %
        (image_width, image_height, image_width, image_height))
     fw('     xmlns="http://www.w3.org/2000/svg" version="1.1">\n')
     desc = ("%r, %s, (Blender %s)" %
@@ -54,7 +54,7 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func):
         except IndexError:
             fill = fill_default
 
-        fw('<polygon stroke="black" stroke-width="1px"')
+        fw('<polygon stroke="black" stroke-width="1"')
         if opacity > 0.0:
             fw(' %s fill-opacity="%.2g"' % (fill, opacity))
 
-- 
GitLab