Page 2 of 2

Posted: Tue Sep 19, 2006 12:14 am
by KungFooMasta
Thanks for pointing that out, I feel dumb now :shock:

I guess a simple wrapper with a list is the best solution... at least until I can investigate further.


Posted: Thu Nov 16, 2006 1:27 am
by Bren
Did anybody get anywhere with this? I've been thinking about event tagging in animations recently...

Re: Animation frame callbacks

Posted: Tue Jul 14, 2009 6:36 am
by RedEyeCoder
This thread is really old however I am looking at the same problem myself. Is anyone aware if any work ever went into this? I have browsed through the source and searched the forums but there is no evidence that this is yet supported. I tend to still agree with what Sinbad and others said about creating a wrapper object around AnimationState which stores a list of time/events.

Re: Animation frame callbacks

Posted: Wed Jul 15, 2009 6:10 pm
by sinbad
It comes up now and again, almost made it into a GSoC project this year, but really on its own is not big enough. It probably isn't a huge amount of work, it just needs someone with an itch to scratch to put it to bed ;)

Re: Animation frame callbacks

Posted: Wed Dec 16, 2009 7:11 am
by evilshadow
Are there any progressing about this topic yet ? :)

Re: Animation frame callbacks

Posted: Mon Feb 22, 2010 7:24 am
by BTolputt
I get the impression from another thread that the addition is not actually desired in OGRE by the core dev(s). Which conflicts a little with what Sinbad said near the beginning of the thread... but that was some years ago now :P

If a clear set of requirements were written up (i.e. a common base from which we can all work from, not a wish-list from specific projects); I'd be interested in contributing something. As mentioned above, it probably won't make it into OGRE in & of itself; but I need it for my project(s) and so it will be at least up to date on the OGRE wiki if desired.

Re: Animation frame callbacks

Posted: Tue Feb 23, 2010 12:52 pm
by sinbad
No, I can see a use for it certainly. Mostly it's about time & other priorities; as an open source project the things that get done in volunteer time are necessarily the things that developers either need themselves, or are curious about. The easiest way to get a new feature done is to submit a patch, or convince a developer that it's more exciting than the 500 other things they have in their head right now. Or pay them of course ;)

Re: Animation frame callbacks

Posted: Thu Mar 04, 2010 4:47 am
by dark_sylinc
I'm passing by over this forum and couldn't help notice this thread.

Is this that a big deal???
I mean, I've got this problem too, but since animation in Ogre is already handled manually (call animationState->addTimePos( time ) ) I just keep an external counter and handle this myself. I've tackled this in two projects already.

Building a very flexible animation system over OGRE's to handle sound & particle FXs can be very easy.

A basic version of the code looks like this, I just wrote it for the purpose of this forum but you'll get the idea:

Code: Select all

struct AnimationContainer
    float fTime; //Time where this container is triggered
    CallBackClass *callback;

std::vector<AnimationContainer> m_container; //Contains multiple animations & fx
std::vector<AnimationState> animationsToPlay;

//In update...
for( int i=0; i<m_container.size(); i++ )
    if( timePos > m_container[i].fTime )
     if( m_container[i].animationName != "" )
          entity->getAnimationState( m_container[i].animationName )->setEnabled( true );
          animationsToPlay.push_back( entity->getAnimationState( m_container[i].animationName ) );

     if( !m_container[i].callback )
            m_container[i].callback->call( timePos )

for( int i=0; i<animationsToPlay.size(); i++ )
      animationsToPlay[i]->setTimePos( timePos );
When you want one animation and multiple callbacks, just leave blank ("") the text fields for the variables you don't use.
You can extend the idea and use other stuff (i.e. use a common base class with Derived classes to handle animations, pfxs, and sounds separately, without wasting memory space for unused variables in a unified struct like I'm doing)

Bottom line, this is one of the areas where OGRE leaves you complete low level control of what you can do, while yet still being easy to work with (low level usually means messy code, but this time it doesn't). So I don't see the point of implementing animation frame callbacks in a generic way.
Animation is a complex problem which can't be solved generically. I admit though, for the rushed developer a simple system could get the job done, but not for any serious or advanced animation development.

Dark Sylinc

Re: Animation frame callbacks

Posted: Thu Mar 04, 2010 7:26 am
by BTolputt
The (admittedly minor) issue with us all doing it ourselves is that we would all write our own exporters for this information. I know the code is trivial, I've already written something similar, but it would be nice to export this information from the content creation program of our choice (Blender, MAX, Maya, etc) along with the mesh, skeleton, and other animation data.

The reason I can see this being common amongst all applications is that all the sounds, physics, game code etc can easily be retrieved from a basic string associated with a given time offset into the animation. Want to play a sound on the footfall section of the animation, attach a string to time X with data "playSound:footfall.wav". Want the frame where the gun starts to recoil to be when the game fires the bullet, attach a string to time Y with data "game:gunFire". Want to play the gunshot noise at the same time, add in the "playSound" tag after a carriage return.

Sure, the tags will be game specific but we've already established this was going to be the case. However, I am pretty sure that the convenience of having the artists tag frames/times in the content creation would be much more intuitive than having to edit an external text file and/or use a tool solely for this purpose. I'm considering the savings across multiple art pipelines rather than the technical difficulty of each developer writing their own runtime loader/handler for it.

Re: Animation frame callbacks

Posted: Thu Mar 04, 2010 9:55 am
by Klaim
dark_sylinc> You should provide a patch then. As Sinbad said, there are other priorities and providing a patch woudld be helpful.