[Bf-extensions-cvs] [852fc1e] master: Fix T38324: import SVG from Inkscape doesn't match space origin

Sergey Sharybin noreply at git.blender.org
Thu Jan 23 10:40:36 CET 2014


Commit: 852fc1ecceae722b33a627284184ad4332fc4b16
Author: Sergey Sharybin
Date:   Thu Jan 23 15:38:38 2014 +0600
https://developer.blender.org/rBA852fc1ecceae722b33a627284184ad4332fc4b16

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!

===================================================================

M	io_curve_svg/import_svg.py

===================================================================

diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py
index 1b62ac1..740dd81 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)



More information about the Bf-extensions-cvs mailing list