Transferring rigs from one file to another

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
striker2311
Posts: 224
Joined: Wed Aug 26, 2020 3:55 pm

Transferring rigs from one file to another

Post by striker2311 »

Hey everyone,
Greetings,

The thing I wanted to ask is like this:

Suppose I made a hand rig separately with all smart bone functions and everything, and it is working fine with many vector layers in it and one bone layer.
(Above rig is only below wrist part of the hand)

Now I want to add this rig into a human rig's bone layer with all the smart bones working in just similar manner.

Surely we can just copy and paste the whole bone layer of hand rig into human rig but that would create a separate bone layer into human bone layer and will be accessible only when we click on hand rig bone layer.

So I wanted to ask is there a way to copy hand rig into human rig's bone layer with all the smart bones working the same way ?

Thanks for time. :)
User avatar
MrMiracle77
Posts: 186
Joined: Mon Jun 24, 2019 2:30 am

Re: Transferring rigs from one file to another

Post by MrMiracle77 »

If you have the hand and its rigging in a separate file (and assuming it isn't a sub-layer of another rig), you can use file->import->moho object to pull it into a new scene and incorporate into a new rig. I have a set of standardized hands and feet just for this purpose.

To make it even handier, create a hand color/outline 'style' that imports with it and you can change the hand's colors quickly and easily after importing it.
- Dave

(As Your GM)
User avatar
striker2311
Posts: 224
Joined: Wed Aug 26, 2020 3:55 pm

Re: Transferring rigs from one file to another

Post by striker2311 »

MrMiracle77 wrote: Mon Mar 07, 2022 5:55 pm If you have the hand and its rigging in a separate file (and assuming it isn't a sub-layer of another rig), you can use file->import->moho object to pull it into a new scene and incorporate into a new rig. I have a set of standardized hands and feet just for this purpose.

To make it even handier, create a hand color/outline 'style' that imports with it and you can change the hand's colors quickly and easily after importing it.
Yeah that we can do but still it's in a different rig (two separate rigs one human rig and under that hand rig is there) , I want that bones of both the rigs will come under same bone layer with all smart bones and layers working just like always.
User avatar
Greenlaw
Posts: 9576
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Transferring rigs from one file to another

Post by Greenlaw »

One tricky bit about moving body parts between different character rigs is preserving the Smart Bone Actions. It's doable but you need to be aware of what happens when you move the part.

For example, when you unparent a bone or reparent it to a different bone, the rotational value may change and that can break a Smart Bone Action. You can prevent this by maintaining the rotation values in the structures of the rigs when you reparent the limb and controls to the other character.

Another issue is creating the mirrored version of the rig. For example, creating a functional right version of a left arm. It's not just a matter of flipping the item because you also need different Smart Bone Actions with different names to get the mirrored limb to behave independently.

What I like to save a copy of the scene with only that limb (your hand rig for example,) and if there are Smart Bone Dials associated with that rig (to turn the hand or curl fingers for example) I'll preserve the hierarchy for the SBD in the copy. In other words, if my SBDs share a parent 'mover' bone so I can move them as a group or attach them to the character's root bone, the SBDs for the hand rig should remain parented to that 'mover' bone in the copy. This will prevent these Smart Bone Actions from breaking.

Next, I make sure the bones and actions are named properly for the side it belongs to, right or left. (Naturally, this should already be done when you created the rig, but it's still good to check.) For the sake of this example, let's call this rig Hand_L. Make sure the hand still works and save it.

After that, I save a copy called Hand_R. Now, since this is still the only copy of the hand in the project, you can preserve the existing Smart Bone Actions by simply renaming them. Rename the bones and Actions to associate them with Hand_R. Flip the layers horizontally. (Sorry, at this point you'll have to experiment...I'm writing this from memory and I'm not sure which items you need to filp. Obviously, the bones and artwork need to be aligned, so I need to either flip the arm or hand bone and the hand artwork group separately, or maybe I can flip just the bones layer in one go? Not sure, but I'll check on that and update this info when I get the chance.

Anyway, now I an import the Hand_L project into the Hand_R project, and not worry about a conflict between the two hand rigs. This is the 'easy' way because if I had simply tried to duplicate the limb and flipped it, I would have had to create new actions for the flipped limb and copied/pasted all the keyframes individually. With this method, I'm mainly just renaming the Actions and bones, which is much easier.

When I'm ready to transfer this setup to another character rig, I can import this file to the character rig and reparent the parts. Alternatively, I can use Copy Layer/Paste Layer to copy the bone group from one file to the other, and then reparent the items. Don't unparent the items...reparent them directly to the corresponding bone in the other character.

This procedure might seem complicated but it's really not that hard when you understand what you're trying to prevent. It's probably easier to demonstrate with an example project, so I'll try to put something together after work tonight.
Last edited by Greenlaw on Mon Mar 07, 2022 9:09 pm, edited 1 time in total.
User avatar
striker2311
Posts: 224
Joined: Wed Aug 26, 2020 3:55 pm

Re: Transferring rigs from one file to another

Post by striker2311 »

Greenlaw wrote: Mon Mar 07, 2022 8:02 pm One tricky bit about moving body parts between different character rigs is preserving the Smart Bone Actions. It's doable but you need to be aware of what happens when you move the part.

For example, when you unparent a bone or reparent it to a different bone, the rotational value may change and that can break a Smart Bone Action. You can prevent this by maintaining the rotation values in the structures of the rigs when you reparent the limb and controls to the other character.

Another issue is creating the mirrored version of the rig. For example, creating a functional right version of a left arm. It's not just a matter of flipping the item because you also need different Smart Bone Actions with different names.

What I like to save a copy of the scene with only that limb (your hand rig for example,) and if there are Smart Bone Dials associated with that rig (to turn the hand or curl fingers for example) I'll preserve the hierarchy for the SBD in the copy. In other words, if my SBDs share a parent 'mover' bone so I can move them as a group or attach them to the character's root bone, the SBDs for the hand rig should remain parented to that 'mover' bone in the copy. This will prevent these Smart Bone Actions from breaking.

Next, I make sure the bones and actions are named properly for the side it belongs to, right or left. (Naturally, this should already be done when you created the rig, but it's still good to check.) For the sake of this example, let's call this rig Hand_L. Make sure the hand still works and save it.

After that, I save a copy called Hand_R. Now, since this is still the only copy of the hand in the project, you can preserve the existing Smart Bone Actions by simply renaming them. Rename the bones and Actions to associate them with Hand_R. Flip the layers horizontally. (Sorry, at this point you'll have to experiment...I'm writing this from memory and I'm not sure which items you need to filp. Obviously, the bones and artwork need to be aligned, so I need to either flip the arm or hand bone and the hand artwork group separately, or maybe I can flip just the bones layer in one go? Not sure, but I'll check on that and update this info when I get the chance.

Anyway, now I an import the Hand_L project into the Hand_R project, and not worry about a conflict between the two hand rigs. This is the 'easy' way because if I had simply tried to duplicate the limb and flipped it, I would have had to create new actions for the flipped limb and copied/pasted all the keyframes individually. With this method, I'm mainly just renaming the Actions and bones, which is much easier.

When I'm ready to transfer this setup to another character rig, I can import this file to the character rig and reparent the parts. Alternatively, I can use Copy Layer/Paste Layer to copy the bone group from one file to the other, and then reparent the items. Don't unparent the items...reparent them directly to the corresponding bone in the other character.

This procedure might seem complicated but it's really not that hard when you understand what you're trying to prevent. It's probably easier to demonstrate with an example project, so I'll try to put something together after work tonight.

Yeah, greenlaw, the procedure indeed is seeming complicated to me (mainly that parenting part you explained).
This procedure might seem complicated but it's really not that hard when you understand what you're trying to prevent. It's probably easier to demonstrate with an example project, so I'll try to put something together after work tonight.
Yes please, it would be great if you would give some time of yours from your schedule.
Thanks Greenlaw. :D
User avatar
Greenlaw
Posts: 9576
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Transferring rigs from one file to another

Post by Greenlaw »

Sure. I think this procedure will appear a lot less intimidating when you see it in a video, or at least have a project file to look at. 😺
User avatar
striker2311
Posts: 224
Joined: Wed Aug 26, 2020 3:55 pm

Re: Transferring rigs from one file to another

Post by striker2311 »

Greenlaw wrote: Mon Mar 07, 2022 9:11 pm Sure. I think this procedure will appear a lot less intimidating when you see it in a video, or at least have a project file to look at. 😺
Yeah sure. :)
Please make a video on that.
User avatar
striker2311
Posts: 224
Joined: Wed Aug 26, 2020 3:55 pm

Re: Transferring rigs from one file to another

Post by striker2311 »

Greenlaw wrote: Mon Mar 07, 2022 9:11 pm Sure. I think this procedure will appear a lot less intimidating when you see it in a video, or at least have a project file to look at. 😺
Hii greenlaw
I want remind you about this, i tried using your method but something's wrong , I'm not able to do that. Could you please help me with that.
User avatar
Greenlaw
Posts: 9576
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Transferring rigs from one file to another

Post by Greenlaw »

Oh, at which step are you having trouble?

In any case I suspect broken actions, since that's the most likely thing to go wrong. Pictures or, even better, a project file would help.
User avatar
striker2311
Posts: 224
Joined: Wed Aug 26, 2020 3:55 pm

Re: Transferring rigs from one file to another

Post by striker2311 »

Greenlaw wrote: Fri Mar 11, 2022 5:27 am Oh, at which step are you having trouble?

In any case I suspect broken actions, since that's the most likely thing to go wrong. Pictures or, even better, a project file would help.
Suppose there's one rig i need to import with import option or copy pasting this going to create sub lay within bone layer, but i want this rig to be in same bone rig. I'll send up a file just soon, i mean i went away from my system came to college that's why.
User avatar
Greenlaw
Posts: 9576
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Transferring rigs from one file to another

Post by Greenlaw »

Sorry, it's been awhile since I last had to this and my previous instructions that I wrote from memory had information missing.

The following is what I started writing last weekend, and I included a starter project that you can use to follow along with. Note: Step 29 has a problem. The problem is fixable as explained near the end of this post but I still need to figure out why it's happening. (Edit: I figured it out. See the next post for the explanation.)

So I walked through the entire process and documented the steps to make sure I didn't miss anything important this time. Below are the steps for creating a mirrored duplicate version of an existing arm including a Smart Bone Dial for the hand. These steps can be modified for creating modular limb parts to reuse with other rigs.

The files used in this walkthrough can be downloaded from here: modularDemo.zip

1. Create a body rig with a left arm.

2. Add a Smart Bone Dial (SBD) that closes the left hand.

3. Save the project.

For this example, the project is named body. Here's what the project looks like so far...

Image

Now we'll create a mirror copy of the arm including the SBD. If you'd like to follow along starting with the next step, use the file called Body.moho inside the folder called Practice.

4. Save a copy of the project and name it armL. This will be your backup in case you mess up the next step.

5. Save a copy of the project and name it armR. This is where we will modify the arm and actions.

6. Rename the Hand Close L Smart Bone Action (SBA) to Hand Close R for each layer that has this Action. This Action exists in the following two layers.

- The handL layer, (this Hands Close SBA contains the point animation for the hand artwork.)
- The bonesA layer, (this Hands Close SBA contains the keyframes for the Hand Close SBD itself.)

7. Rename the Hand Close L SBD to Hand Close R. Note: It's critical that you have renamed the associated Smart Bone Actions before you rename this bone.

8.Also rename the following bones named armUpL, armLoL, elbowL, handL to armUpR, armLoR, elbowR, handR

9. Let's check that the Smart Bone Actions still work. Step into an animation frame on the Mainline and try the Hand Close R SBD. If it doesn't work, make sure all the name changes for the bones and actions are correct.

10. Just a couple more renames: Rename the armL group to armR, and rename the handL group to handR.

11. Now let's mirror the arm. Select the armUpL bone and flip it horizontally. Note that the bone will flip in place, not across the body.

12. Select the armL group layer and flip it horizontally. This will flip the artwork across the body because the origin is set in the center.

13. Hold Shift to constrain-drag the armUpR bone into position on the R side of the rig. All the other arm bones will move with it.

14. Rename the bonesA layer to bonesB. This will help us later to distinguish the two layers in the Layers window.

15. Save this project file. The mirrored arm is now ready to import or paste into the original project file.

Image

16. For this example, let's copy and paste the layers (as opposed to importing.) Keep the armR project file open, and open the original body project file.

17. Select the bonesB layer in the armR project file and choose Copy Layer from the Edit menu. Note: Be sure to use Copy Layer, and not Copy.

18. Switch to the body project.

19. Click on the bonesA layer and choose Paste Layer from the Edit menu. (Note: Be sure to use Paste Layer, and not Paste.) The bonesB layer will appear above the bonesA layer.

20. In bonesB, drag select the following bones: armUpR, armLoR, elbowR, handR, Hand Close R and SBD Mover, and then choose Copy. (Note: we're using Copy this time, not Copy Layer.)

21. Hide the bonesB layer by clicking in its Visibilty icon. This will allow us to see bonesA clearly.

22. Select the bonesA layer and Paste. (Do not use Paste Layer.) This pastes the new bones into the original Bones layer.

23. Select the armUpR bone and with the Reparent Bone tool, reparent it to bodyUp bone.

24. This next part is a little tricky; if this is not done correctly, the SBD may break. The SBD Mover bone we just pasted has been automatically renamed SBD Mover 1. Select this bone and move it off of the original SBD Mover bone. The Hand Close SBD will move along with it and reveal the original bones from underneath.

25. Deselect the bones

26. Choose the Reparent Bone tool, Alt-click the Hand Close R bone, and then click the original SBD Mover bone. The Hand Close R SBD is now parented to the original SBD Mover bone.

27. Delete SBD Mover 1. The reason we needed to bring this bone along with the Hand Close R SBD was to preserve the SBD's rotation values. Otherwise, the action would break when we reparented it. Now that we've successfully reparented the SBD, this second mover bone is no longer needed.

28. Almost done! In the bonesB group, select the armR group and drag it into the bonesA group between the Head layer and armsR group.

27. The Actions should have come along with the armR layers and the Hand Close R SBD should recognize it. Go ahead and test the two Hand SBDs. They should each work independently.

If the right hand does not work, don't panic. This means you probably mis-parented the bone and broke the action, and fortunately this is easy to fix. Just select the Hand Close R SBD, open its Hand Close R action, delete the keys and recreate them. To create the first key, step into frame 1 and then click on the middle of Hand Close R bone. This creates a rotation keyframe. R-click on the key and set its Interpolation to Linear. Next move to frame 24 and rotate the bone clockwise until it stops. This creates the second keyframe for the SBD's 'max' value. Switch back to the Mainline and it's all good!

29. Now test the arms. if the right arm is not bound correctly to the right arm bones, they probably hadn't been renamed in step 8. To preserve the binding for the right arm, the right-side bone names need to be different from the existing left-side bones before you copy the bones and artwork to the body project. (Note: Shoot! When I reached this testing point, the binding of the right arm reverted to the original left arm bones but it's not because the bones hadn't been renamed earlier. I still need to figure out why this is happening, and I'll update this section when I do. In the meantime, see the note at the end of this post for info about how to fix this problem.)

30. Now we can select the bonesB group and delete it.

Here's what the project looks like before we deleted the bonesB group. Notice the right arm is now in place in the workspace and in the Layers Windows.

Image

31. Save the project and test it.

Image

Hope this helps.

As mentioned at the top, these steps can be modified for saving body parts as modular files and transferring them to other rigs. The key is to isolate the limb or part in its own project file, and then rename the actions and bones so they don't conflict with the original bones and actions. You also need to preserve the rotation values of the SBDs by keeping the parent bone from the original rig until you're ready to reparent the SBDs.

I should also point out that the ONLY reason you would want to do this is if your part has a very complex set of actions associated with it. For example, in Boss Baby: Back In Business, the hands in some of the characters had controls for every finger and for full rotation of the hand (palm, sides, back, etc.) This was way too much data to recreate from scratch for every new character, so following the above procedure (or something close to it) was a great timesaver on that show.

Otherwise, if you only have a simple action like the single Hand Close SBD in the above example, you may be better off just copying the keyframes to a new action for the flipped limb.

Hmm...I guess this really is kind a complicated and probably not an exercise for beginners. FWIW, it really didn't take me long to do this, but I hope a future version of Moho can streamline this procedure.

Update: Shoot...the steps I described before Step 29 for preserving the binding for the right arm isn't working, and right now I'm too tired to figure out why. Rebinding the limb in this case is easy: the handR group is using Layer Bind to the hand bone, and the armR layer is using Point binding. Still, the binding really should have come over because right arm was working fine with the renamed bones in the previous stage.

I'll update this info when I figure out what went wrong in Step 29. Actually, I'm sure I'll return to this post a lot to improve it. Also, once I clear up this issue, I'll think about recording a video...that might be easier to follow.
Last edited by Greenlaw on Sat Mar 12, 2022 6:21 pm, edited 25 times in total.
User avatar
Greenlaw
Posts: 9576
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Transferring rigs from one file to another

Post by Greenlaw »

Ah! I figured it out! It's because my workflow has changed since the last time I did this. Back then I mainly used Use Selected Bones for Flexi-Bindings to bind limbs and I relied more heavily using SBAs to correct joint deformations. It was some time later that I switched to mainly using the Bind Points Tool for limbs.

I ran a quick test using the Selected Bones For Flex-binding method instead of Bind Points and, sure enough, the binding for the right arm did not break after the transfer.

So this part of the procedure apparently doesn't work with the Bind Points method. In this case, the error was easy to fix but I don't think this should be happening at all. Maybe this is a bug?

It's weird that the point binding switches from the 'R'-named bones to the original 'L'-named after the transfer. Does this mean Bind Points is prioritizing Bone ID over Bone Names? Will have to ask about this.
Last edited by Greenlaw on Sat Mar 12, 2022 1:46 am, edited 1 time in total.
User avatar
synthsin75
Posts: 10051
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Transferring rigs from one file to another

Post by synthsin75 »

Greenlaw wrote: Fri Mar 11, 2022 7:05 pm Does this mean Bind Points is prioritizing Bone ID over Bone Names? Will have to ask about this.
Yes, point binding is solely referenced to bone ID. It doesn't reference bone names at all.

M_Point.fParent - id number of the parent bone this point is bound to. A value of -1 means the point is not bound to any bone. A value of -2 means the point is flexi-bound to all bones in the parent layer. https://mohoscripting.com/classes/M_Point
User avatar
Greenlaw
Posts: 9576
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Transferring rigs from one file to another

Post by Greenlaw »

Shoot...but that's good to know. I'll see if I can figure out a trick to make this work with Point Binding since I've been using that method a lot lately.

Thanks for the info Wes! :D
User avatar
synthsin75
Posts: 10051
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Transferring rigs from one file to another

Post by synthsin75 »

Greenlaw wrote: Sat Mar 12, 2022 1:44 am I'll see if I can figure out a trick to make this work with Point Binding since I've been using that method a lot lately.
There's really no trick...other than scripting. Since the left/right bones don't have the same IDs, you'd always have to redo the point/layer binding.
Post Reply