[Bf-extensions-cvs] [b82ea711] master: glTF importer: Make the first root node the active object at end of import process

Julien Duroure noreply at git.blender.org
Tue May 7 11:15:52 CEST 2019


Commit: b82ea71146e08c6c2e1b97da59d93f6563201990
Author: Julien Duroure
Date:   Tue May 7 10:20:18 2019 +0200
Branches: master
https://developer.blender.org/rBAb82ea71146e08c6c2e1b97da59d93f6563201990

glTF importer: Make the first root node the active object at end of import process

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

M	io_scene_gltf2/blender/imp/gltf2_blender_scene.py

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

diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
index 2bd58162..d2d63760 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
@@ -157,6 +157,10 @@ class BlenderScene():
                     bpy.data.collections[gltf.blender_active_collection].hide_viewport = gltf.collection_hide_viewport
                     # TODO restore visibility when expose in bpy
 
+        # Make first root object the new active one
+        if list_nodes is not None:
+            bpy.context.scene.objects.active = bpy.data.objects[gltf.data.nodes[list_nodes[0]].blender_object]
+
     @staticmethod
     def get_root_nodes(gltf):
         if gltf.data.nodes is None:



More information about the Bf-extensions-cvs mailing list