Remove keyframes if keyValues are on linear path(with a tolerance value)

animation
math
maya
python

#1

Hi,
I want to create a simple tool that does a curve cleanup (kinda like delete redundant keys), im using maya and python.

I want to remove keyframes between a given range , if these are in a linear path between the two extremes.
I also want to have a tolerance value(since often these inbetween keys have some small float value ,therefore not quite perfecty linear .( visually wouldn’t make a difference).

Some times while animating, i am baking stuff out and i end up having to do this task manually, for keys with the same values there is plenty of tools that do this but not for linear curves.

The part im stuck with, is the logic of how to find if one or more keys are in a linear path between two extremes keys.(not quite sure whats the best way to do such a thing?)

cheers


#2

You can already do this in the graph editor using the simplify keys command. Curves->Simplify Curves. There is also a maya command. http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/simplify.html


#3

Hi Sariel,
thanks for the reply, alto i would prefer to understand how i can do something like this in an efficient way, this would be also part of some other handy toolset, therefore i would rather write my own version and add to it later on :slight_smile: .

cheers