[Bf-extensions-cvs] [b1320f3a] master: Fix T61707: Use id attribute to initialize object and curve names
Jacques Lucke
noreply at git.blender.org
Tue Feb 19 15:39:05 CET 2019
Commit: b1320f3af626210555df43494733ffc295d2aeda
Author: Jacques Lucke
Date: Tue Feb 19 15:38:38 2019 +0100
Branches: master
https://developer.blender.org/rBAb1320f3af626210555df43494733ffc295d2aeda
Fix T61707: Use id attribute to initialize object and curve names
Reviewers: sergey
Differential Revision: https://developer.blender.org/D4377
===================================================================
M io_curve_svg/import_svg.py
===================================================================
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'])
More information about the Bf-extensions-cvs
mailing list