diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2018-12-02 20:01:44 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2018-12-02 20:01:44 +0300 |
commit | bae40ff3bed8d9f1101d396ea2ec1643cc5b8af5 (patch) | |
tree | 38b5d5399be2817cc5166159bf848c40d1c4c4fd | |
parent | 6706c91ecf7dd759293b5a7e0b2b75e3c1d7c2e1 (diff) |
glTF: Fix object animation import
-rwxr-xr-x | io_scene_gltf2/__init__.py | 3 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py | 8 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_scene.py | 3 |
3 files changed, 7 insertions, 7 deletions
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' |