[Bf-extensions-cvs] [2bbc4c72] master: glTF importer: fix setting root node as active when this is an armature
Julien Duroure
noreply at git.blender.org
Sat Aug 3 10:29:25 CEST 2019
Commit: 2bbc4c726425696cf86104d111f7250c8ca7b17c
Author: Julien Duroure
Date: Sat Aug 3 10:28:55 2019 +0200
Branches: master
https://developer.blender.org/rBA2bbc4c726425696cf86104d111f7250c8ca7b17c
glTF importer: fix setting root node as active when this is an armature
===================================================================
M io_scene_gltf2/__init__.py
M io_scene_gltf2/blender/imp/gltf2_blender_scene.py
===================================================================
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 28adcb8c..844897fa 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -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',
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):
More information about the Bf-extensions-cvs
mailing list