Team Fortress 2 Source Code as on 22/4/2020
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.

155 lines
4.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef MDLPICKER_H
  7. #define MDLPICKER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier1/utlstring.h"
  12. #include "vgui_controls/Frame.h"
  13. #include "matsys_controls/baseassetpicker.h"
  14. #include "datacache/imdlcache.h"
  15. //-----------------------------------------------------------------------------
  16. // Forward declarations
  17. //-----------------------------------------------------------------------------
  18. namespace vgui
  19. {
  20. class Splitter;
  21. }
  22. class CMDLPanel;
  23. const int MAX_SELECTED_MODELS = 2;
  24. //-----------------------------------------------------------------------------
  25. // Purpose: Main app window
  26. //-----------------------------------------------------------------------------
  27. class CMDLPicker : public CBaseAssetPicker
  28. {
  29. DECLARE_CLASS_SIMPLE( CMDLPicker, CBaseAssetPicker );
  30. public:
  31. enum PageType_t
  32. {
  33. PAGE_NONE = 0,
  34. PAGE_RENDER = 0x1,
  35. PAGE_SEQUENCES = 0x2,
  36. PAGE_ACTIVITIES = 0x4,
  37. PAGE_SKINS = 0x8,
  38. PAGE_INFO = 0x10,
  39. PAGE_SCREEN_CAPS = 0x20,
  40. PAGE_ALL = 0xFFFFFFFF,
  41. };
  42. CMDLPicker( vgui::Panel *pParent, int nFlags = PAGE_ALL );
  43. ~CMDLPicker();
  44. // overridden frame functions
  45. virtual void PerformLayout();
  46. virtual void OnCommand( const char *pCommand );
  47. // Get current model
  48. void GetSelectedMDLName( char *pBuffer, int nMaxLen );
  49. // get current selected options page
  50. int GetSelectedPage();
  51. // Allows external apps to select a MDL
  52. void SelectMDL( const char *pRelativePath, bool bDoLookAt = true, int nSelectSecondary = 0 );
  53. // Set/Get Sequence
  54. void SelectSequence( const char *pSequenceName );
  55. const char *GetSelectedSequenceName();
  56. // Set/Get Activity
  57. void SelectActivity( const char *pActivityName );
  58. const char *GetSelectedActivityName();
  59. void SelectSkin( int nSkin );
  60. int GetSelectedSkin();
  61. private:
  62. MESSAGE_FUNC_PARAMS( OnAssetSelected, "AssetSelected", params );
  63. virtual void OnSelectedAssetPicked( const char *pMDLName );
  64. void RefreshActivitiesAndSequencesList();
  65. void RefreshRenderSettings();
  66. int UpdateSkinsList();
  67. void UpdateInfoTab();
  68. int UpdatePropDataList( const char* pszPropData, bool &bIsStatic );
  69. // Plays the selected activity
  70. void PlaySelectedActivity( );
  71. // Plays the selected sequence
  72. void PlaySelectedSequence( );
  73. const char *CaptureModel( int nModIndex, const char *AssetName, const char *OutputPath, int Width, int Height, Color BackgroundColor, bool bSelectedOnly );
  74. void CaptureScreenCaps( void );
  75. void SaveCaps( const char *szFileName );
  76. bool RestoreCaps( const char *szFileName );
  77. void WriteBackbackVMTFiles( const char *assetName );
  78. void GenerateBackpackIcons( void );
  79. CUtlString GetOutputFileSuffix();
  80. MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", kv );
  81. MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
  82. MESSAGE_FUNC( OnPageChanged, "PageChanged" );
  83. MESSAGE_FUNC_CHARPTR( OnDirectorySelected, "DirectorySelected", dir );
  84. CMDLPanel *m_pMDLPreview;
  85. vgui::Splitter* m_pFileBrowserSplitter;
  86. vgui::Splitter* m_pPreviewSplitter;
  87. vgui::PropertySheet *m_pViewsSheet;
  88. vgui::PropertyPage *m_pRenderPage;
  89. vgui::PropertyPage *m_pSequencesPage;
  90. vgui::PropertyPage *m_pActivitiesPage;
  91. vgui::PropertyPage *m_pSkinsPage;
  92. vgui::PropertyPage *m_pInfoPage;
  93. vgui::PropertyPage *m_pScreenCapsPage;
  94. vgui::ListPanel *m_pSequencesList;
  95. vgui::ListPanel *m_pActivitiesList;
  96. vgui::ListPanel *m_pSkinsList;
  97. vgui::ListPanel *m_pPropDataList;
  98. MDLHandle_t m_hSelectedMDL[ MAX_SELECTED_MODELS ];
  99. vgui::DHANDLE< vgui::DirectorySelectDialog > m_hDirectorySelectDialog;
  100. int m_nFlags;
  101. friend class CMDLPickerFrame;
  102. };
  103. //-----------------------------------------------------------------------------
  104. // Purpose: Main app window
  105. //-----------------------------------------------------------------------------
  106. class CMDLPickerFrame : public CBaseAssetPickerFrame
  107. {
  108. DECLARE_CLASS_SIMPLE( CMDLPickerFrame, CBaseAssetPickerFrame );
  109. public:
  110. CMDLPickerFrame( vgui::Panel *pParent, const char *pTitle, int nFlags = CMDLPicker::PAGE_ALL );
  111. virtual ~CMDLPickerFrame();
  112. // Allows external apps to select a MDL
  113. void SelectMDL( const char *pRelativePath );
  114. };
  115. #endif // MDLPICKER_H