Copy / Paste bones | Update : RC2

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Tha Narie
Posts: 16
Joined: Sat May 13, 2006 2:13 pm
Location: The Netherlands
Contact:

Copy / Paste bones | Update : RC2

Post by Tha Narie »

Hi everyone,

When Nimphaea asked me if I could help her with this problem, trying to understand the Master/Control bone "multibone" layer script heyvern wrote, it seemed like a challenge to me.

I downloaded and installed the Moho Trial (never used it before) and looked for the Moho and Lua reference to check out how it works.

When working with heyverns script, i noticed that it would be handy to copy/paste bones in another layer.
I didn't found a way to do that, and reading heyverns topic made it clear that it wasn't possible:
BA : "would be the ability to somehow copy bones or groups of bones between bone layers..."
heyvern: "Currently there is no "easy" way to copy bones between layers... or even inside layers."


In one day i got the copy/paste bone functionality working, and today I worked on the Options Dialog box, and the feature to copy a child-bone wihtout it's parent (using transform matrices).

But then i discovered a bug in Moho, not able to use advanced properties, because Moho will crash if you delete a bone. It would be a great help if someone could check if this bug also occurs (by uncommenting the lines after the 'crach-comment' that will set the properties that cause Moho to crash).

Enough talking, here are the scripts:
http://www.thanarie.nl/moho/index.html
Image

Feature request (or any other comments) are more than welcome!!
There are some things I have in my mind, that will be included in the next update :)

Enjoy it!
8)
Last edited by Tha Narie on Mon May 15, 2006 8:49 pm, edited 1 time in total.
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

Hi Tha Narie! This looks indeed very interesting, it solves a lot of trouble I think, I'll have to try it right away. I'll get back and confirm.
It's great to have people with programming skills like you, and a lot of others here at the forum around to help and make things easier...for so long: Thanks a lot!!
btw. I'm working on mac with osx 10.4.6 :D
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I think... I think I love you.

... in a purely platonic freindly kind of way of course.

p.s. I have to upload the new improved version of the bone master/control scripts. Much easier to use now.

Copy/paste bones will make this even better for me!

One thing I would use this for is constrained rigs... copying a left arm to a right arm... etc. For a complex character I have to set this up for each side by hand... I never can seem to get it exactly right.

Will this preserve constraints?

-Vern
User avatar
BA
Posts: 196
Joined: Tue Mar 08, 2005 7:28 pm
Location: Griddleville
Contact:

Post by BA »

This is why I love this forum, and Moho.

can't wait to test it out!
Create cartoon characters and comics in minutes: www.bitstrips.com
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

Hi again, the scripts are working just great here on osx 10.4.6 :D thanks again!
Tha Narie
Posts: 16
Joined: Sat May 13, 2006 2:13 pm
Location: The Netherlands
Contact:

Post by Tha Narie »

heyvern wrote:p.s. I have to upload the new improved version of the bone master/control scripts. Much easier to use now.
I'm curious how your version will be, because I improved your version too ;)
Only 1 controll-script needed, no copy>replace anymore, and some loops and stuff removed.
heyvern wrote:One thing I would use this for is constrained rigs... copying a left arm to a right arm... etc. For a complex character I have to set this up for each side by hand... I never can seem to get it exactly right.

Will this preserve constraints?
Yes and No, check this bug report I posted.
fConstraints (+ min and max) are no problem, but the others cause moho to crash. Maybe you can test this on your system, bij uncommenting those properties in the tn_paste_bones.lua file.

I need to make a checkbox with a warning in the dialog, so you can use it if you never are going to delete that bone :P

Another thing is to rename the copied bones if you copy/paste in the same layer (so the names are unique).
And make the 'copy-child-without-parent' recursive, it now works with only 1 'missing' parent.

It's nice to learn some new stuff, especially the matrices. It's not as hard as it looks in the beginning ;)
Now I can finally make a 'real' 3D engine in Flash 8)
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

WoooHoo!

You fixed mine too? Where is it!? Where is it!?

Loops? Loops? hee hee... I can't imagine I had any pointless loops in my code. hee hee. ;)

I am a crappy programmer... absolute crap. My scripts always... work... but they aren't... efficient. Any improvements to what I do is welcomed and encouraged. I stole my code from 7feet anyway.

The only thng I did with mine recently is to remove the need for the different scripts for each controled bone layer. You only need two scripts. One for the master and one for the control bone layer (same as your improvement it sounds like). Fazek helped with that when he pointed out that you can define layer specific variables with the same script for many layers.

However you still needed the two scripts... one for the master and controlled layer.

