PDA

View Full Version : FCurve Cleanup


eldee
12-04-2008, 01:02 AM
Does anybody know if there's a script available that will remove flat FCurves in the animation? I've got a rig that was not auto-keyed and has a lot of keys set on transformations it isn't using, hoping there's a fast way to clean them up rather than going in by hand and removing animation from each individual transform.

Thanks in advance

ThE_JacO
12-04-2008, 01:29 AM
you could select all your curves, turn off autotangency stuff (or it will mess with handles), and run fit with a tolerance of 0 (the tolerance option is in the preferences).
That will reduce plateaus to one keyframe on constant curves, and intervals to two.

Alternatively it's only a handful of lines of scripting to do it if you want to completely remove the animation, something on the lines of


#python
aSel = list(Application.Selection)
for eachObject in aSel:
kinePars = eachObject.Kinematics.Local.Parameters
for eachPar in kinePars:
animPars = eachPar.AnimatedParameters(1)
for eachAnimPar in animPars:
fCurve = eachAnimPar.Source
if fCurve.GetMinKeyValue() == fCurve.GetMaxKeyValue():
Application.LogMessage("Removing animation from parameter %s"%eachAnimPar.FullName)
Application.RemoveAnimation(eachAnimPar)


Be warned, the script is literally typed off the top of my head, it might not work and I can't be arsed checking right now :)

P.S.
That script only checks keyframe values, which means if the keyframes are all the same but their handles have been tweaked to produce some wavy motion it will clear out animation that isn't constant. If you need that level of control then you want to fetch the keys collection and check them for tangency and not delete unless they are all tangent (0 vertical or 0 angle).

CoolCalb
12-08-2008, 09:36 AM
Don't you mean Animation>Remove Static FCurves (I am rendering now, can't view the exact spelling)
isn't that what you need?

CGTalk Moderation
12-08-2008, 09:36 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.