From 17103db8521357628f56c85d60a32b2f23b56cda Mon Sep 17 00:00:00 2001
From: Seva Alekseyev <sevaa@nih.gov>
Date: Mon, 28 Mar 2016 11:41:36 -0400
Subject: [PATCH] When importing X3D files, mesh names are derived from X3D
 node DEF/USE attributes (where present). For VRML, that worked all along, for
 X3D it was broken,

---
 io_scene_x3d/import_x3d.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index d5494d6ba..269cc5575 100644
--- a/io_scene_x3d/import_x3d.py
+++ b/io_scene_x3d/import_x3d.py
@@ -1371,10 +1371,14 @@ class x3dNode(vrmlNode):
     def getSpec(self):
         return self.x3dNode.tagName  # should match vrml spec
 
+    # Used to retain object identifiers from X3D to Blender
     def getDefName(self):
-        data = self.x3dNode.getAttributeNode('DEF')
-        if data:
-            data.value  # XXX, return??
+        node_id = self.x3dNode.getAttributeNode('DEF')
+        if node_id:
+            return node_id.value
+        node_id = self.x3dNode.getAttributeNode('USE')
+        if node_id:
+            return "USE_" + node_id.value
         return None
 
     # Other funcs operate from vrml, but this means we can wrap XML fields, still use nice utility funcs
@@ -2981,7 +2985,7 @@ def importShape_ProcessObject(
         bpymat, has_alpha, texmtx, ancestry,
         global_matrix):
 
-    vrmlname += geom_spec
+    vrmlname += "_" + geom_spec
     bpydata.name = vrmlname
 
     if type(bpydata) == bpy.types.Mesh:
-- 
GitLab