HeyVern's scripts and tools - (focus on bones)

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Breinmeester
Posts: 303
Joined: Thu May 13, 2010 2:01 pm

Post by Breinmeester »

Rudiger did a script that loads and saves animation into actions so its ready to be pasted at any point in the timeline and for multiple times.
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: HeyVern's scripts and tools - (focus on bones)

Post by davoodice2 »

any body can fix links? and block this bot from forum
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: HeyVern's scripts and tools - (focus on bones)

Post by hayasidist »

davoodice2 wrote: Thu Oct 28, 2021 8:13 am any body can fix links?
Vern was back and active on the forum recently -- you could try a PM to him...
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: HeyVern's scripts and tools - (focus on bones)

Post by davoodice2 »

hayasidist wrote: Thu Oct 28, 2021 10:44 am
davoodice2 wrote: Thu Oct 28, 2021 8:13 am any body can fix links?
Vern was back and active on the forum recently -- you could try a PM to him...
thanks
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
Lukas
Posts: 1294
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: HeyVern's scripts and tools - (focus on bones)

Post by Lukas »

heyvern wrote: Tue Jan 30, 2007 7:50 amNEW! Save and Load bone Animation!
[...]
-vern
Hi Vern, do you still have these scripts? Even though they are outdated, I'm very interested and could possibly update them. I am building a tool for re-using animation, but have not figured out how to build a library yet. This sounds like a smart way of going about it.
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: HeyVern's scripts and tools - (focus on bones)

Post by Víctor Paredes »

