CSceneNodeAnimatorDelete.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #include "CSceneNodeAnimatorDelete.h"
  5. #include "ISceneManager.h"
  6. namespace irr
  7. {
  8. namespace scene
  9. {
  10. //! constructor
  11. CSceneNodeAnimatorDelete::CSceneNodeAnimatorDelete(ISceneManager* manager, u32 time)
  12. : ISceneNodeAnimatorFinishing(time), SceneManager(manager)
  13. {
  14. #ifdef _DEBUG
  15. setDebugName("CSceneNodeAnimatorDelete");
  16. #endif
  17. }
  18. //! animates a scene node
  19. void CSceneNodeAnimatorDelete::animateNode(ISceneNode* node, u32 timeMs)
  20. {
  21. if (timeMs > FinishTime)
  22. {
  23. HasFinished = true;
  24. if(node && SceneManager)
  25. {
  26. // don't delete if scene manager is attached to an editor
  27. if (!SceneManager->getParameters()->getAttributeAsBool(IRR_SCENE_MANAGER_IS_EDITOR))
  28. SceneManager->addToDeletionQueue(node);
  29. }
  30. }
  31. }
  32. ISceneNodeAnimator* CSceneNodeAnimatorDelete::createClone(ISceneNode* node, ISceneManager* newManager)
  33. {
  34. CSceneNodeAnimatorDelete * newAnimator =
  35. new CSceneNodeAnimatorDelete(SceneManager, FinishTime);
  36. return newAnimator;
  37. }
  38. } // end namespace scene
  39. } // end namespace irr