Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.1 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // An element that contains a list of animations
  4. //
  5. //=============================================================================
  6. #include "movieobjects/dmeanimationlist.h"
  7. #include "datamodel/dmelementfactoryhelper.h"
  8. #include "movieobjects/dmeclip.h"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. //-----------------------------------------------------------------------------
  12. // Expose this class to the scene database
  13. //-----------------------------------------------------------------------------
  14. IMPLEMENT_ELEMENT_FACTORY( DmeAnimationList, CDmeAnimationList );
  15. //-----------------------------------------------------------------------------
  16. // Purpose:
  17. //-----------------------------------------------------------------------------
  18. void CDmeAnimationList::OnConstruction()
  19. {
  20. m_Animations.Init( this, "animations" );
  21. }
  22. void CDmeAnimationList::OnDestruction()
  23. {
  24. }
  25. //-----------------------------------------------------------------------------
  26. // Adds, removes animations
  27. //-----------------------------------------------------------------------------
  28. int CDmeAnimationList::AddAnimation( CDmeChannelsClip *pAnimation )
  29. {
  30. return m_Animations.AddToTail( pAnimation );
  31. }
  32. void CDmeAnimationList::RemoveAnimation( int nIndex )
  33. {
  34. m_Animations.Remove( nIndex );
  35. }
  36. //-----------------------------------------------------------------------------
  37. // Sets the transform
  38. //-----------------------------------------------------------------------------
  39. void CDmeAnimationList::SetAnimation( int nIndex, CDmeChannelsClip *pAnimation )
  40. {
  41. m_Animations.Set( nIndex, pAnimation );
  42. }
  43. //-----------------------------------------------------------------------------
  44. // Finds an animation by name
  45. //-----------------------------------------------------------------------------
  46. int CDmeAnimationList::FindAnimation( const char *pAnimName )
  47. {
  48. int nCount = m_Animations.Count();
  49. for ( int i = 0; i < nCount; ++i )
  50. {
  51. if ( !Q_stricmp( m_Animations[i]->GetName(), pAnimName ) )
  52. return i;
  53. }
  54. return -1;
  55. }