Save and load bone animation to any file!!!
Moderators: Víctor Paredes, Belgarath, slowtiger
- Víctor Paredes
- Site Admin
- Posts: 5817
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
I tested the button option on the systems/versions I have access to, ASP Windows, ASP Mac, AS Standard PC and it worked.mkelley wrote: The button save did not work for me -- load did. I could run both from the scripts menu though
I think the problem is having both a menu and buttons at the same time? Is that what you have? I did that too and it still worked. I will keep trying.
If you still have problems let me know.
-----------
I just realized I never tested for bones without names! Sugar honey ice tea! I will fix that for the next version. It isn't a deal breaker but it can have odd results. Right now the script assumes all bones are named (because I name all my bones.. all the time... always.

-------------
p.s. Uh... there's a funny strange word saved animation files that I promise to remove in the next version... if you look at the text file the script produces if a bone doesn't have a constrain control parent... it puts in the word... uh... er...
"booger".
You see, I got frustrated trying to get it to work. I am just a big kid at heart... so in anger I used "booger" as in "Boogger Snot Dangit!" for testing purposes.
Obviously it worked... so... I was so happy I forgot to change it to something else... like a number or something logical.
-vern
No, the first time I just dropped the scripts into the tools folder and edited the tool text file. As I said, the button appeared, but just didn't do anything.heyvern wrote:mkelley wrote: I think the problem is having both a menu and buttons at the same time? Is that what you have? I did that too and it still worked. I will keep trying.
If you still have problems let me know.
-vern
Now -- I have my own buttons defined (well, one of them :>) so I'm not sure if that had anything to do with it. And I really don't have the time right now to be a good alpha for you (you aren't in beta yet :>) since I'm so crushed. I'll just report what happens if you're interested and in about 10 days I'll be glad to do in depth testing. (Really -- I'm a good beta. I've been beta on some very significant software projects, most of which I'm still under an NDA for. But you know the software).
When you modified the tool_list.txt file, did you add the button as "button" or as "tool" it makes a difference. Tool doesn't really call the script. It just wait for user interaction. To run a menu script using a button you have to name it as "button" in your tol_list file. I think that's the problem.As I said, the button appeared, but just didn't do anything.
-G
This is all your fault dude! You are totally responsible for this. I never would have jumped on this script if you hadn't pushed me on that character pack idea. You crazy nut!DK wrote:Hey....a guy takes a break from the forum for one day and the world changes overnight!!! Well done Vern...What a great script.

Well... no offense I SWEAR! I'm not impugning your reputation in any way... but this must be user error of some kind. The button works for me. I can't explain it. I will have to wait for more info on this. I can't fix it if I don't know what's broke.mkelley wrote:No, I made it a button. Like I said, it shows up as a button, it just doesn't do anything when I press it (unlike the load script).
But... no time to test. Must continue working (this is my 30 second break :>)

