[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3305] trunk/py/scripts/addons/ io_scene_x3d/import_x3d.py: select new imported x3d objects

Campbell Barton ideasman42 at gmail.com
Wed Apr 25 08:23:57 CEST 2012


Revision: 3305
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3305
Author:   campbellbarton
Date:     2012-04-25 06:23:57 +0000 (Wed, 25 Apr 2012)
Log Message:
-----------
select new imported x3d objects

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_x3d/import_x3d.py

Modified: trunk/py/scripts/addons/io_scene_x3d/import_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/import_x3d.py	2012-04-24 22:34:13 UTC (rev 3304)
+++ trunk/py/scripts/addons/io_scene_x3d/import_x3d.py	2012-04-25 06:23:57 UTC (rev 3305)
@@ -1386,6 +1386,8 @@
     except:
         return None, 'Not a valid x3d document, cannot import'
 
+    bpy.ops.object.select_all(action='DESELECT')
+
     root = x3dNode(None, NODE_NORMAL, x3dnode)
     root.setRoot(path)  # so images and Inline's we load have a relative path
     root.parse()
@@ -2157,7 +2159,7 @@
             bpydata.name = vrmlname
 
             bpyob = node.blendObject = bpy.data.objects.new(vrmlname, bpydata)
-            bpy.context.scene.objects.link(bpyob)
+            bpy.context.scene.objects.link(bpyob).select = True
 
             if type(bpydata) == bpy.types.Mesh:
                 is_solid = geom.getFieldAsBool('solid', True, ancestry)
@@ -2298,7 +2300,7 @@
         raise ValueError
 
     bpyob = node.blendObject = bpy.data.objects.new("TODO", bpylamp)
-    bpy.context.scene.objects.link(bpyob)
+    bpy.context.scene.objects.link(bpyob).select = True
 
     bpyob.matrix_world = getFinalMatrix(node, mtx, ancestry, global_matrix)
 
@@ -2321,7 +2323,7 @@
     mtx = Matrix.Translation(Vector(position)) * translateRotation(orientation)
 
     bpyob = node.blendObject = bpy.data.objects.new(name, bpycam)
-    bpy.context.scene.objects.link(bpyob)
+    bpy.context.scene.objects.link(bpyob).select = True
     bpyob.matrix_world = getFinalMatrix(node, mtx, ancestry, global_matrix)
 
 
@@ -2331,7 +2333,7 @@
         name = 'Transform'
 
     bpyob = node.blendObject = bpy.data.objects.new(name, None)
-    bpy.context.scene.objects.link(bpyob)
+    bpy.context.scene.objects.link(bpyob).select = True
 
     bpyob.matrix_world = getFinalMatrix(node, None, ancestry, global_matrix)
 
@@ -2590,7 +2592,7 @@
                 node = defDict[key]
                 if node.blendObject is None:  # Add an object if we need one for animation
                     node.blendObject = bpy.data.objects.new('AnimOb', None)  # , name)
-                    bpy.context.scene.objects.link(node.blendObject)
+                    bpy.context.scene.objects.link(node.blendObject).select = True
 
                 if node.blendObject.animation_data is None:
                     node.blendObject.animation_data_create()



More information about the Bf-extensions-cvs mailing list