Hello, As explains in this article, a new tool Clean Keyframes, for Dopesheet and Graph Editor, was added in X menu of 2.75a Blender version.

Here is an example of use.

From default cube, I insert following keyframes :

  • Image 1 : LocRotScale, to save location, rotation, and scale
  • Image 5 : After moving on Y axe, I insert location using Location
  • Image 10 : Moving cube on Y axe, and insert Location
  • Image 15 : Insert Location, without moving cube
  • Image 20 : Moving cube on Y axe, insert Location
  • Image 25 : Insert Location, without moving cube

In the Graph Editor, we can see following curves :

We can see Y Location on green. Scale curves, with value 1, are also visible, with only 1 keyframe, on frame 1. Rotation curves are also visible, at exactly same position than location on X and Z axes, with value 0.

In order to use Clean Keyframes, we first select all keyframes on all curves. Clean Keyframes will be applied on entire animation.

We can see :

  • Keyframe, on frame 25 of Y axe location, was deleted. It was not useful to keep it, because value on frame 20 and 25 was identical. Tool didn’t delete value on frame 10 and 15, because this would change interpolation.

  • X and Z Location curve are now cleaned. Only 1 keyframe is remaining. Before cleaning, all keyframe values are identical.

  • Scale curves are also clean, with only 1 keyframe on each curve.

  • Why keep these curves with only 1 keyframe. These curves don’t express animation (because these curves have not any modifiers) ? This is why a new tool will be added on version 2.76.This tool works quite same way than Clean Keyframes, but will delete curves with only 1 keyframe, after cleaning keyframes. We can see on next screenshot that all curves, except Y axe, are deleted.

Here is another example, on a production file. The animation use the following rig (You will hear again about this rig in following months) :

The shot is currently in rough blocking stage. 385 frames, about 16 seconds.

Helped with a script (see end of post), we count how many curves and keyframes are present in animation, before cleaning, and after using these 2 tools.

  Courbes Image clés
Initial 9223 543550
After “Clean Keyframes” 9223 11061
After “Clean Channels” 203 2041

As you can see, cleaning was really useful !

import bpy

ob = bpy.context.active_object

print(“fcurves : “ + str(len(ob.animation_data.action.fcurves)))

keyframes = 0

for fcurve in ob.animation_data.action.fcurves:

keyframes = keyframes + len(fcurve.keyframe_points)

print(“keyframes : “ + str(keyframes))