We’re looking at ways we can reduce the number of keys, currently I am using a process that checks the last position of the key and if it’s less than a value (0.05 this can be increased to remove more keys) we’re also only able to work with Linear keys, no Bézier Curves Currently doing it in C++ Maya API so I will convert to Python for you:
for value in indexValues:
if value != 0:
keyValueChange = cmds.keyframe(curves, index=(value, value), query=True, valueChange=True)[0]
self.keyInfo['total'] = self.keyInfo['total'] + 1
valueChangedFromLastKey = abs(keyValueChange - lastValue)
if valueChangedFromLastKey <= 0.05:
self.keyInfo['deleted'] = self.keyInfo['deleted'] + 1
deletes.append(value)
It will clean up half of our Animation sizes, while this was a quick fix I am looking at better ways to accomplish a more automated system since we’re still needing to manually confirm this looks good.
I’ve stumbled across a few papers but most of them are how to use curve calculations and how to set up Bézier Curves. Does anyone have any suggestions on how I could make a better algorithm to remove unnecessary keys?