Jump to content
  • Advertisement
Sign in to follow this  
Waaayoff

Accessing animations in Blender? (Export Script)

This topic is 2754 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've spent DAYS trying to find out how to export animations from blender.. i read all related modules in the API documentation, googled, asked on BlenderArtists and even looked at 4 different exporters.. I still have NO IDEA how to do it!

First off, i want to ask, how do artists animate their models? I mean i know they use armatures to animate life models, but how do they animate a gun reload for example?

Anyway, i want to export the animation matrices for every bone at the defined keyframes.. How, for the love of god, do i get them?

Share this post


Link to post
Share on other sites
Advertisement

I've spent DAYS trying to find out how to export animations from blender.. i read all related modules in the API documentation, googled, asked on BlenderArtists and even looked at 4 different exporters.. I still have NO IDEA how to do it!

First off, i want to ask, how do artists animate their models? I mean i know they use armatures to animate life models, but how do they animate a gun reload for example?

Anyway, i want to export the animation matrices for every bone at the defined keyframes.. How, for the love of god, do i get them?



To animate a model, you must first rig it. Note that rigging is not the same as simply putting bones into a model. Both animation and rigging are huge topics. O_o

To animate a gun reload, I would think that you just take the gun model and on the reload animation, add a forearm/hand model that's working the gun to reload it. lol

Share this post


Link to post
Share on other sites

[quote name='Waaayoff' timestamp='1299517543' post='4782882']
I've spent DAYS trying to find out how to export animations from blender.. i read all related modules in the API documentation, googled, asked on BlenderArtists and even looked at 4 different exporters.. I still have NO IDEA how to do it!

First off, i want to ask, how do artists animate their models? I mean i know they use armatures to animate life models, but how do they animate a gun reload for example?

Anyway, i want to export the animation matrices for every bone at the defined keyframes.. How, for the love of god, do i get them?



To animate a model, you must first rig it. Note that rigging is not the same as simply putting bones into a model. Both animation and rigging are huge topics. O_o

To animate a gun reload, I would think that you just take the gun model and on the reload animation, add a forearm/hand model that's working the gun to reload it. lol
[/quote]

Yes i realize it's a huge topic, i just wanted to know if the process was usually handled using armatures and vertex weight painting..

And i think you're wrong about the gun.. in most games the user interacts with the gun, opening up a revolver for example, removing the safety, opening up a shotgun barrel.. etc..

Anyway, that's not really the issue here.. i'm more interested in finding out how to get the animation data from blender

Share this post


Link to post
Share on other sites
As far as I know, it's specific to the engine you want to export them to, and each case basically requires its own python script...do you just want the region in a .blend file that pertains to the animation keyframes?

Share this post


Link to post
Share on other sites
I'm writing an exporter to my own format.. I want to export animations but i can't figure out where and how blender stores the animation data..

Share this post


Link to post
Share on other sites
I just took another look at the .x exporter and i think i got it.. It's in the writeAnimation function (and the writeAnimCombineMatrix function).. I never saw this one, i only saw the writeAnimationObj function.

Anyway, the steps are, for every bone:

1) Get the ipo
2) Get the ipo curves
3) Get the bezier points from the curves
4) Read the bez points' x coordinate, which is the keyframe number
5) For every keyframe:
6) Set Blender's Animation Track to keyframe
7) Now you can get the Bone's Pose at said keyframe
8) Get the bone's matrix at the current pose

Now i'm not sure about any of this.. and it's too late to test it, but i will as soon as i can.

I would still appreciate input on the subject though.. I might be wrong..

Share this post


Link to post
Share on other sites
You don't mention what version of Blender you're using. This link was one I finally found with an exporter that (sort of) works. You can look at one of the files and get some ideas.

Share this post


Link to post
Share on other sites

I'm writing an exporter to my own format.. I want to export animations but i can't figure out where and how blender stores the animation data..

This is not the best idea to be honest. Don't write your own exporter for standard features like animation (it is like inventing your own OS for your game) . Use an existing export format (i.e. fbx) and write a converter to transfer this format into your own (binary) format.

Benefits:
1. You can support other modelling tools which supports the intermediate format.
2. You don't need to refactor your converter after a modelling tool upgrade (blender 2.49->2.50 !).
3. You don't have to handle tool internal representation and APIs, instead you got a "human" readable text file.
4. Use your time to write games/engines and don't waste time to write some buggy exporter which will be mostly obsolete with the next major modelling tool upgrade !

In the case of missing features you need to export but which are not supported by the intermediate format, write a small wrapper exporert which exports some additional data.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!