Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-10-29 18:09:02 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-10-29 18:09:02 +0300
commitc2aef4a98f6cabef9a6d38a33035f02cf8233dd0 (patch)
treed24d261b4978ed98576ca79b86ae5427a54cf57f
parenta1aeff98908d47f5aba2457df444ac20a890f707 (diff)
SVG: Fix wrong closed path with quadratic segments
Fixes T55601: SVG import wrong shape
-rw-r--r--io_curve_svg/import_svg.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py
index 4298470b..6b45d91d 100644
--- a/io_curve_svg/import_svg.py
+++ b/io_curve_svg/import_svg.py
@@ -666,6 +666,9 @@ class SVGPathParser:
if last['handle_right_type'] == 'VECTOR' and handle_left_type == 'FREE':
last['handle_right'] = (last['x'], last['y'])
last['handle_right_type'] = 'FREE'
+ if last['handle_right_type'] == 'FREE' and handle_left_type == 'VECTOR':
+ handle_left = (x, y)
+ handle_left_type = 'FREE'
point = {'x': x,
'y': y,
@@ -1230,6 +1233,19 @@ class SVGGeometryPATH(SVGGeometry):
for spline in self._splines:
act_spline = None
+
+ if spline['closed'] and len(spline['points']) >= 2:
+ first = spline['points'][0]
+ last = spline['points'][-1]
+ if ( first['handle_left_type'] == 'FREE' and
+ last['handle_right_type'] == 'VECTOR'):
+ last['handle_right_type'] = 'FREE'
+ last['handle_right'] = (last['x'], last['y'])
+ if ( last['handle_right_type'] == 'FREE' and
+ first['handle_left_type'] == 'VECTOR'):
+ first['handle_left_type'] = 'FREE'
+ first['handle_left'] = (first['x'], first['y'])
+
for point in spline['points']:
co = self._transformCoord((point['x'], point['y']))