I’m deleting keys from multiple objects in a loop.
I’m stepping through the frames within a specific range, and deleting certain keys one at a time. The problem I have is if there are no more keys then, an error is thrown that says: “No action to delete keyframes from…”
So I added a check to see if there is animation data with the following:
if bpy.data.objects[ob.name].animation_data.action != None:
I need to call it at every frame to check for keys before I try to delete something.
That works. No more errors, but the problem is, it slows down the code enormously!
What use to take less than a second can take 5 seconds with a lot of objects and a lot of frames.
Is there a better way to delete specific keys, for frames in a specific range, without having to check for animation data?