[Bf-extensions-cvs] [a28c3f9c] blender-v3.4-release: Fix T102396: ValueError: matrix does not have an inverse

Sergey Sharybin noreply at git.blender.org
Thu Nov 10 11:10:34 CET 2022


Commit: a28c3f9cc009958695e33c929a4524d10e0d31e0
Author: Sergey Sharybin
Date:   Thu Nov 10 11:07:05 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBAa28c3f9cc009958695e33c929a4524d10e0d31e0

Fix T102396: ValueError: matrix does not have an inverse

Refactor the matrix stack in a way that does not require matrix
inversion. Basically, store the state of the final transform in
the stack.

Technically this makes regression test to fail with Blender Icons,
but the new code gives more correct icons. So the reference image
is to simply be regenerated.

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

M	io_curve_svg/import_svg.py

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

diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py
index c6461852..97dad798 100644
--- a/io_curve_svg/import_svg.py
+++ b/io_curve_svg/import_svg.py
@@ -964,16 +964,17 @@ class SVGGeometry:
         Push transformation matrix
         """
 
-        self._context['transform'].append(matrix)
-        self._context['matrix'] = self._context['matrix'] @ matrix
+        current_matrix = self._context['matrix']
+        self._context['matrix_stack'].append(current_matrix)
+        self._context['matrix'] = current_matrix @ matrix
 
     def _popMatrix(self):
         """
         Pop transformation matrix
         """
 
-        matrix = self._context['transform'].pop()
-        self._context['matrix'] = self._context['matrix'] @ matrix.inverted()
+        old_matrix = self._context['matrix_stack'].pop()
+        self._context['matrix'] = old_matrix
 
     def _pushStyle(self, style):
         """
@@ -1822,9 +1823,9 @@ class SVGLoader(SVGGeometryContainer):
         rect = (0, 0)
 
         self._context = {'defines': {},
-                         'transform': [],
                          'rects': [rect],
                          'rect': rect,
+                         'matrix_stack': [],
                          'matrix': m,
                          'materials': {},
                          'styles': [None],



More information about the Bf-extensions-cvs mailing list