From b1320f3af626210555df43494733ffc295d2aeda Mon Sep 17 00:00:00 2001 From: Jacques Lucke <mail@jlucke.com> Date: Tue, 19 Feb 2019 15:38:38 +0100 Subject: [PATCH] Fix T61707: Use id attribute to initialize object and curve names Reviewers: sergey Differential Revision: https://developer.blender.org/D4377 --- io_curve_svg/import_svg.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index 95c00a8ef..0dba73c48 100644 --- a/io_curve_svg/import_svg.py +++ b/io_curve_svg/import_svg.py @@ -454,6 +454,12 @@ def SVGParseStyles(node, context): return styles +def id_names_from_node(node, ob): + if node.getAttribute('id'): + name = node.getAttribute('id') + ob.name = name + ob.data.name = name + #### SVG path helpers #### @@ -1214,8 +1220,7 @@ class SVGGeometryPATH(SVGGeometry): ob = SVGCreateCurve(self._context) cu = ob.data - if self._node.getAttribute('id'): - cu.name = self._node.getAttribute('id') + id_names_from_node(self._node, ob) if self._styles['useFill']: cu.dimensions = '2D' @@ -1555,8 +1560,7 @@ class SVGGeometryELLIPSE(SVGGeometry): ob = SVGCreateCurve(self._context) cu = ob.data - if self._node.getAttribute('id'): - cu.name = self._node.getAttribute('id') + id_names_from_node(self._node, ob) if self._styles['useFill']: cu.dimensions = '2D' @@ -1672,6 +1676,8 @@ class SVGGeometryLINE(SVGGeometry): ob = SVGCreateCurve(self._context) cu = ob.data + id_names_from_node(self._node, ob) + coords = [(x1, y1), (x2, y2)] spline = None @@ -1741,6 +1747,8 @@ class SVGGeometryPOLY(SVGGeometry): ob = SVGCreateCurve(self._context) cu = ob.data + id_names_from_node(self._node, ob) + if self._closed and self._styles['useFill']: cu.dimensions = '2D' cu.materials.append(self._styles['fill']) -- GitLab