Clean keyframes script?

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

User avatar
Lukas
Posts: 783
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Clean keyframes script?

Post by Lukas » Tue May 22, 2018 10:22 am

That was fast! Great work, so far it all works perfectly. Thanks a lot! :mrgreen:
synthsin75 wrote:Lukas, it won't work exactly like you colored the keys in your example file. It always leaves the last keyframe in a channel, but if I got enough feedback that that was undesired, I could change that.
I can imagine that's actually the best way to do it, since the last keyframes might be the first pose of a new pose-to-pose segment. So leaving them is the best way to handle it indeed!
synthsin75 wrote:And if you use that file to test separate dimensions, the z-axis is unchanged, so it will only leave the last key on that channel.
Perfect
synthsin75 wrote:Still doesn't handle camera channels.
No sweat :) Camera keys are usually quite easy to keep clean manually, compared animated objects.

Any chance of this tool also working for points someday? (I can imagine that's an entirely different beast and much harder to do)
EDIT: I just checked and realized it also works for points already, AWESOME!
User avatar
synthsin75
Posts: 7114
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Clean keyframes script?

Post by synthsin75 » Tue May 22, 2018 6:54 pm

Glad to hear it's doing everything you need, Lukas.
User avatar
Lukas
Posts: 783
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Clean keyframes script?

Post by Lukas » Tue May 29, 2018 9:21 am

Hmmm, actually I've been coming across this one situation where it's actually wishful to delete the last keyframe also a few times already.

When the last keyframe is the only keyframe in a channel and it has the same value as frame 0, it would be better if it would be deleted.

For example:

I've been animating a few shots, I press Ctrl+F to freeze the poses all the time. And adjust the poses along the way. Very often I only use translate and rotate bone and don't use scale bone at all in a shot.

So when I'm done with the rough animation, everything pose to pose, I'd like to press 'clean keys' and continue on the details with a nice clean timeline. The problem is, even though I haven't touched scale bone on any of the bones. On the last pose, the scale keys will always remain there. (And so will the channels when they are set to 'auto' in the channel visibility window). You'd expect the scale channels to dissapear if you haven't animated them at all.

So in those cases, when the last key is the only key and it matches frame 0, I think it would be better of cleaned/deleted. :) I hope that makes sense.
User avatar
Lukas
Posts: 783
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Clean keyframes script?

Post by Lukas » Fri Jun 01, 2018 1:39 pm

Okay, after using your script a bit more, I'm certain it would definitely be more useful if the last key would also be deleted if it is 'obsolete'. At all times :)
User avatar
synthsin75
Posts: 7114
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Clean keyframes script?

Post by synthsin75 » Fri Jun 01, 2018 10:11 pm

Lukas wrote:Okay, after using your script a bit more, I'm certain it would definitely be more useful if the last key would also be deleted if it is 'obsolete'. At all times :)
Yeah, I agree and had been looking into it since your last post. How the script is structured, that's not a quick or easy change. I'll continue to look into it as I have time.
User avatar
synthsin75
Posts: 7114
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Clean keyframes script?

Post by synthsin75 » Sun Jun 03, 2018 7:40 am

Okay, this script now comes in two flavors:
Regular: https://sites.google.com/site/synthsin/ ... ects=0&d=1
This version retains the last keyframe, unless it only finds one key that matches frame zero. So if the channel is unanimated, running it once deletes all but the last key (in case you need it for a hold) and running it again deletes these lone keys (except of split dimension channels).
Severe: https://sites.google.com/site/synthsin/ ... ects=0&d=1
This version always deletes the last keyframe if it is obsolete (even for split dimension channels).
User avatar
Lukas
Posts: 783
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Clean keyframes script?

Post by Lukas » Tue Jun 05, 2018 8:48 am

Cool, I'll try using them both. This is extremely useful stuff Syn, great work and thanks for sharing!

Edit: I encountered a situation where keys aren't being deleted when they actually should (I think?). See this file. Both the 'Pupil1' and 'Pupil2' bones still have a keyframe at frame 82 after running the severe script. Unless I'm missing something, you'd expect them to get deleted right?
User avatar
synthsin75
Posts: 7114
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Clean keyframes script?

Post by synthsin75 » Wed Jun 06, 2018 5:34 am

Updated both. I forgot to handle last step keys.
User avatar
Lukas
Posts: 783
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Clean keyframes script?

Post by Lukas » Wed Jun 06, 2018 6:21 am

Much appreciated! Tested and works :)
User avatar
Víctor Paredes
Posts: 4864
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland/Chile
Contact:

Re: Clean keyframes script?

Post by Víctor Paredes » Wed Jun 06, 2018 5:09 pm

A.Evseeva wrote:Victor, please check the latest version of my keytools script, it has the CLEANUP option, making what, I suppose, You wanted. Unfortunately it does not check bezier handles, but in some cases it can help.
Hi, A.Eseeva
I have been using your script and for both cleaning the animation and also copying and pasting poses in the characters. It's fantastic. Is there any specific thread about your script? I can't find any.
Thanks!
Víctor Paredes
Former Moho Product Manager
Animator in Cartoon Saloon
My Youtube Channel - My webinars
A.Evseeva
Posts: 33
Joined: Wed Apr 08, 2015 8:43 am
Contact:

Re: Clean keyframes script?

Post by A.Evseeva » Thu Jun 07, 2018 4:47 pm

Víctor Paredes wrote: Is there any specific thread about your script? I can't find any.
It was started here:
http://lostmarble.com/forum/viewtopic.php?f=12&t=31523
User avatar
Víctor Paredes
Posts: 4864
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland/Chile
Contact:

Re: Clean keyframes script?

Post by Víctor Paredes » Fri Jun 22, 2018 8:48 am

A.Evseeva wrote:
Víctor Paredes wrote: Is there any specific thread about your script? I can't find any.
It was started here:
http://lostmarble.com/forum/viewtopic.php?f=12&t=31523
Thanks!
Víctor Paredes
Former Moho Product Manager
Animator in Cartoon Saloon
My Youtube Channel - My webinars
User avatar
Lukas
Posts: 783
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Clean keyframes script?

Post by Lukas » Tue Jul 24, 2018 10:03 am

Bumped into another exception :shock:

The first 'switch' keyframe remains on the timeline after running the clean keyframes script. I tried A.Evseeva's version, and it skips it there too.

(Edit: Wait...there might just be something wrong with my keys instead (some script created the keys))

(Edit 2: Yep, false alarm. The other script created faulty keys. Ignore this post.)
Post Reply