glTF importer: fix bug in animation import
Problem occured when importing a gltf, delete objects, and importing a new gltf, with same object / armature
This commit is contained in:
parent
be2df52491
commit
8ac0910961
|
@ -170,6 +170,12 @@ class BlenderBoneAnim():
|
|||
action = bpy.data.actions.new(name)
|
||||
else:
|
||||
action = bpy.data.actions[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]
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue