Keyframe Reduction for Maya using least-squares method.
A button on the MiscTools shelf will be created that will allow easy access to the ui, this way the user doesn't need to worry about any of the code. If user wishes to not use the shelf button the following commands can be used.
The ui responds to the current selection where it finds all of the suitable animation curves for reduction. You will be able to filter the animation curves based on the plug it is connected to. This will make it easier to target exactly the curves you want to reduce.
After an animation curve is reduced the reduction percentage will be printed to the console. This can give you an idea if you would like to increase or decrease the error rate to get the desired results.
Display the UI with the following code.
import keyframeReduction.ui
keyframeReduction.ui.show()
Use the KeyframeReduction class on individual animation curves.
from keyframeReduction import KeyframeReduction
obj = KeyframeReduction(pathToAnimCurve)
obj.reduce(error=0.1)
The fitting algorithm is ported from Paper.js - The Swiss Army Knife of Vector Graphics Scripting. http://paperjs.org/