Keyframe reduction for Maya using least-squares method.
Extract the content of the .rar file anywhere on disk.
Drag the keyframeReduction.mel file in Maya to permanently install the script.
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
Use the KeyframeReduction class on individual animation curves.from keyframeReduction import KeyframeReduction
obj = KeyframeReduction(pathToAnimCurve)
The maximum amount the reduced curve is allowed to deviate from the sampled curve.
The step size to sample the curve.
Reduce curve using weighted tangents, using weighted tangents will result in less keyframes but is a bit slower to calculate.
Automatically split tangents based on the angles of the sampled curve and deviation of those angles from the mean.
Use existing keyframes that have split tangents as a split tangent point.
Split tangents based on an angle value threshold.
Split tangent angle threshold value.
The fitting algorithm is ported from Paper.js - The Swiss Army Knife of Vector Graphics Scripting.