[Bf-extensions-cvs] [bae40ff3] blender2.8: glTF: Fix object animation import
Julien Duroure
noreply at git.blender.org
Sun Dec 2 18:01:55 CET 2018
Commit: bae40ff3bed8d9f1101d396ea2ec1643cc5b8af5
Author: Julien Duroure
Date: Sun Dec 2 18:01:44 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBAbae40ff3bed8d9f1101d396ea2ec1643cc5b8af5
glTF: Fix object animation import
===================================================================
M io_scene_gltf2/__init__.py
M io_scene_gltf2/blender/imp/gltf2_blender_animation_node.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 f05e766a..e2877db9 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -475,9 +475,6 @@ class ImportGLTF2(Operator, ImportHelper):
self.gltf_importer.log.critical("glTF import is now finished")
self.gltf_importer.log.removeHandler(self.gltf_importer.log_handler)
- # Switch to newly created main scene
- bpy.context.window.scene = bpy.data.scenes[self.gltf_importer.blender_scene]
-
return {'FINISHED'}
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
index 9302afd5..c053f84a 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
@@ -63,10 +63,6 @@ class BlenderNodeAnim():
obj.animation_data_create()
obj.animation_data.action = bpy.data.actions[action.name]
- # There is an animation on object
- # We can't remove Yup2Zup oject
- gltf.animation_object = True
-
for channel_idx in node.animations[anim_idx]:
channel = animation.channels[channel_idx]
@@ -75,6 +71,10 @@ class BlenderNodeAnim():
if channel.target.path in ['translation', 'rotation', 'scale']:
+ # There is an animation on object
+ # We can't remove Yup2Zup oject
+ gltf.animation_object = True
+
if channel.target.path == "translation":
blender_path = "location"
for idx, key in enumerate(keys):
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
index c155b115..f9a768d4 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_scene.py
@@ -45,6 +45,9 @@ class BlenderScene():
else:
gltf.blender_scene = pyscene.name
+ # Switch to newly created main scene
+ bpy.context.window.scene = bpy.data.scenes[gltf.blender_scene]
+
# Create Yup2Zup empty
obj_rotation = bpy.data.objects.new("Yup2Zup", None)
obj_rotation.rotation_mode = 'QUATERNION'
More information about the Bf-extensions-cvs
mailing list