diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-06 17:16:45 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-06 17:16:45 +0400 |
commit | bf9f42d9b5b08ce83439114c7872d254999c89a3 (patch) | |
tree | 0766c357ebd071271c9e17e4813b348ad3f97034 /io_curve_svg | |
parent | 4ee7689e0657b14469c7d20185fcbabe858b28e7 (diff) |
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.
Diffstat (limited to 'io_curve_svg')
-rw-r--r-- | io_curve_svg/import_svg.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index 3bfdca32..f14a010a 100644 --- a/io_curve_svg/import_svg.py +++ b/io_curve_svg/import_svg.py @@ -32,9 +32,9 @@ from . import svg_colors # 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 @@ class SVGLoader(SVGGeometryContainer): 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) |