Page 1 of 2

Man, I love me some lua scripting

Posted: Sat Feb 14, 2009 4:10 am
by synthsin75
Just needed to make all of my bone names unique so I could manage them easier (had a bunch of duplicate names). Took like four minutes to write a script to do this. It's just amazing to be able to do that.

I don't think I'd ever be able to exhaust the possibilities of AS or lua scripting. Granted there are things scripting can't do, but man, all the things it can do is awesome.

:D

Posted: Sat Feb 14, 2009 6:23 am
by DK
How hard would that be to buttonize or checkbox for AS users in general?

Cheers
D.K

Posted: Sat Feb 14, 2009 6:37 am
by synthsin75
Uh, well it's a menu script, so it could also be used as a button. I didn't post it because I didn't think anyone else would find it useful. It only renames the selected bones by numbering them, nothing fancy.

If you're interested, I can always post it.

Posted: Sat Feb 14, 2009 7:11 am
by DK
I'm ok for naming bones with the small amount i use so it's no problem to rename them by hand but your post started me wondering....is it hard to create a script that will create an instant rig with bone names? Just curious.

D.K

Posted: Sat Feb 14, 2009 7:21 am
by DK
Even better would be a scrpt that will instantly name the bones in any rig you have created in AS say the root bone, left1, left2, left3, right1, right2, right3 etc ...maybe this script could allow you type in your preferences for bone names too?
Just a seed for an idea that would be very time saving.


D.K

Posted: Sat Feb 14, 2009 5:55 pm
by synthsin75
That's all beyond my scripting ability right now. I know Genete has a script or two that generates bones, but I have no idea how to do that yet.

It might be possible to modify the add bone tool so that you have some control over the automatic naming. Like checking a left or right checkbox to add 'left' or 'right' to the end of each bone's name as they are created.

That might help with Vern's flip bones script, but it's very low on my priorities.

Posted: Sun Feb 15, 2009 12:58 am
by DK
Hi sythnsin75.....Sorry, please bear with me i'm just trying to understand a bit about Lua scripting....

You say your script can rename bones and it was easy to write?
Can the script name bones that have no names as in a freshly created bone rig?

If not....is it easy to adjust the script to do this or is this a harder task than I am assuming?

Cheers
D.K

Posted: Sun Feb 15, 2009 1:36 am
by synthsin75
This script renames bones (with or without originally having names). But it doesn't do this in any specified order. It just cycles through them and names them 1, 2, 3, ...etc. Very simple.

Yes, this could name (by numbering) bones in a newly created rig. Right now it is only a menu script so it has to be run after all the bones are created, although it can be rerun after any additions.

The hard part would be to try to specify what bones get what names (like left and right). It is beyond my scripting ability to tell whether a bone is a left arm or right foot. If I had to guess, I'd say this is probably hard even for the scripting gurus.

Like I said, I only needed this to make all of the names unique after doing a lot of copy/paste bones.

If it were made into a tool then you could have a checkbox for adding a left or right extension to the numbering (like "3 left"). Then since I did this to work on only selected bones you could select all of the bone for one side, rename, and then do the same for the other side.

I guess I could add a dialog to choose the extension though. That wouldn't be too hard.

Posted: Sun Feb 15, 2009 1:53 am
by DK
I would be really interested in using your script just to name bones synthsin75.

Is it hard get the script to identify the root bone?
Maybe the script names the bones in the same way each time staring with the root bone? Assuming it does, you could probably have it create the first bone name as root?

Cheers
D.K

Posted: Sun Feb 15, 2009 2:05 am
by synthsin75
It always names the bones in the order of creation, it seems. So yeah, it'd be pretty easy to tell it to name the first bone that was created on the layer 'root'. Let me see if I can get that done, and I'll post it for you. :wink:

Posted: Sun Feb 15, 2009 2:16 am
by DK
Fantastic! Thanks synthsin75 ;) I will use it ALL the time. I do a lot of work with bone contraints and scaling with master and slave bones and it's a bit of a slowdown to have to stop and give the bones identifier names. This will be so cool!!!! :)

Cheers
D.K

Posted: Sun Feb 15, 2009 2:35 am
by synthsin75
http://www.mediafire.com/?munlcxeytzd

Here it is, but I'm not real sure how much better this is than enabling 'auto-name bones and shapes' in the preferences. Like I said, I only needed this because I had too many bones with duplicate names.

:wink:

Posted: Sun Feb 15, 2009 2:43 am
by DK
Thanks synthsin75....oops...you know, after all these years of using AS I did'nt know about auto naming bones and shapes :oops:
No matter....it still would be an improvement to have the first bone named as "root" . I'll give it a shot and let you know.

Thanks
D.K

Posted: Sun Feb 15, 2009 2:52 am
by DK
Wow!...works Great! I know it's only a small improvement but personally I prefer the root bone name as root rather than 1

Thanks for this synthsin75.

Cheers
D.K

Posted: Sun Feb 15, 2009 3:48 am
by synthsin75
Glad you like it. That little mod didn't even take a minute.