Make sure there is no misspelling in the _text_tool file. Make sure you have bones in the file. Make sure you selected a bone layer. Also there is a bug that the saved animation file is "wonky" if the bones have no names. I'm fixing that right now. If the bones aren't named it will try to "match" that name. If you have an unamed bone in both files it will try to put the animation on it. I am going to change it so it ignores unnamed bones completely.
You say it "doesn't work". Does that mean the pop-up doesn't appear or that the saved file doesn't work? Does the button "icon" highlight when you roll over it? When you get a chance let me know.
Has anyone else used it as a button? I'm anxious to hear a report from someone with AS Standard. Good or bad.
-vern
This is the structure. It is very simple. The "Root" bone is the very tippy top bone. I place it at the hip. This bone moves the whole body. Back1 and Pelvis are children of the root. They are independent of each other. Everything else is pretty straight forward.chucky wrote:I wonder, Vern if you could post a Vern's bone layout guide illustration with your labelling structure, so a standard system could be established?
I know it would be in your anime files, but it would be nice for the folks to see it in case they haven't got to the scripts yet.
Vern ist ZEHR gut, ja?
The shoulders and neck are "first" child bones of the back2 bone. It's hard to see the visual structure.
The only thing that might change depending on the character would be the number of back bones. You may want or need more of those to create smooth bends. Sometimes fan bones can take care of that. I didn't list fan bones because they may change, or people have their own preference for names, hierarchy. Plus they normally don't have keys so saving animation isn't necessary.
In my head this is the perfect character skeleton. If there were a standard skeleton this should be it. It is very basic and simple, nothing original (the same concept is used in Animation Master on a smaller scale), the only thing that makes it works so well compared to other layouts is the independence of the first back1 bone and the pelvis.
Code: Select all
Root
back1
back2
neck
head
shoulder_right
bicep_right
forearm_right
hand_right
shoulder_left
bicep_left
forearm_left
hand_left
pelvis
hip_right
thigh_right
calf_right
foot_right
hip_left
thigh_left
calf_left
foot_left
Still quick postings because I have zero time to spend (but I'm giving you feedback in the hopes that you just *might* be able to track down problems even based on sketchy reports, because this could still be very useful to me right now).
I'm guessing you always build your bones the same way -- I don't (unfortunately) and many of my 3/4 profile characters are flipped either one way or the other. Well, I saved an animation from one facing right and loaded it into one facing left and... guess what? The bone rotations were all reversed.
It was easy to see this -- the guy actually ran sort of backwards. However, I don't know how to quickly fix this (I tried simply reversing the bone layer and reloading but that didn't do the trick). If it becomes a requirement to build them the same direction that's no big deal, but for now it means I have to consider which actions I can load to which characters.
Once again, no time for heavy testing -- I'm back off!!! (halfway through my project, though :>)
I'm guessing you always build your bones the same way -- I don't (unfortunately) and many of my 3/4 profile characters are flipped either one way or the other. Well, I saved an animation from one facing right and loaded it into one facing left and... guess what? The bone rotations were all reversed.
It was easy to see this -- the guy actually ran sort of backwards. However, I don't know how to quickly fix this (I tried simply reversing the bone layer and reloading but that didn't do the trick). If it becomes a requirement to build them the same direction that's no big deal, but for now it means I have to consider which actions I can load to which characters.
Once again, no time for heavy testing -- I'm back off!!! (halfway through my project, though :>)
- synthsin75
- Posts: 10276
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Hey Mike, I found your problem with using the scripts as buttons. I think.
If you didn't put in the '...' after each script name it seems only the first one on the list will work. (It took me forever to figure this out when I started altering my tool list. Appearantly it needs to be explicitly told that there is no shortcut assigned. )
If it looks like this, you shouldn't have any problem. 
Code: Select all
group Other
color 212 238 212 255
button ge_front_3Drig3.2.1 ...
button ge_side_3Drig3.1.1 ...
button hv_load_bone_animation
button hv_save_bone_animation
Code: Select all
group Other
color 212 238 212 255
button ge_front_3Drig3.2.1 ...
button ge_side_3Drig3.1.1 ...
button hv_load_bone_animation ...
button hv_save_bone_animation ...

WoooHoooo! New feature request! 
If the bones are "rotated" differently or opposite, the saved file will read it exactly and put in those exact rotations on the import to file.
I will add this in as an option. Depending on how the file is set up you click a check box to "reverse" the bone rotations and translations. I can't fix right now but that would be a FANTASTIC addition. Allowing for flipping walk cycles of "reversed" characters. Great idea.
(Make sure you don't import frame 0 unless you want to. This could cause havoc on a differently set up version of a character. Importing frame 0 replaces all the attributes you've checked. It could rotate bones on frame 0 messing it up.)
I was also thinking of adding some sort of "scaling" to the import for slightly odd shaped characters. For instance a short fat character could have the rotations scaled up or down. This would be a very simple addition.
Layer flipping will have no effect on the script. It doesn't read layer info only bones. Bones stay the same when the layer is flipped. Very confusing too. Bone positions are "backwards".
--------
As far as setting up the bones the same way... well... I tested on a few different files and it worked fine. I didn't do anything specifically. These were two different characters built at different times independently (meaning I built the skeleton from scratch each time) but I changed the bone names to match each other. One file was older and I didn't have my bone renaming script when I created it. (GOD I love that script).
The animation came in with a few twisted bones that were easy to fix. Took a couple of minutes to tweak a 150 frame animation.
-vern

