*NEW* Find and delete negative keyframes

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

*NEW* Find and delete negative keyframes

Post by synthsin75 »

https://drive.google.com/uc?export=down ... f-pbWRqj1a

This will find and show a list of all the keyframes in the negative timeline, and ask if you want to delete them. This will solve a lot of problems with layers freaking out and other odd behaviors.

If the list is too long and the buttons are off screen, you can just hit "y" to delete them or "n" to cancel.

It avoids what seem to be legit keyframes on the negative timeline, but until there are more test cases, use it on a copy of your file so you can verify everything is working fine.
Last edited by synthsin75 on Sat Sep 04, 2021 6:18 am, edited 2 times in total.
User avatar
Lukas
Posts: 1295
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: *NEW* Find and delete negative keyframes

Post by Lukas »

This could be useful for troubleshooting troublesome files, thanks for sharing. :)
User avatar
Penny
Posts: 51
Joined: Sun Dec 02, 2018 3:56 pm
Location: Italy

Re: *NEW* Find and delete negative keyframes

Post by Penny »

Thanks Wes! This is very helpful!
Even with the head in the clouds You can touch the ground

https://www.facebook.com/santiago.penny
https://www.behance.net/pennysantiago
Slyanim
Posts: 23
Joined: Wed Jan 25, 2017 11:42 pm

Re: *NEW* Find and delete negative keyframes

Post by Slyanim »

Life saver! Thank you Wes!
catwrestler
Posts: 11
Joined: Fri Aug 16, 2019 12:52 am

Re: *NEW* Find and delete negative keyframes

Post by catwrestler »

Negative keys... interesting. I'm wondering what are major causes and how do I know I have them?
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Find and delete negative keyframes

Post by synthsin75 »

If you have any significant performance issues or weird behavior, you can run this script to see if keyframes in the negative timeline may be a cause.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *NEW* Find and delete negative keyframes

Post by Greenlaw »

catwrestler wrote: Sat Sep 28, 2019 3:39 am Negative keys... interesting. I'm wondering what are major causes and how do I know I have them?
Coincidentally, a user in another forum asked this same question yesterday, so I'm re-posting an edited version of my reply here:

You'll know when this happens: Moho will suddenly crawl like it's processing the entire internet. :)

This happens when Moho places an unintended keyframe thousands of frames before frame zero, which apparently causes the computer to evaluate every frame in-between. It takes only one of these unintended keyframes to seriously impact Moho's performance. If there's more than one, Moho may become unusable. By 'serious impact', I mean basic actions like trying to animate a bone or copy and paste a keyframe will make Moho take a long pause, and getting any work done will take forever.

To fix this previously, you had to copy the visible keyframes for each channel, delete the entire channel, and then paste the intended keyframes back into the channel. Then you had to repeat this for every channel until you were sure you got rid of any and all of the unintended keyframes. Needless to say, this could be a huge time-waster. Or, if you know what to look for, you could search for the bad keyframes in the project file using a text editor and delete the keys that way.

Wes' script simplifies the process to a single command.

FYI, this issue happened to me Friday at work: A Moho rigged character I was animating suddenly became sluggish for no apparent reason. Even copying and pasting keys took forever. Prior to this slow-down, the rig was very responsive and quick to animate, so I was pretty sure I had at least one negative keyframe in this project.

When I ran Wes' script, it confirmed that this was indeed the case and it fixed the problem instantly.

If the script says there are no negative keyframes in the project, then at least you know to look elsewhere for the problem.

As mentioned above, you should save a backup copy of your project before running this script, just in case it does more harm than help.

Nobody seems to know why it happens but fortunately the problem occurs rarely. Also, it may occur in Moho 12.5 and earlier but I'm not yet sure that this happens in Moho 13.
User avatar
Lukas
Posts: 1295
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: *NEW* Find and delete negative keyframes

Post by Lukas »

Does anyone have a clue how these negative frames might be created? The only thing I can think of in corrupt recovery files?
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: *NEW* Find and delete negative keyframes

Post by hayasidist »

Lukas wrote: Fri Feb 19, 2021 3:00 pm Does anyone have a clue how these negative frames might be created? The only thing I can think of in corrupt recovery files?
the default frame for shape creation is -1,000,000 http://mohoscripting.com/methods/82 but I've never seen a key there...
the animated scatter brush shapes have keys in the "-1 to -100" (ish) range.

