diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-02-19 17:38:38 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-02-19 17:38:38 +0300 |
commit | b1320f3af626210555df43494733ffc295d2aeda (patch) | |
tree | 690c036b99cf389ec4fdedf3da86f4ba24094992 /io_curve_svg | |
parent | 787d786cb8e7230c585dd55c03bd27ffdb160e8d (diff) |
Fix T61707: Use id attribute to initialize object and curve names
Reviewers: sergey
Differential Revision: https://developer.blender.org/D4377
Diffstat (limited to 'io_curve_svg')
-rw-r--r-- | io_curve_svg/import_svg.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index 95c00a8e..0dba73c4 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']) |