If the bones are "rotated" differently or opposite, the saved file will read it exactly and put in those exact rotations on the import to file.
I will add this in as an option. Depending on how the file is set up you click a check box to "reverse" the bone rotations and translations. I can't fix right now but that would be a FANTASTIC addition. Allowing for flipping walk cycles of "reversed" characters. Great idea.
(Make sure you don't import frame 0 unless you want to. This could cause havoc on a differently set up version of a character. Importing frame 0 replaces all the attributes you've checked. It could rotate bones on frame 0 messing it up.)
I was also thinking of adding some sort of "scaling" to the import for slightly odd shaped characters. For instance a short fat character could have the rotations scaled up or down. This would be a very simple addition.
Layer flipping will have no effect on the script. It doesn't read layer info only bones. Bones stay the same when the layer is flipped. Very confusing too. Bone positions are "backwards".
--------
As far as setting up the bones the same way... well... I tested on a few different files and it worked fine. I didn't do anything specifically. These were two different characters built at different times independently (meaning I built the skeleton from scratch each time) but I changed the bone names to match each other. One file was older and I didn't have my bone renaming script when I created it. (GOD I love that script).
The animation came in with a few twisted bones that were easy to fix. Took a couple of minutes to tweak a 150 frame animation.
-vern
On the topic of "buttons' not working.
I noticed the same thing... only... not quite.
If the _tool_list.txt file entry for the buttons doesn't have a space and "..." after the name it won't show in the tool palette where you want it. If defaults to the "other" section at the bottom.
I didn't notice this because it's strange... the FIRST button without a space and "..." will show fine. If you have two in a row the second won't but any buttons AFTER will show up fine.
This is odd behavior so just make sure you put space and the dots after the button name like this:
-vern
I noticed the same thing... only... not quite.
If the _tool_list.txt file entry for the buttons doesn't have a space and "..." after the name it won't show in the tool palette where you want it. If defaults to the "other" section at the bottom.
I didn't notice this because it's strange... the FIRST button without a space and "..." will show fine. If you have two in a row the second won't but any buttons AFTER will show up fine.
This is odd behavior so just make sure you put space and the dots after the button name like this:
Code: Select all
button hv_load_bone_animation ...
button hv_save_bone_animation ...
-vern
Well, I'm still getting weird results -- as I said, I suspect you build your characters much more consistently than I do mine. Either that or something is just plain screwy.
I loaded in a character facing the same way and tried the animation and his legs worked fine but his arms were rotated above his head -- but not in a way you could easily undo. So, so far my experience is that simply having the same bone names isn't enough -- you probably need to use the same skeleton (or at least be very very consistent in how you construct yours -- right now I'm guessing you have to construct it in exactly the same order).
I can't post these files, but if you give me an email address I'd be glad to send them to you, Vern, for testing if you'd like.
I loaded in a character facing the same way and tried the animation and his legs worked fine but his arms were rotated above his head -- but not in a way you could easily undo. So, so far my experience is that simply having the same bone names isn't enough -- you probably need to use the same skeleton (or at least be very very consistent in how you construct yours -- right now I'm guessing you have to construct it in exactly the same order).
I can't post these files, but if you give me an email address I'd be glad to send them to you, Vern, for testing if you'd like.
- synthsin75
- Posts: 10276
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Yeah, I'm having the same sort of 'gliches'. Named the bones of one skeleton (minus the ones I didn't plan on loading) and then made a new skeleton with the same names. One of the torso bones ended up rotating 45 degrees a bit into the animation. And a hand bone did a quick 360 like you had mentioned earlier.
Thanks -- I'm glad I'm not the only one.
We used to see this quite a lot in 3D work -- the bone rotations there were brutal (they used quad rotations to express the position of the bone in 3D space. I hated doing the quad math. Shudder). When I was doing a lot of scripting I never could get it right in terms of copying the structure from one rig to another (Yep, I was facing the identical problem Vern is wrestling with now, only in 3D space. I got about part of the way there and despite the best help from some of the best 3D programmers around we couldn't lick the difficulties).
I'm hoping that isn't the case here -- this would be a whole lot less useful if you had to use some kind of standard skeleton. Unless there was an easy way to construct that -- I'm thinking that if nothing more Vern could dupe bones to match the ones he's saving the keys for and save *those* keys and then his script could do the same in reverse, creating new bones to match the incoming structure and loading the data onto them (and then, of course, deleting the existing bones). That might be the only way around this issue.
I've kind of given up testing further because of my deadline -- I don't think this is going to be in any kind of shape for me to use in the next week. But that shouldn't be discouraging, as it's *very* early days in his development.
We used to see this quite a lot in 3D work -- the bone rotations there were brutal (they used quad rotations to express the position of the bone in 3D space. I hated doing the quad math. Shudder). When I was doing a lot of scripting I never could get it right in terms of copying the structure from one rig to another (Yep, I was facing the identical problem Vern is wrestling with now, only in 3D space. I got about part of the way there and despite the best help from some of the best 3D programmers around we couldn't lick the difficulties).
I'm hoping that isn't the case here -- this would be a whole lot less useful if you had to use some kind of standard skeleton. Unless there was an easy way to construct that -- I'm thinking that if nothing more Vern could dupe bones to match the ones he's saving the keys for and save *those* keys and then his script could do the same in reverse, creating new bones to match the incoming structure and loading the data onto them (and then, of course, deleting the existing bones). That might be the only way around this issue.
I've kind of given up testing further because of my deadline -- I don't think this is going to be in any kind of shape for me to use in the next week. But that shouldn't be discouraging, as it's *very* early days in his development.