1) Added support for disabling an animation.

2) Only print warning about empty curves in debug mode.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11101 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2012-04-09 23:16:51 +00:00
parent e3876a58b9
commit f69dbd2447
2 changed files with 9 additions and 3 deletions

View File

@@ -36,14 +36,15 @@ AnimationBase::AnimationBase(const XMLNode &node)
Ipo *ipo = new Ipo(*node.getNode(i), fps);
m_all_ipos.push_back(ipo);
}
m_playing = true;
#ifdef DEBUG
if(m_all_ipos.size()==0)
{
printf("Warning: empty animation curve.\n");
return;
//exit(-1);
m_playing = false;
}
#endif
m_playing = true;
} // AnimationBase
// ----------------------------------------------------------------------------
@@ -88,6 +89,8 @@ void AnimationBase::reset()
*/
void AnimationBase::update(float dt, Vec3 *xyz, Vec3 *hpr, Vec3 *scale)
{
// Don't do anything if the animation is disabled
if(!m_playing) return;
m_current_time += dt;
if ( UserConfigParams::m_graphical_effects )

View File

@@ -75,6 +75,9 @@ public:
void setInitialTransform(const Vec3 &xyz,
const Vec3 &hpr);
void reset();
// ------------------------------------------------------------------------
/** Disables or enables an animation. */
void setPlaying(bool playing) {m_playing = playing; }
}; // AnimationBase