[Bf-extensions-cvs] [eb09be71] master: Fix (partial) T92713: SVG importer: Ensure path closed before MoveTo

linhsu0723 noreply at git.blender.org
Thu Oct 6 11:26:34 CEST 2022


Commit: eb09be71a96c4fe910fdc43373be5ec08b419d2c
Author: linhsu0723
Date:   Thu Oct 6 11:13:06 2022 +0200
Branches: master
https://developer.blender.org/rBAeb09be71a96c4fe910fdc43373be5ec08b419d2c

Fix (partial) T92713: SVG importer: Ensure path closed before MoveTo

This can fix some broken paths in T92713, like the following PeerTube icon.

| before | now
| {F13615071} | {F13615072}

But some icons are still incomplete due to other issues.

Differential Revision: https://developer.blender.org/D16143

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

M	io_curve_svg/import_svg.py

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

diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py
index 28f40764..e84c9949 100644
--- a/io_curve_svg/import_svg.py
+++ b/io_curve_svg/import_svg.py
@@ -884,14 +884,17 @@ class SVGPathParser:
             if cmd is None:
                 raise Exception('Unknown path command: {0}' . format(code))
 
-            if cmd in {'Z', 'z'}:
+            if code in {'Z', 'z'}:
                 closed = True
             else:
                 closed = False
 
+            if code in {'M', 'm'} and self._use_fill and not closed:
+                self._pathClose('z') # Ensure closed before MoveTo path command
+
             cmd(code)
         if self._use_fill and not closed:
-            self._pathClose('z')
+            self._pathClose('z') # Ensure closed at the end of parsing
 
     def getSplines(self):
         """



More information about the Bf-extensions-cvs mailing list