diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index 95c00a8ef52633eb565f808c60f9aa2c9fbf5a82..0dba73c48f193a57cf85d8ff9de3ef7406049b32 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'])