Script to freeze-keyframe selection X frames before cursor

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

Post Reply
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Script to freeze-keyframe selection X frames before cursor

Post by lehtiniemi » Wed Feb 24, 2016 1:05 pm

I'm looking for a script that would keyframe my currently selected bone/layer/points X frames before cursor position.

When doing Family Guy -kinda animation where people stay in position, change position every now and then, the characters stay in the same position for while, then one thing changes, then they stay again. When I add a new keyframe for example moving looking down, I _always_ need to add the previous keyframe again 3-5 frames before the new keyframe.

I'd really like to find a script that would duplicate the current position keyframes some frames before the current position automatically. I remember there's some script called bone time machine, this might solve this, I have to try it.

Any suggestions? Or maybe ASPRO has this as a feature already?
User avatar
Víctor Paredes
Posts: 4951
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland/Chile
Contact:

Re: Script to freeze-keyframe selection X frames before curs

Post by Víctor Paredes » Wed Feb 24, 2016 1:30 pm

If I understood the idea, the Hold keyframe feature should work for you.
Víctor Paredes
Former Moho Product Manager
Rigger and animator in Cartoon Saloon
My Youtube Channel - My webinars
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script to freeze-keyframe selection X frames before curs

Post by lehtiniemi » Wed Feb 24, 2016 1:36 pm

Hi!

Thanks for the reply! Yes, this basically does what I need, but often the previous keyframes are pages away in the timeline. I would need something like "Hold previous keyframes to this cursor position" or "Copy previous keyframes to cursor position". Is there perhaps a way to do this?

The new Freeze-function also got a lot smarter so it is getting there as well but it still requires going back, adding keyframes, then coming back and creating the new keyframes. The major issue is "drifting" which I would like prevent with some one-click solution.
User avatar
Víctor Paredes
Posts: 4951
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland/Chile
Contact:

Re: Script to freeze-keyframe selection X frames before curs

Post by Víctor Paredes » Wed Feb 24, 2016 2:04 pm

In that case, isn't better to just use Step interpolation as default and then add interpolation to only the keys you want?
Víctor Paredes
Former Moho Product Manager
Rigger and animator in Cartoon Saloon
My Youtube Channel - My webinars
Breinmeester
Posts: 294
Joined: Thu May 13, 2010 2:01 pm

Re: Script to freeze-keyframe selection X frames before curs

Post by Breinmeester » Mon Feb 29, 2016 12:06 pm

I just added this to our in house bone tool. What i did was travel back in the timeline from the current frame and find the first former keyframe for that anim channel and copy it to the current frame.
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script to freeze-keyframe selection X frames before curs

Post by lehtiniemi » Thu Mar 03, 2016 10:41 pm

Breinmeester, this is exactly what I would need! I just mailed someone on the forum, asking for a custom script like that on commission.

Is your custom bone-tool script for sale (or that script part of it you described)? You can pm me if you are willing to sell a script like that, that would help so much. It would need to go back for selected bones/points (or even bones only) to the first keyframe that occurs before current frame and copy that to current frame on each bone. The keyframes shouldn't be required to be in on the same frame so this operation would need to be done for each bone separately since sometimes the keyframes could occur on different frame numbers for different bones.

I find myself going back multiple pages on timeline just to find the previous freeze point all the time so this would be such a workflow improvement!

Victor, thanks for the tip! Still, besides the problem described above, I find it's somewhat faster to freeze poses than keep changing keyframe types. But on the other hand, I haven't tried working like that so I'll give that technique a go as well! Thanks for the tip again!
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script to freeze-keyframe selection X frames before curs

Post by lehtiniemi » Sun Mar 06, 2016 6:21 pm

Wrote a script to do this:

viewtopic.php?f=12&t=28908
Post Reply