diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2022-11-10 13:07:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2022-11-10 13:07:05 +0300 |
commit | a28c3f9cc009958695e33c929a4524d10e0d31e0 (patch) | |
tree | 4a12ed12decd7804690cdc0697a89a9b8d546820 | |
parent | 1ca94b05aa150886cd83c60df84548a653a4953e (diff) |
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.
-rw-r--r-- | io_curve_svg/import_svg.py | 11 |
1 files 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], |