diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-08-03 11:28:55 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-08-03 11:28:55 +0300 |
commit | 2bbc4c726425696cf86104d111f7250c8ca7b17c (patch) | |
tree | 3d9b44137a76ce4851782058064fe8450c612d5a /io_scene_gltf2/blender/imp/gltf2_blender_scene.py | |
parent | 7565f120d54c9f68d4b15c3774d19bebf60a2c35 (diff) |
glTF importer: fix setting root node as active when this is an armature
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_scene.py')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_scene.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py index 479167c0..6e84aac5 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py @@ -166,7 +166,11 @@ class BlenderScene(): # Make first root object the new active one if list_nodes is not None: - bpy.context.view_layer.objects.active = bpy.data.objects[gltf.data.nodes[list_nodes[0]].blender_object] + if gltf.data.nodes[list_nodes[0]].blender_object: + bl_name = gltf.data.nodes[list_nodes[0]].blender_object + else: + bl_name = gltf.data.nodes[list_nodes[0]].blender_armature_name + bpy.context.view_layer.objects.active = bpy.data.objects[bl_name] @staticmethod def get_root_nodes(gltf): |