Hey, Lukas.
I couldn't find Vern's script (although I'm sure I should have a backup somewhere), but in the forum I found this other script made by David F. Sandberg. Maybe it can help:
https://www.lostmarble.com/forum/viewto ... 12&t=16748
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
Lukas
Posts: 1294
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: HeyVern's scripts and tools - (focus on bones)

Post by Lukas »

Víctor Paredes wrote: Tue Feb 01, 2022 10:28 am Hey, Lukas.
I couldn't find Vern's script (although I'm sure I should have a backup somewhere), but in the forum I found this other script made by David F. Sandberg. Maybe it can help:
https://www.lostmarble.com/forum/viewto ... 12&t=16748
Thank you Victor, I'll have a look!
teotoon
Posts: 135
Joined: Wed Aug 04, 2004 7:19 am
Location: Turkey

Re: HeyVern's scripts and tools - (focus on bones)

Post by teotoon »

Hello Lukas,

I found the script you've asked. I also added a similar script.

I hope these would be helpful.

Good luck,

LG

https://www.mediafire.com/file/80nwka7u ... s.zip/file
https://www.mediafire.com/file/4byzonon ... n.zip/file
User avatar
Lukas
Posts: 1294
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: HeyVern's scripts and tools - (focus on bones)

Post by Lukas »

teotoon wrote: Tue Feb 01, 2022 8:54 pm Hello Lukas,

I found the script you've asked. I also added a similar script.

I hope these would be helpful.

Good luck,

LG

https://www.mediafire.com/file/80nwka7u ... s.zip/file
https://www.mediafire.com/file/4byzonon ... n.zip/file
Much appreciated!
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Re: HeyVern's scripts and tools - (focus on bones)

Post by heyvern »

Sorry for being away again.
Yes, I still have these scripts. I haven't used them in ages since Moho has its own built-in copy/paste bones.
As you said they don't work very well in newer versions of Moho. There was way too much version-specific junk in there.
I will try to post them later tonight after work.
My script was based on the same scripts posted here and created by "Tha Narie".
I think when I revised it, there were so many changes I simply replaced my name on it. I did combine it into one script and added some extra functions. This was ages ago so it's hard to remember. I do remember that script was A NIGHTMARE to work on. There are SO MANY BONE PROPERTIES to track for copy and paste.:shock:

I also had a "save animation" script that's in the same shape. It required similar amounts of nightmarish coding to manage all properties not just of bones but EVERYTHING. I believe my first iteration only saved bone animation.
User avatar
Lukas
Posts: 1294
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: HeyVern's scripts and tools - (focus on bones)

Post by Lukas »

heyvern wrote: Sat Feb 05, 2022 9:50 pmSorry for being away again.
Yes, I still have these scripts. I haven't used them in ages since Moho has its own built-in copy/paste bones.
As you said they don't work very well in newer versions of Moho. There was way too much version-specific junk in there.
I will try to post them later tonight after work.
My script was based on the same scripts posted here and created by "Tha Narie".
I think when I revised it, there were so many changes I simply replaced my name on it. I did combine it into one script and added some extra functions. This was ages ago so it's hard to remember. I do remember that script was A NIGHTMARE to work on. There are SO MANY BONE PROPERTIES to track for copy and paste.:shock:

I also had a "save animation" script that's in the same shape. It required similar amounts of nightmarish coding to manage all properties not just of bones but EVERYTHING. I believe my first iteration only saved bone animation.
Good to see you back here again!

Intesting. Saving everything in text seems like a crazy (but impressive) undertaking. How does it know what child-layers to apply keys to when loading the data? By layer-name just like bone-names?

I'm still not sure what exactly I am looking for, but here's me thinking out loud:
I think this might be a good (and simpler, thus less prone to getting broken by updates) solution to my problems:
  • An 'Export all actions as moho files' script. That exports all Regular and Morph actions of a layer as .moho files (with all keys in the Mainline) in a folder. (skipping actions of which .moho files already exist in that folder)
  • An 'Import actions from folder' script. That imports all .moho files in a folder a user points at. It would simply interpret the mainline keys from "Walkcycle.moho" as an action named "Walkcycle".
That way it doesn't matter in what kind of file you're creating new actions for re-use (because often you animate something in a regular shot that you later realise is great for re-use). And if you work on a file and realise you could re-use an action but you're working on an outdated version of a rig (which happens a lot for a variety of reasons) you can still just easily import all re-usable animation.
As a bonus you can easily update actions by simply editing the animation in "Walkcycle.moho" and the next time you import you'll have the latest versions of all actions.

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

Re: HeyVern's scripts and tools - (focus on bones)

Post by Lukas »

Lukas wrote: Sun Feb 06, 2022 9:46 am
  • An 'Export all actions as moho files' script. That exports all Regular and Morph actions of a layer as .moho files (with all keys in the Mainline) in a folder. (skipping actions of which .moho files already exist in that folder)
  • An 'Import actions from folder' script. That imports all .moho files in a folder a user points at. It would simply interpret the mainline keys from "Walkcycle.moho" as an action named "Walkcycle".
Oops, this turned out to be more difficult than I thought it would be... Because I can't modify and save a MohoDoc returned from LoadDocument() or by creating new files.

The "Actions" window actually has "Import Action" and "Export Action" buttons, but unfortunately I can't find a lua function that does the same thing.
It does just seem to write a json file, so it might be close in functionality to your save/load script Vern.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: HeyVern's scripts and tools - (focus on bones)

Post by synthsin75 »

Lukas wrote: Mon Feb 07, 2022 3:37 pm Because I can't modify and save a MohoDoc returned from LoadDocument() or by creating new files.
You should be able to save a new file using: ScriptInterface:FileSave() or ScriptInterface:FileSaveAs(path)
Maybe you were looking at: LM.GUI.SaveFile(caption)
That only prompts the user for a path.
User avatar
Lukas
Posts: 1294
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: HeyVern's scripts and tools - (focus on bones)

Post by Lukas »

synthsin75 wrote: Tue Feb 08, 2022 1:18 am
Lukas wrote: Mon Feb 07, 2022 3:37 pm Because I can't modify and save a MohoDoc returned from LoadDocument() or by creating new files.
You should be able to save a new file using: ScriptInterface:FileSave() or ScriptInterface:FileSaveAs(path)
[...]
Ah you're right, thanks! After ScriptInterface:FileSaveAs(path) I can keep using moho.document to modify each file. I'm not sure what I was doing wrong before. I'm still having some trouble reverting back to the old file after exporting all actions as .moho files. It crashes, but only sometimes (all tested on the same file). API access to 'export action' and 'import action' would make all of this a lot easier :/
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: HeyVern's scripts and tools - (focus on bones)

Post by synthsin75 »

Yeah, I think we've talked about Moho not quite updating the moho.document reference before, especially with new, tabbed documents. Have you tried by having the script only have one open document at a time?
Post Reply