1
$\begingroup$

I found this thread but it didn't help. The only source i found that clears "all" animation data is

for o in bpy.context.scene.objects:
    o.animation_data_clear()

But this does not remove animation data or keyframes for MeshVertex data

enter image description here

I have a lot of keyframes added throughout the timeline using

for v in o.data.vertices:
    v.keyframe_insert(data_path="co", frame=1)

I think it's wrong and weird if you have to manually loop through all the frames to delete those frames like this, which also causes an error if the other frames have no keyframes.

for o in bpy.context.scene.objects:
    o.animation_data_clear()
    for v in o.data.vertices:
        for f in range(bpy.context.scene.frame_end):
            v.keyframe_delete(data_path="co", frame=f)

Is there no single function that will just clear ALL keyframes at once? Is manual looping the only way?

$\endgroup$

1 Answer 1

1
$\begingroup$

Since vertices fcurve are not stored in objects, you can access it from bpy.data.actions

import bpy

actions = bpy.data.actions
for a in actions:
    actions.remove(a)
$\endgroup$
1
  • $\begingroup$ nice this works! thank you so much! $\endgroup$ Jul 15, 2022 at 9:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .