diff --git a/addons/io_scene_gltf2/blender/imp/animation.py b/addons/io_scene_gltf2/blender/imp/animation.py index 4a0cad3da..63de87176 100644 --- a/addons/io_scene_gltf2/blender/imp/animation.py +++ b/addons/io_scene_gltf2/blender/imp/animation.py @@ -54,6 +54,9 @@ def anim(gltf, anim_idx): BlenderPointerAnim.anim(gltf, anim_idx, light, light_idx, 'LIGHT') for mat_idx, mat in enumerate(gltf.data.materials if gltf.data.materials else []): + if len(mat.blender_material) == 0: + # The animated material is not used in Blender, so do not animate it + continue if len(mat.animations) != 0: BlenderPointerAnim.anim(gltf, anim_idx, mat, mat_idx, 'MATERIAL') if mat.normal_texture is not None and len(mat.normal_texture.animations) != 0: @@ -167,5 +170,8 @@ def restore_animation(gltf, animation_name): restore_animation_on_object(light['blender_object_data'], animation_name) for mat in gltf.data.materials if gltf.data.materials else []: + if len(mat.blender_material) == 0: + # The animated material is not used in Blender, so do not animate it + continue restore_animation_on_object(mat.blender_nodetree, animation_name) restore_animation_on_object(mat.blender_mat, animation_name)