glTF importer: fix setting root node as active when this is an armature

This commit is contained in:
Julien Duroure 2019-08-03 10:28:55 +02:00
parent 7565f120d5
commit 2bbc4c7264
2 changed files with 6 additions and 2 deletions

View File

@ -15,7 +15,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (0, 9, 40),
"version": (0, 9, 41),
'blender': (2, 80, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -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):