2009-01-14 04:37:51 -08:00
|
|
|
// Copyright (C) 2002-2009 Nikolaus Gebhardt
|
2007-05-20 11:03:49 -07:00
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
|
|
|
#include "CSceneNodeAnimatorDelete.h"
|
|
|
|
#include "ISceneManager.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace scene
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
CSceneNodeAnimatorDelete::CSceneNodeAnimatorDelete(ISceneManager* manager, u32 time)
|
2008-12-19 15:21:26 -08:00
|
|
|
: ISceneNodeAnimatorFinishing(time), SceneManager(manager)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
|
|
setDebugName("CSceneNodeAnimatorDelete");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! animates a scene node
|
|
|
|
void CSceneNodeAnimatorDelete::animateNode(ISceneNode* node, u32 timeMs)
|
|
|
|
{
|
2008-12-19 15:21:26 -08:00
|
|
|
if (timeMs > FinishTime)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2008-12-19 15:21:26 -08:00
|
|
|
HasFinished = true;
|
|
|
|
if(node && SceneManager)
|
|
|
|
{
|
|
|
|
// don't delete if scene manager is attached to an editor
|
|
|
|
if (!SceneManager->getParameters()->getAttributeAsBool(IRR_SCENE_MANAGER_IS_EDITOR))
|
|
|
|
SceneManager->addToDeletionQueue(node);
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-30 02:18:36 -07:00
|
|
|
|
2008-10-12 19:55:54 -07:00
|
|
|
ISceneNodeAnimator* CSceneNodeAnimatorDelete::createClone(ISceneNode* node, ISceneManager* newManager)
|
|
|
|
{
|
|
|
|
CSceneNodeAnimatorDelete * newAnimator =
|
2008-12-19 15:21:26 -08:00
|
|
|
new CSceneNodeAnimatorDelete(SceneManager, FinishTime);
|
2008-10-12 19:55:54 -07:00
|
|
|
|
|
|
|
return newAnimator;
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-03-30 02:18:36 -07:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
} // end namespace scene
|
|
|
|
} // end namespace irr
|
|
|
|
|