From a28c3f9cc009958695e33c929a4524d10e0d31e0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 10 Nov 2022 11:07:05 +0100 Subject: 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. --- io_curve_svg/import_svg.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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], -- cgit v1.2.3