other than that -- sorry -- dunno!! (and, at the risk of causing it to happen -- I haven't experienced such a problem yet, but if I do, I'll do some serious digging)
Daxel
Posts: 967
Joined: Wed Mar 27, 2019 8:34 pm

Re: *NEW* Find and delete negative keyframes

Post by Daxel »

Thank you! I will save it for when I need it. So far all my performance problems have always been solved deleting some reference layer. They get corrupted sometimes.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *NEW* Find and delete negative keyframes

Post by Greenlaw »

I don't see the problem nearly as much as I used to (thank goodness!), but this may be because my usage of Moho at work went down for a year or two. Lately, I'm using Moho more regularly at work and at home again. So far, so good. :)

That said, I'm still thankful we have Wes' script. I seem to recall running into this issue maybe a year ago, or at least helping a co-worker that ran into it.
kgeetvcartoons
Posts: 37
Joined: Fri Mar 12, 2021 2:34 am

Re: *NEW* Find and delete negative keyframes

Post by kgeetvcartoons »

I'm having issues running the script. I download it but nothing happens or says attach the script to a software. After I download it where can I find it in Moho? How do I open it to use it. This problem of animation slow down is happening in my lip syncing and my animation. It's killing my skits! Please help!
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Find and delete negative keyframes

Post by synthsin75 »

If you haven't, you need to create a Custom Content Folder, from the preferences. Then you just need to drop this script into the Scripts>Menu folder, restart Moho, and then you can use it from the Scripts menu.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *NEW* Find and delete negative keyframes

Post by Greenlaw »

kgeetvcartoons wrote: Thu Mar 18, 2021 12:51 am I'm having issues running the script. I download it but nothing happens or says attach the script to a software. After I download it where can I find it in Moho? How do I open it to use it. This problem of animation slow down is happening in my lip syncing and my animation. It's killing my skits! Please help!
Hi,

I wrote these instructions the other day for another user, so I'm just copying it here. Hope this helps...

1. Download Wes' script from here: Find and Delete Negative Keyframes

2. With Moho 12.5 open, select File > Open Custom Content Folder. if this command isn't available, it means you haven't set a Custom Content Folder yet. To set it, select Edit > Preferences. You can set the path at the bottom of the window. The Custom Content Folder can be anywhere you like; I suggest setting it somewhere local, like maybe in a 'Moho' folder inside your Documents folder so Moho always has access to it.

3. When you have the Custom Content Folder open, open the Scripts folder, then the Menu folder. Here, make a folder for custom scripts. I like to name mine '+Special', which forces the menu to the top of the menu list, but you can call it anything you like.

4. Put the syn_negative_keys.lua script in this folder. Now you can close these folders.

5. Quit Moho and restart it. This will add the new script. (Alternatively, you can press Ctrl+Shift+Alt+L...this reloads scripts without quitting Moho.)

6. Open a copy of the Project that's giving your trouble. To be safe, make sure you're working with a copy!

7. Now you should see SYN: Negative Keys listed under the Scripts menu, inside the sub menu you created ('+Special' on my computer). Select the script, and it will do its magic. If it finds any negative keys, it will ask if you want to delete them. Say yes. (Understand that there is a possibility that this can mess up your Project file, which is why you should work with a copy. Chances are, everything will be fine though.)

8. Save your cleaned Project file and you should be ready to go.

Note 1: Under the Script menu, there is a command that tells Moho to install the script for you, but it requires that the script have a specific folder structure already set up. TBH, I'm so used to installing scripts manually (as described above,) that I almost never think to use this feature, but it's good to know about when the script author has a very specific setup in mind.

Note 2: the '+Special' folder is just something I do to keep things tidy. I actually go a step further by adding sub-folders by author inside that folder. You can use any structure that works best for you.

Note 3: the steps are the same for Moho 13.0 but the reload scripts shortcut is different. Frankly, I'd stick with Moho 12.5, and wait until Moho 13.5 comes out before setting this up for this version.
kgeetvcartoons
Posts: 37
Joined: Fri Mar 12, 2021 2:34 am

Re: *NEW* Find and delete negative keyframes

Post by kgeetvcartoons »

THANK YOU SO MUCH! It worked. It didn't find any negative keyframes so we'll work from there!
Thanks again!
Post Reply