Instant limb *Major update, now a tool*
Moderators: Víctor Paredes, Belgarath, slowtiger
-
- Posts: 370
- Joined: Thu Aug 05, 2004 2:23 am
- Location: Los Angeles
- Contact:
Instant limb *Major update, now a tool*
************************************************************
Update september 2010
It was really hard to have to set the settings in the small preview window so the script is now a tool that updates directly in the workspace.
Here's a video: http://www.youtube.com/watch?v=vtJHgcmoC8s
And here's the script: http://dauid.com/tools/scripts/ds_instant_limb_tool.zip
************************************************************
My most advanced script yet: http://dauid.com/tools/scripts/ds_instant_limb.zip
Video: http://www.youtube.com/watch?v=f_9UoP93k-Q
EDIT: Ignore the first limitation that I mention.
Preemptive answers to questions:
-But ponysmasher, I don't rig my limbs like this script does, what about me?
Sorry but I write scripts for me first and foremost and this is how I prefer to rig them.
-But ponysmasher, couldn't you just as well create one limb and then import that in other projects? Why write a script?
Shut up, that's why...
No, but this is faster, more flexible and a lot cooler.
-But ponysmasher, will you never rig a limb manually again?
Sure I will. Sometimes you want more detailed limbs or limbs in another style or whatever, but in a lot of situations this will do.
I'll probably use it for legs the most.
-But ponysmasher, what about the two limitations that you mention in the video?
EDIT:Thanks to HeyVern the first limitation is gone.
Update september 2010
It was really hard to have to set the settings in the small preview window so the script is now a tool that updates directly in the workspace.
Here's a video: http://www.youtube.com/watch?v=vtJHgcmoC8s
And here's the script: http://dauid.com/tools/scripts/ds_instant_limb_tool.zip
************************************************************
My most advanced script yet: http://dauid.com/tools/scripts/ds_instant_limb.zip
Video: http://www.youtube.com/watch?v=f_9UoP93k-Q
EDIT: Ignore the first limitation that I mention.
Preemptive answers to questions:
-But ponysmasher, I don't rig my limbs like this script does, what about me?
Sorry but I write scripts for me first and foremost and this is how I prefer to rig them.
-But ponysmasher, couldn't you just as well create one limb and then import that in other projects? Why write a script?
Shut up, that's why...
No, but this is faster, more flexible and a lot cooler.
-But ponysmasher, will you never rig a limb manually again?
Sure I will. Sometimes you want more detailed limbs or limbs in another style or whatever, but in a lot of situations this will do.
I'll probably use it for legs the most.
-But ponysmasher, what about the two limitations that you mention in the video?
EDIT:Thanks to HeyVern the first limitation is gone.
Last edited by ponysmasher on Mon Sep 20, 2010 9:12 pm, edited 2 times in total.
- Víctor Paredes
- Site Admin
- Posts: 5665
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
Wow!
But Ponysmasher... I actually haven't a but. It is awesome!
thank you very much!
It's great, really great and smart. Love it, just love it.
Thank you so much, I'm a fan.
Note: I think that people using Debut (which haven't menu scripts) can add this script as button on tool palette. That should work.
But Ponysmasher... I actually haven't a but. It is awesome!
thank you very much!
It's great, really great and smart. Love it, just love it.
Thank you so much, I'm a fan.
Note: I think that people using Debut (which haven't menu scripts) can add this script as button on tool palette. That should work.
Moho Product Manager
www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
- neeters_guy
- Posts: 1619
- Joined: Mon Sep 14, 2009 7:33 pm
- Contact:
As a scripter I say this is WICKED FREAKING COOL! Wow! I hope the new influx of scripting talent will help push SM to put more script features in AS for the future.
I will check out the "parent bone" code you commented out. Maybe I can help out with that. You should check out my "copy flip bones" script. I had to deal with the parenting of bones and calculating positions etc. It might help out. It was a PAIN to figure it all out but the end result is actually fairly simple.
-vern
I will check out the "parent bone" code you commented out. Maybe I can help out with that. You should check out my "copy flip bones" script. I had to deal with the parenting of bones and calculating positions etc. It might help out. It was a PAIN to figure it all out but the end result is actually fairly simple.
-vern
What versions of Moho/AS does this script work with?
Last edited by F.M. on Mon Jul 19, 2010 4:13 pm, edited 1 time in total.
"and then Man created god!"
Dude!
here's the code to fix the parent bone stuff. Turned out to be simpler than I hoped! Only 6 lines of code! Woohoo!
This code replaces the stuff you commented out. It starts around line 295. Basically it just follows up the bone chain adding the rotations. At the end after the loop it uses the "fRestMatrix" of the bone and transforms the final position for the vectors layer points. The fRestMatrix of a bone is the "absolute" position that includes all of the parent bones.
I tried to use the matrix to get the rotation in one step but it doesn't appear to be possible. This works great though.
here's the code to fix the parent bone stuff. Turned out to be simpler than I hoped! Only 6 lines of code! Woohoo!
This code replaces the stuff you commented out. It starts around line 295. Basically it just follows up the bone chain adding the rotations. At the end after the loop it uses the "fRestMatrix" of the bone and transforms the final position for the vectors layer points. The fRestMatrix of a bone is the "absolute" position that includes all of the parent bones.
I tried to use the matrix to get the rotation in one step but it doesn't appear to be possible. This works great though.
Code: Select all
self.parentbone=skel:Bone(self.lowerbone.fParent) --Get parent bone of selected bone
if (self.parentbone.fParent>-1) then
local bParent = self.lowerbone.fParent
while bParent >-1 do
local bone = skel:Bone(bParent)
self.upperAngle = self.upperAngle + bone.fAngle
bParent = bone.fParent
end
self.parentbone.fRestMatrix:Transform(self.upperPos)
else
self.upperPos=self.parentbone.fPos
self.upperAngle=self.parentbone.fAngle
end
---------------------------------------------------------------------------------------------------------------------------------
-
- Posts: 370
- Joined: Thu Aug 05, 2004 2:23 am
- Location: Los Angeles
- Contact:
Ooooh, thank you Vern!!!
I have to try it out when I get home.
I wrote the script during last weeks vacation and only had sporadic internet access so most of the time I had to make do with the scripting documentation and the scripts I had on my laptop.
Whenever my girlfriend relaxed with some solitaire, I relaxed with some Lua scripting
I was actually thinking about the whole matrix thing and if I could use it but suddenly the vacation was over.
I have to try it out when I get home.
I wrote the script during last weeks vacation and only had sporadic internet access so most of the time I had to make do with the scripting documentation and the scripts I had on my laptop.
Whenever my girlfriend relaxed with some solitaire, I relaxed with some Lua scripting
I was actually thinking about the whole matrix thing and if I could use it but suddenly the vacation was over.
Ponysmasher,
Gllad to help out. Fantastic script. I was looking at your code for the vector drawing stuff... all that... math... my head starts to spin... I actually got a bit woozy and nauseous. I get so lost trying to figure that stuff out. What kind of "coding" background do you have?
I wish I wish so much I had paid attention in math class when I was younger. They always say that you will need that knowledge later in life but you don't realize it's true until it's too late. I spent years and years as an artist never needing algebra... sheesh... NOW I need it.
-vern
Gllad to help out. Fantastic script. I was looking at your code for the vector drawing stuff... all that... math... my head starts to spin... I actually got a bit woozy and nauseous. I get so lost trying to figure that stuff out. What kind of "coding" background do you have?
I wish I wish so much I had paid attention in math class when I was younger. They always say that you will need that knowledge later in life but you don't realize it's true until it's too late. I spent years and years as an artist never needing algebra... sheesh... NOW I need it.
-vern
Wow!!!! Thanks ponysmasher.....this script is simply stunning. It also works on AS5.6...even better
Cheers
D.K
Cheers
D.K
http://www.creativetvandmedia.com
My store on Renderosity:
https://www.renderosity.com/mod/bcs/?uid=921315
My store on Renderosity:
https://www.renderosity.com/mod/bcs/?uid=921315
-
- Posts: 370
- Joined: Thu Aug 05, 2004 2:23 am
- Location: Los Angeles
- Contact:
The link in the first post has been updated with Vern's fix. It works great! You're the bonemaster, Vern
I also changed it so that all the settings are remembered until you either restart AS or click "reset settings".
I don't have any real coding background but my brother (who makes games) has talked about using sinus and cosinus to rotate things around other things so I was familiar with that whole thing.
I've also learned that you can find out an angle between two point by using the formula:
Now I just have to find a use for that as well...
I also changed it so that all the settings are remembered until you either restart AS or click "reset settings".
It looks worse than it is really. It's just sinus and cosinus over and over again to find points on a circle.heyvern wrote:Ponysmasher,
I was looking at your code for the vector drawing stuff... all that... math... my head starts to spin... I actually got a bit woozy and nauseous. I get so lost trying to figure that stuff out. What kind of "coding" background do you have?
I don't have any real coding background but my brother (who makes games) has talked about using sinus and cosinus to rotate things around other things so I was familiar with that whole thing.
I've also learned that you can find out an angle between two point by using the formula:
Code: Select all
angle=math.atan2(y2-y1, x2-x1)
Because of my evil socialist tendency to share? But yes, jag är svensk alright.ulrik wrote:Fantastic script, and you share it with us as well, thanks! (you must be from sweden, right? )
-
- Posts: 370
- Joined: Thu Aug 05, 2004 2:23 am
- Location: Los Angeles
- Contact: