[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3934] trunk/py/scripts/addons/ io_curve_svg/import_svg.py: Made SVG importer handle DPI properly

Sergey Sharybin sergey.vfx at gmail.com
Tue Nov 6 14:16:49 CET 2012


Revision: 3934
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3934
Author:   nazgul
Date:     2012-11-06 13:16:45 +0000 (Tue, 06 Nov 2012)
Log Message:
-----------
Made SVG importer handle DPI properly

Apparently internally SVG importer was using 90 points per blender unit,
not per inch. This made files importing with unexpectable dimensions
which could be really harmful if you're importing blueprints as references.

Now SVG importer is using 90 points per inch, which makes imported files
has correct dimensions in both Metric and Imperal unit systems.

However, there's one possible downside -- imported files would look
smaller in blender units system.

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	2012-11-06 10:13:25 UTC (rev 3933)
+++ trunk/py/scripts/addons/io_curve_svg/import_svg.py	2012-11-06 13:16:45 UTC (rev 3934)
@@ -32,9 +32,9 @@
 # TODO: "em" and "ex" aren't actually supported
 SVGUnits = {"": 1.0,
             "px": 1.0,
-            "in": 90.0 / 12.0 * 0.3048,
-            "mm": 90.0 / 1000.0,
-            "cm": 90.0 / 100.0,
+            "in": 90.0,
+            "mm": 90.0 / 25.4,
+            "cm": 90.0 / 2.54,
             "pt": 1.25,
             "pc": 15.0,
             "em": 1.0,
@@ -1781,8 +1781,8 @@
         node = xml.dom.minidom.parse(filepath)
 
         m = Matrix()
-        m = m * Matrix.Scale(1.0 / 90.0, 4, Vector((1.0, 0.0, 0.0)))
-        m = m * Matrix.Scale(-1.0 / 90.0, 4, Vector((0.0, 1.0, 0.0)))
+        m = m * Matrix.Scale(1.0 / 90.0 * 0.3048 / 12.0, 4, Vector((1.0, 0.0, 0.0)))
+        m = m * Matrix.Scale(-1.0 / 90.0 * 0.3048 / 12.0, 4, Vector((0.0, 1.0, 0.0)))
 
         rect = (1, 1)
 



More information about the Bf-extensions-cvs mailing list