MR Bake Bone Dynamics

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
KuzKuz
Posts: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

MR Bake Bone Dynamics

Post by KuzKuz »

This script allows you to bake the movement of the bones created by bone dynamics.



Download link: https://mohoscripts.com/script/mr_bake_bone_dynamics
User avatar
Greenlaw
Posts: 9270
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Bake Bone Dynamics

Post by Greenlaw »

This sounds excellent Eugene! I can't wait to download and try it out this evening.

Thank you for sharing this! :D
Last edited by Greenlaw on Mon Apr 01, 2024 5:41 pm, edited 3 times in total.
Daxel
Posts: 996
Joined: Wed Mar 27, 2019 8:34 pm

Re: MR Bake Bone Dynamics

Post by Daxel »

Wow this is so cool! Thank you for sharing and explaining (:
User avatar
KuzKuz
Posts: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Bake Bone Dynamics

Post by KuzKuz »

Thanks!
Daxel
Posts: 996
Joined: Wed Mar 27, 2019 8:34 pm

Re: MR Bake Bone Dynamics

Post by Daxel »

I tried this today after watching your youtube video tutorial but didn't manage to make it work. The script is creating keyframes for the selected bone, but these keyframes don't add any movement. Maybe the script is not compatible with Moho 14.1?
User avatar
KuzKuz
Posts: 483
Joined: Mon Aug 19, 2013 5:12 pm
Location: Ukraine

Re: MR Bake Bone Dynamics

Post by KuzKuz »

Daxel wrote: Mon Apr 01, 2024 11:14 am I tried this today after watching your youtube video tutorial but didn't manage to make it work. The script is creating keyframes for the selected bone, but these keyframes don't add any movement. Maybe the script is not compatible with Moho 14.1?
Yes, you're right. The bone dynamics in version 14 work differently, so my algorithm doesn't fit the new behavior.
Version 14 does not update the dynamics when the script changes the frame. I tried to work around this, but I wasn't successful.
Daxel
Posts: 996
Joined: Wed Mar 27, 2019 8:34 pm

Re: MR Bake Bone Dynamics

Post by Daxel »

Oh, that's unfortunate. It was a cool script. Thank you anyway!
User avatar
Greenlaw
Posts: 9270
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Bake Bone Dynamics

Post by Greenlaw »

Oh, shoot, that's too bad. It's been a while since I had to use it, but MR Bake Bone Dynamics was exactly what I needed at the time.

A minute ago, I had an idea to try Copy Deep Frame Range as a workaround since the result is baked keys in the range. Unfortunately, the command ignored the Bone Dynamics motion.

FWIW, if the goal is to reduce CPU usage and lock the animation, what I did a long time ago was use Layer Comps to pre-render the bone dynamics, import the image sequence to replace the animated element, disable bone dynamics, and hide the original art. It's not an ideal workaround, but it saved me a lot of time back when I was on my not-so-powerful laptop.
Daxel
Posts: 996
Joined: Wed Mar 27, 2019 8:34 pm

Re: MR Bake Bone Dynamics

Post by Daxel »

Greenlaw wrote: Mon Apr 01, 2024 6:05 pm
FWIW, if the goal is to reduce CPU usage and lock the animation, what I did a long time ago was use Layer Comps to pre-render the bone dynamics, import the image sequence to replace the animated element, disable bone dynamics, and hide the original art. It's not an ideal workaround, but it saved me a lot of time back when I was on my not-so-powerful laptop.
That's a nice idea but my problem is not the performance but the need for manual tweaking of the result. In this case I am animating a lot of loops so I need these dynamic bones to return to their first frame pose at the end of the loop.

I guess if I just make a loop loop for a while in the timeline, the bone dynamics should stabilise and start having the same pose at the first and last frame, but I have a timeline full of different loops one right after the other (which is very convenient to make changes, exporting, reusing keyframes etc) so I would have to split this file into a lot of files each with one of the loops looping for a while and my brain doesn't like that.
User avatar
Greenlaw
Posts: 9270
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Bake Bone Dynamics

Post by Greenlaw »

Do you still have Moho 13.5 installed? Maybe you can open the project there, bake the dynamics, and then bring the project back into 14.1 for editing.

(It's for situations like this that I keep 12.5 and 13.5 on my computer.)
Daxel
Posts: 996
Joined: Wed Mar 27, 2019 8:34 pm

Re: MR Bake Bone Dynamics

Post by Daxel »

Greenlaw wrote: Mon Apr 01, 2024 8:39 pm Do you still have Moho 13.5 installed? Maybe you can open the project there, bake the dynamics, and then bring the project back into 14.1 for editing.

(It's for situations like this that I keep 12.5 and 13.5 on my computer.)
I'm worried about the version switching causing bugs but I may try that, thank you.
User avatar
Greenlaw
Posts: 9270
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Bake Bone Dynamics

Post by Greenlaw »

Make a copy of the original project and open the copy in 13.5.

After baking the bone dynamics in 13.5, open the original project in 14.1. Then use Import Project to import the 13.5 project, and select only the relevant item. Import lists items by top layers and groups, so pick only the one containing the baked bone dynamics.

Bonus tip: It's okay to delete the original unbaked version from the 14.1 project, but I would keep it along with the baked version, but hide it and disable dynamics. This version would be my backup in case I mess up something later or need to reanimate the root object and have to rebake it.
Daxel
Posts: 996
Joined: Wed Mar 27, 2019 8:34 pm

Re: MR Bake Bone Dynamics

Post by Daxel »

Greenlaw wrote: Mon Apr 01, 2024 11:02 pm Make a copy of the original project and open the copy in 13.5.

After baking the bone dynamics in 13.5, open the original project in 14.1. Then use Import Project to import the 13.5 project, and select only the relevant item. Import lists items by top layers and groups, so pick only the one containing the baked bone dynamics.

Bonus tip: It's okay to delete the original unbaked version from the 14.1 project, but I would keep it along with the baked version, but hide it and disable dynamics. This version would be my backup in case I mess up something later or need to reanimate the root object and have to rebake it.
Now that I think about it, maybe I only need to copy these baked keyframes from the 13.5 copy to the original and disable bone dynamics.
User avatar
Greenlaw
Posts: 9270
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Bake Bone Dynamics

Post by Greenlaw »

Oh, duh, you maybe be right! Simpler is better, I say.

Thanks for sharing the extra bonus tip. :D
User avatar
Greenlaw
Posts: 9270
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: MR Bake Bone Dynamics

Post by Greenlaw »

Shoot...I just tried it, and it doesn't work that way.

It seems I can copy keyframes between projects within one instance of Moho but not between two instances of Moho, whether they are the same or different versions.
Post Reply