0
$\begingroup$

I thought this would be straight forward, but I'm still struggling to learn the API. I need to delete keyframes for shape keys on the selected or active objects (either or really at this point) For whatever reason this doesn't seem to work for shape keys.

import bpy

context = bpy.context

for ob in context.selected_objects:

    ob.animation_data_clear()

Anyone any pointers?

$\endgroup$
1
$\begingroup$

Object animations are at object level (like location).

Shape keys animations are as its own data level. Add the line below:

import bpy

context = bpy.context

for ob in context.selected_objects:
    ob.animation_data_clear()
    ob.data.shape_keys.animation_data_clear() # <<<<
    
$\endgroup$
1
  • $\begingroup$ thank you! something to get used to, but makes sense. $\endgroup$ – danulrich Nov 19 '20 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.