How to load/use .anim file?

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Bren
Goblin
Posts: 215
Joined: Tue Jul 08, 2003 4:41 pm
Location: 0,0,0
Contact:

How to load/use .anim file?

Post by Bren » Fri Jul 20, 2007 2:32 am

Sorry if this has been addressed anywhere, but I couldn't find much searching the forums/wiki.

Has anyone done any work with .anim files as exported by the Maya exporter? How are they loaded and used? Before tackling it myself, I'm hoping to avoid re-inventing someone's wheel.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Fri Jul 20, 2007 2:39 am

You don't. You export animations using the Ogre exporter, to create .skeleton files. Ditto for your geometry (.mesh) and also your materials (.material).
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

User avatar
Bren
Goblin
Posts: 215
Joined: Tue Jul 08, 2003 4:41 pm
Location: 0,0,0
Contact:

Post by Bren » Fri Jul 20, 2007 2:42 am

This is for a camera animation. It's an option in the Ogre Maya exporter, to export animation for curves.
0 x

Geryon
Gnoblar
Posts: 22
Joined: Tue May 02, 2006 8:50 pm

Post by Geryon » Fri Jul 20, 2007 5:05 am

The anim files from Maya are quite simple.. They're something like Object_RotateX and then a list of times and rotations.. So

anim LeftDoor_rotateX
{
//Time / Value
0.0333333 0
1 1.5
}

Would be at 0.033 of a second there's 0 rotation of X, and at 1 second in there's 1.5 radians of X rotation.. It's super simple.

Skeleton animations are much better for most things, but for cameras that might be sufficient.
0 x

User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Post by Red5_StandingBy » Thu Sep 13, 2007 9:34 am

In Maya you may want to "bake" your curve in order to get meaningful values for the animation spline.

First select the curve and select TranslateX, RotateX... etc, from the Channel Box. Go to Edit->Keys->Bake Simulation. After tweaking the bake settings, Ogre Exporter will give you something like:

anim camera7_translateX
{
//Time / Value
0.0416667 124.001
0.458333 132.362
0.875 139.262
1.29167 144.588
....
anim camera7_translateY
{
//Time / Value
0.0416667 153.566
0.458333 160.459
0.875 166.382
1.29167 171.236
...
anim camera7_rotateY
{
//Time / Value
0.0416667 -0.189778
0.458333 -0.176015
0.875 -0.167177
1.29167 -0.152711
...
0 x

skullmunky
Gnoblar
Posts: 20
Joined: Wed Jun 13, 2007 6:09 am

Post by skullmunky » Wed Oct 24, 2007 4:06 am

but ... how do you load them? the vertex or bones animations are great, but there a whole host of situations where i'd like to just animate transforms in maya and use them as paths for scenenodes in ogre. it feels like NodeAnimationTrack or some related class should have a method to load them....?
0 x

User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Post by Red5_StandingBy » Wed Oct 24, 2007 7:23 am

The format is simple, so you can load it with a real short and straightforward text parsing function. What we then do is to create an Ogre::Animation object and fill it with Ogre::TransformKeyFrame keys from the parsed .anim file. You can look at Demo_CameraTrack for sample code if you want to do the same.

In Maya, you can export a vast variety of parameters according to your needs, so a generic loader could be inflexible.
0 x

Post Reply