diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-01-23 13:38:38 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-01-23 13:38:38 +0400 |
commit | 852fc1ecceae722b33a627284184ad4332fc4b16 (patch) | |
tree | ab15de4a0f825049b54f5e701faf5fe646e31ade | |
parent | 2251df5232a884ba8bdd2c7e567b12363c68d8c7 (diff) |
Fix T38324: import SVG from Inkscape doesn't match space origin
Made some tweaks to transformation matrix of <svg> node to make
it so origin from Inkscape matches Blender origin.
Currently only affects files from Inkscape, for others it's not
so much clear what origin should be.
Based on the patch from aldero (juanC), thanks!
-rw-r--r-- | io_curve_svg/import_svg.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index 1b62ac1e..740dd817 100644 --- a/io_curve_svg/import_svg.py +++ b/io_curve_svg/import_svg.py @@ -1749,7 +1749,15 @@ class SVGGeometrySVG(SVGGeometryContainer): rect = SVGRectFromNode(self._node, self._context) - self._pushMatrix(self.getNodeMatrix()) + matrix = self.getNodeMatrix() + + # Better Inkscape compatibility: match document origin with + # 3D space origin. + if self._node.getAttribute('inkscape:version'): + document_height = float(self._node.getAttribute('height')) + matrix = matrix * Matrix.Translation([0.0, -document_height , 0.0]) + + self._pushMatrix(matrix) self._pushRect(rect) super()._doCreateGeom(False) |