Page 2 of 2

Re: *NEW* Find and delete negative keyframes

Posted: Thu Mar 18, 2021 6:52 am
by synthsin75
In another thread, someone also mentioned trying this:
Daxel wrote: Tue Mar 16, 2021 12:53 am Another tip: If the script doesn't find negative keyframes or you keep having performance problems, try deleting the reference layers and creating them again because they can get corrupted in certain situations. When that happens the .moho file size increases a lot and causes performance problems but what I told you solves the problem easily.

Re: *NEW* Find and delete negative keyframes

Posted: Sun Mar 21, 2021 3:02 am
by Daxel
kgeetvcartoons wrote: Thu Mar 18, 2021 3:16 am THANK YOU SO MUCH! It worked. It didn't find any negative keyframes so we'll work from there!
Thanks again!
Do you have reference layers? Try to delete them and see if performance improves. If it does, you can create the references again. Sometimes they get corrupted and slow Moho down.
Edit: oh I didn't see Wes mentioned this already. Anyway, did you solve your performance problem?

Re: *NEW* Find and delete negative keyframes

Posted: Mon May 03, 2021 7:52 am
by Lukas
I've been running your script automatically on opening files, because there were some instances were corrupt layers were copied to many shots and it became impossible to work on the project. It has saved me a lot of headaches. (I did remove the "There were no keyframes found in the negative timeline." alert.)

Here's a script to run scripts automatically on opening files. Save it as LK_AutoRun.lua in your tools folder. Just add SomeScript:Run(moho) or any code within the LK_AutoRun:Scripts(moho) function and it will automatically run on opening saved files (there's a small exception when re-opening the same file, but ctrl+n cltr+w will make it run again). I've been using it to run various project management scripts. But it's been the most useful for Wes' negative keyframes script.

Code: Select all

-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************

ScriptName = "LK_AutoRun"

-- **************************************************
-- General information about this script
-- **************************************************

LK_AutoRun = {}

function LK_AutoRun:Name()
	return "Auto Run Script"
end

function LK_AutoRun:Version()
	return "0"
end

function LK_AutoRun:Description()
	return "Auto Run Scripts"
end

function LK_AutoRun:Creator()
	return "Lukas Krepel, Frame Order"
end

function LK_AutoRun:UILabel()
	return("Auto Run Script")
end

function LK_AutoRun:IsRelevant(moho)
	if (MohoMode == nil or MohoMode:Vanilla()) then
		return false
	else
		self:Run(moho)
		return false
	end
end

function LK_AutoRun:IsEnabled(moho)
	self:Run(moho)
	return false
end

LK_AutoRun.LastDocument = ""

-- **************************************************
-- Check if we have already run on this document.
-- Does not work when opening the same file after just closing it.
-- If you DO want to run it in that case, just create and close a new empty file.
-- **************************************************
function LK_AutoRun:Run(moho)
	local thisDocument = moho.document:Path()
	if (self.LastDocument ~= thisDocument) then
		self.LastDocument = thisDocument
		self:Scripts(moho)
	end
end

-- **************************************************
-- Put all code you want to run automatically in this function:
-- **************************************************
function LK_AutoRun:Scripts(moho)
	Syn_NegativeKeys:Run(moho)
end

Re: *NEW* Find and delete negative keyframes

Posted: Mon May 03, 2021 10:35 am
by synthsin75
Nice one, Lukas. I've been using the IsRelevant or IsEnabled functions to automatically run code for years.

Currently, I'm using it to invoke a button script's settings dialog, that I only need once, at most, every time I start Moho.

Re: *NEW* Find and delete negative keyframes

Posted: Tue May 25, 2021 12:04 am
by kgeetvcartoons
I have moho 13.5 and your script is not available. Can you please give me the info of how to download and where to get the download again? I see the copy and paste but I don't have a clue what to do with it.

Re: *NEW* Find and delete negative keyframes

Posted: Tue May 25, 2021 12:47 am
by Greenlaw
The link is in the first post, and the current version works for Moho 13.5. When the script is updated, this same link will download the latest version.

If you want Lukas 'auto-run' mod, just copy and paste the text from his post above exactly as instructed.

Hope this helps.

Re: *NEW* Find and delete negative keyframes

Posted: Sat Sep 04, 2021 3:56 am
by AHMED003ADALAT
link lead to 404 error

Re: *NEW* Find and delete negative keyframes

Posted: Sat Sep 04, 2021 6:20 am
by synthsin75
AHMED003ADALAT wrote: Sat Sep 04, 2021 3:56 am link lead to 404 error
Link fixed: https://drive.google.com/uc?export=down ... f-pbWRqj1a

Re: *NEW* Find and delete negative keyframes

Posted: Sat Sep 04, 2021 6:37 am
by davoodice2
Greenlaw wrote: Sun Sep 29, 2019 3:43 pm
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.
2 days ago my moho became like turtle 🐢. I restart several time moho and pc until problem be solved. I even wanted to go and cut off the main electricity in the city

Re: *NEW* Find and delete negative keyframes

Posted: Tue Feb 07, 2023 5:56 pm
by animated_magic
Thank you Wes, you're a life saver! Had negative keyframes happen a couple of times and it was driving me a slightly crazy. This script is brilliant!

Re: *NEW* Find and delete negative keyframes

Posted: Wed Feb 08, 2023 1:06 am
by synthsin75
Always happy to hear old scripts are still helping people.