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 )
break;
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.
Cheers
Dark Sylinc