Fcurve questions

Hi,

Is there a quick and sneaky python way to get the maximum/minimum value for an fcurve? and does someone have an example of cleaning an fcurve via a script.

Cheers.

Funny story… I had min/max functions as part of a patch for f-curves and was asked “what would that be used for?”

Basically you have to loop over the f-curve and run .evaluate() on each point and store the min/max yourself.

And there’s a clean f-curve script in the script directory I believe.

Min/max wouid be a handy little switch in the envelope modifier…

And I looky but I don’t find the f-curve clean file… Which scripts folder?

Guess clean_fcurve is a C function, sorry.

Maybe it should be thought of as a bounding box. The values would be in the Y direction and the X would contain time.

and does someone have an example of cleaning an fcurve via a script.

File / User Preferences / Addons / Add Curve / Simplify Curves
http://www.blendercookie.com/2010/07/26/tip-simplify-animation-curves/

Thanks for that Richard,

The simplify actually does the cleaning with its own routine, whereas I was after an example of bpy.ops.graph.clean or bpy.ops.action.clean from a script. … actually just got it working “sorta”… from the UI in the GRAPH EDITOR

I think that a clean API method in the fcurves collection would be handy eg

fcurves.clean(fcurve=fcurve,threshold=0.001)