How to mirror keyframes for opposite smart actions?

Wondering how to accomplish a certain animation task? Ask here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

So this has been a question that has been on my mind since I've been working on this rig of mine, and the more progress I've put into the rig, the more I really needed that feature. But now, I actually really need it if I don't want to spend another 20+ hours on one of the smart actions I'm working (basically all the arm and color corrections for the armR smart action is what I'm trying to transfer to armL smart action and others too)

I've mostly done it manually since I was never able to find a way to do it. I even opened this reddit post: https://www.reddit.com/r/MohoAnimation/ ... r_actions/, but no one could really find the answer as well.

Does anyone know a solution or script to achieve this? Thanks in advance :D
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

Just for a better understanding of what I'm trying to do, Its kind of like the ability to mirror poses and bones in Blender. But instead of the bones, I want to do it with the smart actions and their keyframes :)
User avatar
Greenlaw
Posts: 10396
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: How to mirror keyframes for opposite smart actions?

Post by Greenlaw »

I suggest making a stripped down copy of the project with the items I want to mirror, flip them, and then rename the items and actions. The items need to be renamed individually, but the Smart Bone Actions can be renamed more broadly. If you do this correctly, you can merge it back to your original project and reparent the bones of the original rig.

Note: Be sure to preserve the hierarchy of your items when you make the copy you will be editing. You don't want the rotations to be reset or they will break your Smart Bones, and you'll need to re-do the keyframes. This isn't a big deal, but it is better to avoid the hassle.

Or you can use Kuzkuz's MR Transform Rig script. Watch the video from 1:30 for details.
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

I could see it working, and the script looks like it could pretty much do the job but is there a way to flip the keyframes of the smart actions so I can transfer them to the opposite arm? (Copy and paste the keyframes in the smart action to the opposite one and reverse the keyframes)
User avatar
Greenlaw
Posts: 10396
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: How to mirror keyframes for opposite smart actions?

Post by Greenlaw »

Use Swap sides from that script collection. For example:
  • Frame zero frame should be the front-facing head pose.
  • The animation keyframe in the head turn's Smart Bone Action should be shaping the head to a profile (side) view.
  • Copy the keyframe for the profile view to the Smart Bone Action for the opposite side turn.
  • Apply Swap Sides to the art at that keyframe.
This will give you the same animation but facing the opposite direction without having to recreate the animation manually. Basically: copy/paste the keyframe, then run the script.

Note: the script can potentially produce a weird result if Bezier points are active. The point positions will be correct, but the handles may be at an incorrect angle. To fix this, just reset the points using Smooth and redraw the handles. It's a hassle but still easier than completely redrawing.

Just thinking out loud: This might work correctly if you click on the Bezier handles to keyframe their position them before running the script. I'd have to test this idea to be sure, but let me know if it works for you.

Tip #1: Use Hayasidist's Bake2PNG script to render a frame of the profile view and flip the resulting Image layer for visual reference. This makes is easier to match vector art's opposite side drawing accurately.

Tip #2: If you don't want to deal with the potential Swap Sides error, stick with regular Moho points instead using of Bezier points. I like using Bezier points, but when they cause animation problems (typically with bone animation), I fall back to regular Moho points, which will always work predictably.

Hope this helps.
Last edited by Greenlaw on Tue Sep 10, 2024 4:20 pm, edited 2 times in total.
User avatar
Greenlaw
Posts: 10396
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: How to mirror keyframes for opposite smart actions?

Post by Greenlaw »

Oh, sorry: did you mean Kuzkuz's script?

It's been a while since I used this script but from what I recall, it creates a new flipped copy limb with renamed actions associated. It doesn't change the artwork; it copies and flips the layers. Any associated Smart Bone Actions should be preserved and appropriately renamed for the side (assuming you're using L/R naming conventions.)

Personally, I just build my mirror limbs using the first method I described, and the process goes pretty quickly for me...but now that we're on this topic, I feel I should revisit this script and get more familiar with it. Faster is always better. :D
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

I think I'll use the first method you suggested, I could try doing it but if there's a video guide for it could you show me it?

Also, when you said use Swap sides from the script collection, did you mean the script tab in the Moho or something else?
User avatar
Greenlaw
Posts: 10396
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: How to mirror keyframes for opposite smart actions?

Post by Greenlaw »

Oh, shoot...sorry. When I mentioned Swap Sides, I was thinking about another thread I responded to. Ugh, I've been up since 2 AM, editing a tutorial video, so I'm not at my sharpest right now. Anyway, Swap Sides isn't particularly useful in this situation, but the MR Transform Rig script definitely is. :)

But, while we're on this topic, if you're curious about Swap Sides, it's a script that reshapes a path into a mirror reflection of itself, which is very useful for morphing left/right head shapes in head turn animations. You can read more about it here: DWWRoot Scripts. The download links can be found a few posts below the linked post. Once installed, Mirror Points and Swap Sides can be found in the Scripts menu.

I wish I could tell you more about how to use MR Transform RIg, but it's been a while since I last used it, and I'll need a refresher myself. There is a video at Moho Scripts that demonstrates many of its features. Before applying MR Transform Rig to a finished rig, I would make a quick and simple 'dummy' rig to test and familiarize myself with the tool.
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

Thanks for the reply and good luck on your video! I just realized that I won't be needing any of those scripts. As I said in one of the previous posts, I wanted to actually change the keyframes of the actions, not the bones or limbs.

I was doing some more research and stumbled upon what I actually needed (viewtopic.php?t=29976). I saw it in the tooltip but wasn't sure if it actually worked, but now I know better :D

All I need to do now is find a way to properly copy+paste the keyframes to the other action. For some reason I'm not able to ctrl/cmd c and z the keyframes, and even the right-click menu (despite allowing me to copy it) won't allow me to paste it until their keyframes in that timeline (and when I paste with the keyframes, the limb I'm working on absolutely breaks and scatters all over the place even after trying to remove those keyframes :|)

Are they any solutions or scripts that can help me fix this problem?
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

Also want to be sure if flipping the keyframes actually can play them in reverse and add them to other smart actions to control that bone instead
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

Also opened up this same issue on discord to help me get more answers quickly! :)
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

Even after getting on the official Moho Discord server, I still could not find any answers to this problem. I really want to keep on working on the rig, but it would make my life a lot easier if I could just copy what I already have instead of having to make it again (especially the colour points)

Does anyone have any suggestions or scripts to help me out with this? :cry:
User avatar
Hoptoad
Posts: 716
Joined: Sun Jan 03, 2016 4:19 pm
Location: Florida

Re: How to mirror keyframes for opposite smart actions?

Post by Hoptoad »

You're not alone.

In my opinion, Moho has a few advanced processes that are difficult for an average user to implement. Some of the few people who know how to employ those processes have tried explaining how they do it from time to time, but I often cannot make them work. I probably need somebody in a chair sitting next to me, answering my 100 questions.

Nowadays, I just do everything the hard way. On the bright side, I've gotten much faster at rigging characters. :D
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

Yeah, your right. I've spent so long on this issue that it's actually delayed the making of my rig, so I decided that if I still couldn't get any answers today, then I'll just have to manually correct the points and color points on my own. I just hope this actually becomes a thing in the future, that way it can make everyone's life easier, and make it surpass other animation softwares!

Thanks for the response tho! :D
User avatar
ZV1LLE
Posts: 92
Joined: Mon Apr 01, 2024 5:32 pm

Re: How to mirror keyframes for opposite smart actions?

Post by ZV1LLE »

I FOUND A SOLUTION! https://discord.com/channels/1123979330 ... 7853332511 This is where I explain everything, Its not exactly what I was looking for, but it still works perfectly either way. This topic has been solved :D (Just gotta fix some more issues with the smartbones though, but I can deal with that on the discord instead)
Post Reply