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.

88 lines
2.8 KiB

  1. //======= Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ======
  2. //
  3. // CSheetEditorPanel - Tool panel for editing sprite sheet information
  4. //
  5. //===============================================================================
  6. #include "dme_controls/sheeteditorpanel.h"
  7. #include "dme_controls/dmepanel.h"
  8. #include "movieobjects/dmeparticlesystemdefinition.h"
  9. #include "materialsystem/imesh.h"
  10. #include "materialsystem/imaterial.h"
  11. #include "materialsystem/imaterialvar.h"
  12. #include "vguimatsurface/imatsystemsurface.h"
  13. #include "matsys_controls/matsyscontrols.h"
  14. #include "vgui/ivgui.h"
  15. #include "vgui_controls/propertypage.h"
  16. #include "vgui_controls/propertysheet.h"
  17. #include "vgui_controls/textentry.h"
  18. #include "vgui_controls/splitter.h"
  19. #include "vgui_controls/checkbutton.h"
  20. #include "matsys_controls/colorpickerpanel.h"
  21. #include "particles/particles.h"
  22. #include "tier1/keyvalues.h"
  23. #include "tier1/utlbuffer.h"
  24. #include "tier2/renderutils.h"
  25. #include "bitmap/psheet.h"
  26. #include "matsys_controls/vmtpicker.h"
  27. // NOTE: This has to be the last file included!
  28. #include "tier0/memdbgon.h"
  29. using namespace vgui;
  30. //-----------------------------------------------------------------------------
  31. //
  32. // CSheetEditorPanel
  33. //
  34. //-----------------------------------------------------------------------------
  35. //IMPLEMENT_DMEPANEL_FACTORY( CParticleSystemDmePanel, DmeParticleSystemDefinition, "DmeParticleSystemDefinitionEditor", "Particle System Editor", true );
  36. CSheetEditorPanel::CSheetEditorPanel( vgui::Panel *pParent, const char *pName ) :
  37. BaseClass( pParent, pName ),
  38. m_pSheetInfo(NULL)
  39. {
  40. m_pTitleLabel = new vgui::Label( this, "TestLabel", "<Title>" );
  41. m_pTitleLabel->SetPinCorner( Panel::PIN_TOPLEFT, 12, 12 );
  42. m_pTitleLabel->SetWide( 400 );
  43. m_pVMTPicker = new CVMTPicker( this, "SheetPreview" );
  44. m_pVMTPicker->SetAutoResize( Panel::PIN_TOPLEFT, Panel::AUTORESIZE_DOWNANDRIGHT, 200, 42, -12, -12 );
  45. }
  46. void CSheetEditorPanel::ApplySchemeSettings(vgui::IScheme *pScheme)
  47. {
  48. BaseClass::ApplySchemeSettings(pScheme);
  49. m_pTitleLabel->SetBgColor( Color( 200, 200, 200, 255 ) );
  50. m_pTitleLabel->SetFgColor( Color( 0, 0, 0, 255 ) );
  51. SetBgColor( Color( 100, 200, 100, 255 ) );
  52. }
  53. CSheetEditorPanel::~CSheetEditorPanel()
  54. {
  55. }
  56. void CSheetEditorPanel::SetParticleSystem( CDmeParticleSystemDefinition *pParticleSystem )
  57. {
  58. char strBuffer[ 256 ];
  59. const char *pSystemName = "<no system>";
  60. const char *pVMTName = "<no vmt>";
  61. if ( pParticleSystem != NULL )
  62. {
  63. pSystemName = pParticleSystem->GetName();
  64. if ( !pSystemName || !pSystemName[0] )
  65. {
  66. pSystemName = "<no name>";
  67. }
  68. }
  69. if ( pParticleSystem != NULL )
  70. {
  71. pVMTName = pParticleSystem->GetValueString( "material" );
  72. }
  73. Q_snprintf( strBuffer, sizeof(strBuffer), "%s: %s", pSystemName, pVMTName );
  74. m_pTitleLabel->SetText( strBuffer );
  75. }