I have several objects sharing a material that is animating. I’m able to create a copies of the material and assign them to each object, but the animation data is still the same for all materials (see .blend, attached). How can I create a copy of the animation data associated with the material as well?
import bpy
s_objs = bpy.context.selected_objects
for obj in s_objs:
material_slots = obj.material_slots
for mat_slot in material_slots:
material = mat_slot.material
new_material = material.copy()
mat_slot.material = new_material
bpy.context.view_layer.update()
I also tried adding this, but animation_data is None
anim_data = material.animation_data.copy()
new_material.animation_data = anim_data