Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2019-05-07 11:20:18 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-05-07 11:20:18 +0300
commitb82ea71146e08c6c2e1b97da59d93f6563201990 (patch)
tree99effa261903c8263dcf547f8f6a2db61b16f03f
parent447abeb9be69dcef24ea9c47bb2bde4488f9cb83 (diff)
glTF importer: Make the first root node the active object at end of import process
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_scene.py4
1 files changed, 4 insertions, 0 deletions
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: