Copy Paste Bones!!!!!

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Copy Paste Bones!!!!!

Post by heyvern »

I did it. Works pretty well. I haven't found any bugs but I need people to push it through its paces.

viewtopic.php?t=7842

You can copy bones from one layer to another by dragging the bone layer you want to copy bones from INSIDE the bone layer you want to copy to.

Otherwise you can just copy bones within the same layer.

It also has SCALING of the copied bones. For example you can copy a joint rig for a leg, scale it slightly and use it for an arm on the same layer.

I did this because I have to set up a bunch of characters and this will make it a piece of cake to copy the joint rigs without dragging in the whole skeleton.

Basically this is COOL AS HECK. I love it.

I will plan to add more features (like adding optional extensions to copied bones).

-vern
User avatar
synthsin75
Posts: 10276
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

Awesome script Vern!!

Just tested it, and it works pretty good. It does have some problems, but even with those it'll save a lot of work.

I used it to copy a complete skeleton with constraints and dynamics. It didn't quite get all of the selected bones copied into the parent layer.

You mentioned that dynamics are not copied, and it appears that any bones constrained to a dynamic bone is also not copied.

In addition, it appears that there is a parenting chain length limit. I noticed that many of the bone at the extremities weren't copied. (Like fingers and toes) So I tested this with a new file. Put a long chain of bones in a bone layer (like eight or so) and try to copy them to a parent bone layer. It consistently crashes ASP.

I've been using it as a menu script if it makes any difference.


Otherwise, it's a great script! With your load/save bone script, we can pretty easily duplicate rigs and animation. Hell, if you can get those last few bones to copy out to the parent layer, I think your load/save script will take care of the bone dynamics. So it'd be a complete solution for reusing my own animated rigs.

This is definitely the icing on the load/save script. Great work!! :wink:
Last edited by synthsin75 on Sun Jul 13, 2008 4:25 am, edited 1 time in total.
User avatar
madrobot
Posts: 670
Joined: Mon Apr 07, 2008 3:07 pm

Post by madrobot »

Awesome
With a script like this, I might be able to use some of your joint rigs Vern, without actually understanding how they work :oops:
User avatar
synthsin75
Posts: 10276
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

Oh that reminds me, madrobot. Now I need to go download Vern's joint rig! Now that's the kind of sharing that will be really useful!

Once again, thanks Vern!
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 11:31 am
Location: New Zealand

Post by funksmaname »

what will you think of next Vern? can't wait! :P
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I posted a new version that fixes the "crashing". Just redownload it from the same link.

Stupid mistake. It was working fine. Just before I uploaded I moved a few lines of code down a few lines which caused the crash (it was calling a variable that didn't exist yet). Amazing what the tiniest little change can do.

This should fix the chain length problem and the crashing.

I'll try to work on dynamics next when I get a chance. Have to add that to the save bone script too.

-vern
User avatar
synthsin75
Posts: 10276
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

You might want to make sure you have the new version up. It's still behaving the same per chain length and crashing. Did you test this on Windows?
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Yes, tested on windows. It's working here. I checked the file online it seemed to be the right one according to the date.

I uploaded it again just in case.

I think bones need names. I was almost sure that wasn't the case. I did some earlier tests with unnamed bones and it was working. I must have broke something along the way.

The trouble is I name ALL the bones all the time. It's set in my prefs. I have to specifically delete names of bones which for me is like driving the wrong way on a one way street. ;)

If you name all the bones before copying it will work. In the meantime I will work on a fix.

-vern
User avatar
synthsin75
Posts: 10276
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

Oh, I see. Yeah that was probably the problem, not the constrained to dynamic bones. I missed that because it did copy one unnamed bone.

I can always set my pref to help, but old skeletons need manual naming. Some with a lot of dynamic bones. Not a big deal, but I could see that giving people trouble.

Still, great script.
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I fixed the "no name" issue. You can download it again.

But the copied bones will have a name after pasting. Copied bones will get renamed with "Bone_" + id. The id number that is the order of creation in AS.

I will see if I can avoid putting in a name but it makes tracking the bone so much easier. I am using names a lot of times rather than ID's because of pasting to another layer that already has bones.

I may be able to get around this.

p.s. I still think bones should have names. ;) It causes no end of trouble writing scripts when I have to account for an unnamed bone. Bone IDs can change when bones are deleted. No way to track that.

-vern
User avatar
synthsin75
Posts: 10276
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

WooHoo! You're great Vern! I can't believe how fast you can come up with these. Naming the pasted bones is fine by me. It doesn't require anyone to change their prefs, but still gets the job done.

Just tried the flip option. How does it decide which axis to flip around? Is it the topmost root bone's long axis?
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

The flip is based on the orientation of the last bone in the whole chain of bones. If the last bone is pointing straight up any bones on either side would flip left or right. If the last bone is pointing to the left or right, the flip is "up and down".

So yes, the flip is based on the "length" of the bone being the axis. It will flip 90 degrees to that bone axis at whatever angle it is at.

It is a bit buggy on the "flip" part. My "copyflipbones" script does this better until I work out how to do it properly with this one. It's going to need a few more check boxes or input boxes.

For instance I have the pasted "offset" hard coded into the script. This should be a value the user can put in. Plus if flipping it still offsets the pasted bones and doesn't use the last bone in the chain to make the flip. If you don't copy the parent of the last arm bone (the back bone) when flipping the arms they flip based on the bicep which is... well just wrong.

I have to fix those things. But for now I use my other script for that.

-vern
Springymajig
Posts: 61
Joined: Sat Feb 03, 2007 12:30 am

Post by Springymajig »

This is awesome! Thanks so much!


I think it crashes or at least gives error messages sometimes, when there is a bone constrained to it's parent, with a negative number... and then you copy those bones using the scaling feature.

But for the most part it works really well!
Post Reply