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.

73 lines
2.7 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Dialog used to edit properties of a particle system definition
  4. //
  5. //===========================================================================//
  6. #include "ParticleSystemPropertiesContainer.h"
  7. #include "petdoc.h"
  8. #include "pettool.h"
  9. #include "datamodel/dmelement.h"
  10. #include "movieobjects/dmeparticlesystemdefinition.h"
  11. #include "dme_controls/dmecontrols_utils.h"
  12. #include "dme_controls/particlesystempanel.h"
  13. // memdbgon must be the last include file in a .cpp file!!!
  14. #include <tier0/memdbgon.h>
  15. using namespace vgui;
  16. //-----------------------------------------------------------------------------
  17. // Constructor
  18. //-----------------------------------------------------------------------------
  19. #pragma warning (disable:4355)
  20. CParticleSystemPropertiesContainer::CParticleSystemPropertiesContainer( CPetDoc *pDoc, vgui::Panel* pParent ) :
  21. BaseClass( this, pParent ), m_pDoc( pDoc )
  22. {
  23. }
  24. #pragma warning (default:4355)
  25. //-----------------------------------------------------------------------------
  26. // Refreshes the list of raw controls
  27. //-----------------------------------------------------------------------------
  28. void CParticleSystemPropertiesContainer::GetKnownParticleDefinitions( CUtlVector< CDmeParticleSystemDefinition* > &definitions )
  29. {
  30. definitions.RemoveAll();
  31. CDmrParticleSystemList particleSystemList = g_pPetTool->GetDocument()->GetParticleSystemDefinitionList();
  32. if ( !particleSystemList.IsValid() )
  33. return;
  34. int nCount = particleSystemList.Count();
  35. definitions.EnsureCapacity( nCount );
  36. for ( int i = 0; i < nCount; ++i )
  37. {
  38. CDmeParticleSystemDefinition *pParticleSystem = particleSystemList[i];
  39. definitions.AddToTail( pParticleSystem );
  40. }
  41. }
  42. //-----------------------------------------------------------------------------
  43. // Called when the base class changes anything at all in the particle system
  44. //-----------------------------------------------------------------------------
  45. void CParticleSystemPropertiesContainer::OnParticleSystemModified()
  46. {
  47. CAppNotifyScopeGuard sg( "CParticleSystemPropertiesContainer::OnParticleSystemModified", NOTIFY_SETDIRTYFLAG );
  48. }
  49. //-----------------------------------------------------------------------------
  50. // Called when the selected particle function changes
  51. //-----------------------------------------------------------------------------
  52. void CParticleSystemPropertiesContainer::OnParticleFunctionSelChanged( KeyValues *pParams )
  53. {
  54. if ( g_pPetTool->GetParticlePreview() )
  55. {
  56. CDmeParticleFunction *pFunction = GetElementKeyValue<CDmeParticleFunction>( pParams, "function" );
  57. g_pPetTool->GetParticlePreview()->SetParticleFunction( pFunction );
  58. }
  59. }