I use my bone master/control scripts on almost EVERY moho project now. It is indespensable to me... improvements streamlining would be wonderful.

I would also like to be able to master the bone locking properly. I can't get the dang controlled bones to "lock" and behave as locked using my script. If you have any help on that issue I would be very happy.

-Vern
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

fConstraints (+ min and max) are no problem, but the others cause moho to crash. Maybe you can test this on your system, bij uncommenting those properties in the tn_paste_bones.lua file.

I need to make a checkbox with a warning in the dialog, so you can use it if you never are going to delete that bone Razz

Another thing is to rename the copied bones if you copy/paste in the same layer (so the names are unique).
And make the 'copy-child-without-parent' recursive, it now works with only 1 'missing' parent.
These issues are not a problem for me... I am very familiar now with NOT deleting bones as I mentioned in another post. ;)

I always name the bones for the left and right side so renaming is a given when copying in the same layer. The constraints being copied is fine. As far as the dynamics constraints not being copied... not a problem... if I use those it is usually just one bone... or two... never 30. ;) Easy enough to set by hand.

I do use negative numbers on constraints... and I do use parents as targets... I will play with this and see what happens.

Using a bone's parent as a constraint target with a negative value is really cool as heck... is that the issue that causes crashing? Or am I confused?

I use this for shoulders a lot. And also around the hip areas in some cases.

-Vern
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Initial results

Well it works great.

Auto renaming for pasting in the same layer would be great... however...

A workaround is to copy the bones I need to duplicate to a NEW bone layer. Rename them there then copy the bones from that layer to the original layer.

Just thought I would point out this trick until new features get added.

Next I am going to uncomment that code for constraints and see how that works.

-Vern
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Post by rylleman »

Fantastic! It will be a great help in my workflow.
Would it be possible to copy the keframes of the bones as well? (as an additional option). If so there's no end to the fantastacalities.
Thank you.
Tha Narie
Posts: 16
Joined: Sat May 13, 2006 2:13 pm
Location: The Netherlands
Contact:

Post by Tha Narie »

ould it be possible to copy the keframes of the bones as well? (as an additional option). If so there's no end to the fantastacalities.
You mean, copying not only the selected frame, but ALL the frames in de timeline?
I think that will be possible :)
Next I am going to uncomment that code for constraints and see how that works.
And? and? How dit it work :?: :lol:
You fixed mine too? Where is it!? Where is it!?
I will post it this evening when I'm home (8 hours till now ;))
Tha Narie
Posts: 16
Joined: Sat May 13, 2006 2:13 pm
Location: The Netherlands
Contact:

Post by Tha Narie »

UPDATE

As you can see, the screenshot in the first post is updated, because there is a new version avaible:
http://www.thanarie.nl:8080/moho/

Copy from changelog:
15-05-2006
RC2
- added checkboxes in dialog for selecting properties to copy
- added auto-renaming when copying on own layer (so there will be no duplicates)


Maybe I should add 2 textfields for filling in a prefix and postfix text to rename the bones (instead of using an _) ? :D

@heyvern: now it's easier to test the BUG :)

I hope to add the 'copy animation' functionality tomorrow, if Moho is working along ;)
And I will take a look at the bone locking.

Got some nice idea about the Master/Controll Multibone Script when I started scripting this evening:
What about throwing both in one script, and when entering frame 0 for the first time, a dialog is showed to confige the script (master or control) and maybe selecting the 'binding' layer.
Properties can be stored on the layer, and will be used to get the right indexes of the master-array.. bla bla.. technical stuff..
AND because the properties are stored on the layers, i could write a script (called from the menu) that will read that properties from all layers, so you can config ALL the bindings and settings.

It would be nice if I could make it work this way 8) :lol:

Enjoy!
Last edited by Tha Narie on Tue May 16, 2006 1:42 am, edited 1 time in total.
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Tha Narie wrote:...indexes of the master-array.. bla bla.. technical stuff..
This is exactly why I haven't even tried to do that... it is that "bla bla" stuff that I haven't learned yet.

I get very sleepy just thinking about it.

;)

-Vern
Tha Narie
Posts: 16
Joined: Sat May 13, 2006 2:13 pm
Location: The Netherlands
Contact:

Post by Tha Narie »

I get very sleepy just thinking about it.
That's where I get exited! ;)
Because making 20 checkboxes is boring :P
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

Hi again and thank you for the update of the script, it works fine.
It is one thing though, when opening the copy bone script window it will fill my screen and the bottom of the window is not visible, I had to change my screen resolution to find the "OK" button, is it possible to make it smaller so it fits my screen?

all the best / ulrik
Post Reply