Save and load bone animation to any file!!!
Moderators: Víctor Paredes, Belgarath, slowtiger
That's awesome mate!heyvern wrote:When I was working on a web site or laying out an ad for a client, all I could think about was when I could take a break and use Anime Studio. NOW, I'm working in Anime Studio AS MY JOB!!
How cool is THAT?!?
I hope this won't be the last one.
-vern
I'm in a similar boat, starting a 6 month full time animation position using Anime Studio, in one months time. Having been working in drug and alcohol youth work for many years, doing a little animation freelance on the side, but mostly driving home from work the short way so I could fire up the computer to write and fiddle around with animation.
(HUGE thanks to Chucky, who helped me a lot to get this gig - advice, support, flesh-charring criticism and encouragement, plus a lot of his time and effort. \m/
He comes across as a bit of a banana, but he's OK.

So I can relate to your excitement Vern. We are paid to play!
I hope it goes well for you.
Vern,
As someone who knows nothing about scripting (or relatively nothing) couldn't you check for interpolation by seeing what the values are at the frame next to the key? IOW, if the value is the same as the next key then the key is step -- if not then by the offset you could tell how the key was set.
IOW, I'm assuming there is some consistency to how the values change over time and an examination of these values ought to yield the right key values.
I dunno -- just talking out of the top of my head, but once again if there's any help I can give you let me know (if you want to point me to where in the code I should be looking I can play with it on my own for a while).
As someone who knows nothing about scripting (or relatively nothing) couldn't you check for interpolation by seeing what the values are at the frame next to the key? IOW, if the value is the same as the next key then the key is step -- if not then by the offset you could tell how the key was set.
IOW, I'm assuming there is some consistency to how the values change over time and an examination of these values ought to yield the right key values.
I dunno -- just talking out of the top of my head, but once again if there's any help I can give you let me know (if you want to point me to where in the code I should be looking I can play with it on my own for a while).
Just ignore that madrobot guy Vern,
He's got a screw lose, or two .hehe.
Really, what about importing several different walk cycles to new a character to set up action sets? Easy? Fast? I think Vern has seen the value of this concept.


I wouldn't worry too much about it working on actions, Vern -- as you said, it's easy to just load up the action on the timeline and save it out.
Really, what about importing several different walk cycles to new a character to set up action sets? Easy? Fast? I think Vern has seen the value of this concept.
Why wouldn't it be easy and fast?
I create dozens of actions quite easily by simply starting the action and copying the keys from the mainline and altering them slightly. I know from practice how fast this is.
Since you can erase the animation in the document (and not in the actions) it's simple to load up the actions in a character and save them to files one by one. I'll bet you I could take a character with 20 action walks and save and load them back into a new skeleton's actions in less than five minutes -- why is that such a big deal?
I'm not saying Vern shouldn't do this if he can, but I'd a lot rather he work on things like possibly getting key interpolations than trying to figure out if his script can work on actions.
I create dozens of actions quite easily by simply starting the action and copying the keys from the mainline and altering them slightly. I know from practice how fast this is.
Since you can erase the animation in the document (and not in the actions) it's simple to load up the actions in a character and save them to files one by one. I'll bet you I could take a character with 20 action walks and save and load them back into a new skeleton's actions in less than five minutes -- why is that such a big deal?
I'm not saying Vern shouldn't do this if he can, but I'd a lot rather he work on things like possibly getting key interpolations than trying to figure out if his script can work on actions.
If you have keys in the main time line it is the same as having keys in an action. Activate an action, right click on the MAIN time line and select "Insert copy". You now have a copy of the main time line in the action.chucky wrote:Sorry Mkelly but remind me how I take a walk cycle from the mainline to an action, I can't get this to work. I've heard talk of it but copy and paste - nothing happens. Except the switching frame 0 thing.
20 walk cycles in 5 minutes is legendary, I couldn't do that, not even in my dreams.
I was thrilled when i learned that trick here on the forum a while back.
-vern
I see Vern's got you straightened out (must be on a different timeline -- I'm here in Eastern Standard Time and just got up :>).chucky wrote:Sorry Mkelly but remind me how I take a walk cycle from the mainline to an action, I can't get this to work. I've heard talk of it but copy and paste - nothing happens. Except the switching frame 0 thing.
20 walk cycles in 5 minutes is legendary, I couldn't do that, not even in my dreams.
As for the different walk cycles -- I wasn't saying I could create 20 original walks in five minutes, but that I could take a character that already had the 20 walks (as actions) and copy them into the mainline one by one, save them out, and load them back into another character all in that time. The workflow is copy the action, use Vern's script to save, and clear the animation in the document -- that would take about five seconds per action. Then reverse the process (use Vern's script to load the keys into the mainline, create a new action for the character, and copy the mainline keys) in about another five seconds per. You might be able to do 20 in under a minute if you're really fast, but five minutes will seem like a vacation.
As to creating a lot of original walk cycles, I was thinking about the classic "Animator's Survival" by Williams for this concept -- take that transition step and lower it, or raise it, or have them lean forward or... whatever. You can tweak this and get a very distinctive walk from each one. Coupled with arm motions and it's amazing how much variety there is. I once played around with this in AS and found I could get a quite acceptable walk in as little as six keyframes with the two transition keys being the ones you really need to mod.
Okay...
Can't actually use scripting to save the key frame interpolation... but...
The key frame interpolation is in the file format of course. I know where it is so I could READ the file format itself to find the interpolation used. I normally don't like the idea of reading in a file this way that is already open... but in this case it would certainly give me that last missing piece.
I just don't think these scripts are going to be really effective without key frame interpolation. That is really really important. The hard part will be of course scanning the file to find the darn info needed.
The one thing that could be a problem is if the file isn't saved, the saved animation would be incorrect. It would be reading in the file from the hard drive. So... I could just put in a "save file" command when the save animation is activated.
-vern
Can't actually use scripting to save the key frame interpolation... but...
The key frame interpolation is in the file format of course. I know where it is so I could READ the file format itself to find the interpolation used. I normally don't like the idea of reading in a file this way that is already open... but in this case it would certainly give me that last missing piece.
I just don't think these scripts are going to be really effective without key frame interpolation. That is really really important. The hard part will be of course scanning the file to find the darn info needed.
The one thing that could be a problem is if the file isn't saved, the saved animation would be incorrect. It would be reading in the file from the hard drive. So... I could just put in a "save file" command when the save animation is activated.
-vern
Hi Vern,
I haven't been here in ages but I just wanted to chime in and say thanks so much for this amazing script!
I haven't used AS in a long time but will fire it up now to test it out.
Thanks again for being both an AS genius, and so generous in your willingness to share with the community.
Cheers
I haven't been here in ages but I just wanted to chime in and say thanks so much for this amazing script!
I haven't used AS in a long time but will fire it up now to test it out.
Thanks again for being both an AS genius, and so generous in your willingness to share with the community.
Cheers

Well, I'm back on the job. I am going to work on adding in key interpolation.
-----
On another topic that came up regarding loading directly to actions... for some reason this can't be done. I've changed the code so the saving works from an action, but loading INTO an active action causes AS to switch to the main timeline to insert the keys.
I don't know why it does this and there just doesn't seem a way around it since actions have practically zero script access.
I will keep poking around and see if there is something I can change to make this work. It could be that some of the animation channels being changed are causeing AS to switch out of the Action (actions have a nasty habit of "deactivating").
In the mean time loading into the main time line and then inserting into an action seems to work... although it would be nice to do this directly to an action.
I had all but given up on storing key interpolation and now that seems to be possible so hopefully so will this action thing.
-vern
-----
On another topic that came up regarding loading directly to actions... for some reason this can't be done. I've changed the code so the saving works from an action, but loading INTO an active action causes AS to switch to the main timeline to insert the keys.
I don't know why it does this and there just doesn't seem a way around it since actions have practically zero script access.
I will keep poking around and see if there is something I can change to make this work. It could be that some of the animation channels being changed are causeing AS to switch out of the Action (actions have a nasty habit of "deactivating").
In the mean time loading into the main time line and then inserting into an action seems to work... although it would be nice to do this directly to an action.
I had all but given up on storing key interpolation and now that seems to be possible so hopefully so will this action thing.
-vern
Yeeehaaaa!
Thanks to Synthsin75 for forcing me to overcome my fear of parsing the AS file format I've successfully extracted the key frame interpolation for saving!!!!!!
WooooHoooo!
I've got the code working I just have to incorporate it into the save and load scripts. It works perfectly. Thank goodness for the AS file format. I may have to create some sort of documentation of the file format. It's quite straight forward when you know what all those numbers are.
For instance... in the bones section there was always this line for every bone in the keys section:
That's it, these same three numbers on a line all by itself. Never knew what those numbers are.
They are the 3 values for the dynamic constraint. I haven't used the dynamic constraint very much until recently so in all my documents I never changed those values so they were always the same.
That's the beauty of the format. Everything is there whether it gets used or set or not. It's there. So the default values for the dynamic bone constraint is there even if you never use it. So when I parse the file I know exactly where everything is and it's always in the same spot.
-vern
Thanks to Synthsin75 for forcing me to overcome my fear of parsing the AS file format I've successfully extracted the key frame interpolation for saving!!!!!!
WooooHoooo!
I've got the code working I just have to incorporate it into the save and load scripts. It works perfectly. Thank goodness for the AS file format. I may have to create some sort of documentation of the file format. It's quite straight forward when you know what all those numbers are.
For instance... in the bones section there was always this line for every bone in the keys section:
Code: Select all
221
They are the 3 values for the dynamic constraint. I haven't used the dynamic constraint very much until recently so in all my documents I never changed those values so they were always the same.
That's the beauty of the format. Everything is there whether it gets used or set or not. It's there. So the default values for the dynamic bone constraint is there even if you never use it. So when I parse the file I know exactly where everything is and it's always in the same spot.
-vern
- synthsin75
- Posts: 10276
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact: