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-08-03 11:28:55 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-08-03 11:28:55 +0300
commit2bbc4c726425696cf86104d111f7250c8ca7b17c (patch)
tree3d9b44137a76ce4851782058064fe8450c612d5a /io_scene_gltf2/blender/imp/gltf2_blender_scene.py
parent7565f120d54c9f68d4b15c3774d19bebf60a2c35 (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-xio_scene_gltf2/blender/imp/gltf2_blender_scene.py6
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):