[Bf-extensions-cvs] [a2e69343] master: Fix (partial) T92713: SVG importer: Implicit close keeps current point
linhsu0723
noreply at git.blender.org
Tue Oct 11 09:53:47 CEST 2022
Commit: a2e69343eb0893f4e4d404d20ba4c2f66d01f40a
Author: linhsu0723
Date: Tue Oct 11 09:48:58 2022 +0200
Branches: master
https://developer.blender.org/rBAa2e69343eb0893f4e4d404d20ba4c2f66d01f40a
Fix (partial) T92713: SVG importer: Implicit close keeps current point
Don't change current point coordinate for implicit path close.
This can fix some broken paths in T92713.
Differential Revision: https://developer.blender.org/D16198
===================================================================
M io_curve_svg/import_svg.py
===================================================================
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py
index e84c9949..d407ecc8 100644
--- a/io_curve_svg/import_svg.py
+++ b/io_curve_svg/import_svg.py
@@ -484,7 +484,7 @@ class SVGPathParser:
"""
__slots__ = ('_data', # Path data supplird
- '_point', # Current point coorfinate
+ '_point', # Current point coordinate
'_handle', # Last handle coordinate
'_splines', # List of all splies created during parsing
'_spline', # Currently handling spline
@@ -870,6 +870,14 @@ class SVGPathParser:
cv = self._spline['points'][0]
self._point = (cv['x'], cv['y'])
+ def _pathCloseImplicitly(self):
+ """
+ Close path implicitly without changing current point coordinate
+ """
+
+ if self._spline:
+ self._spline['closed'] = True
+
def parse(self):
"""
Execute parser
@@ -890,11 +898,11 @@ class SVGPathParser:
closed = False
if code in {'M', 'm'} and self._use_fill and not closed:
- self._pathClose('z') # Ensure closed before MoveTo path command
+ self._pathCloseImplicitly() # Ensure closed before MoveTo path command
cmd(code)
if self._use_fill and not closed:
- self._pathClose('z') # Ensure closed at the end of parsing
+ self._pathCloseImplicitly() # Ensure closed at the end of parsing
def getSplines(self):
"""
More information about the Bf-extensions-cvs
mailing list