diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2018-11-25 18:08:23 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2018-11-25 18:08:23 +0300 |
commit | 8ac09109617d8acd81747bd3dffed915aa99c8cc (patch) | |
tree | 28752bf60b58a12f2fc8402df699a4fc6c3afdd6 /io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py | |
parent | be2df5249105015aaafb06def0d1279c559c56ff (diff) |
glTF importer: fix bug in animation import
Problem occured when importing a gltf, delete objects, and importing a
new gltf, with same object / armature
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py | 6 |
1 files changed, 6 insertions, 0 deletions
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 a5d4b40f..2a04f469 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py @@ -53,6 +53,12 @@ class BlenderNodeAnim(): else: name = "Animation_" + str(anim_idx) + "_" + obj.name action = bpy.data.actions.new(name) + # Check if this action has some users. + # If no user (only 1 indeed), that means that this action must be deleted + # (is an action from a deleted action) + if action.users == 1: + bpy.data.actions.remove(action) + action = bpy.data.actions.new(name) if not obj.animation_data: obj.animation_data_create() obj.animation_data.action = bpy.data.actions[action.name] |