[Bf-extensions-cvs] [17103db] master: 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,

Seva Alekseyev noreply at git.blender.org
Mon Mar 28 17:41:56 CEST 2016


Commit: 17103db8521357628f56c85d60a32b2f23b56cda
Author: Seva Alekseyev
Date:   Mon Mar 28 11:41:36 2016 -0400
Branches: master
https://developer.blender.org/rBA17103db8521357628f56c85d60a32b2f23b56cda

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,

===================================================================

M	io_scene_x3d/import_x3d.py

===================================================================

diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index d5494d6..269cc55 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:



More information about the Bf-extensions-cvs mailing list