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.

147 lines
5.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Declaration of CSceneViewerPanel
  4. //
  5. //=============================================================================
  6. #ifndef SCENEVIEWERPANEL_H_2DF240CE_62EF_4391_B733_37C393E04E9E
  7. #define SCENEVIEWERPANEL_H_2DF240CE_62EF_4391_B733_37C393E04E9E
  8. // Valve includes
  9. #include "movieobjects/dmecombinationoperator.h"
  10. #include "movieobjects/dmedag.h"
  11. #include "movieobjects/dmemesh.h"
  12. #include "movieobjects/dmemodel.h"
  13. #include "movieobjects/dmeanimationlist.h"
  14. #include "dme_controls/ElementPropertiesTree.h"
  15. #include "dme_controls/dmecombinationsystemeditorpanel.h"
  16. #include "dme_controls/AssetBuilder.h"
  17. #include "dme_controls/ElementPropertiesTree.h"
  18. #include "vgui_controls/FileOpenStateMachine.h"
  19. #include "vgui_controls/MenuBar.h"
  20. #include "vgui_controls/consoledialog.h"
  21. #include "datamodel/idatamodel.h"
  22. // Local includes
  23. #include "ClipViewPanel.h"
  24. //-----------------------------------------------------------------------------
  25. // main editor panel
  26. //-----------------------------------------------------------------------------
  27. class CSceneViewerPanel : public vgui::Panel, public IDmNotify, public vgui::IFileOpenStateMachineClient
  28. {
  29. DECLARE_CLASS_SIMPLE( CSceneViewerPanel, vgui::Panel );
  30. public:
  31. CSceneViewerPanel();
  32. ~CSceneViewerPanel();
  33. // Inherited from vgui::Panel
  34. virtual void PerformLayout();
  35. virtual void OnCommand( char const *cmd );
  36. virtual vgui::VPANEL GetCurrentKeyFocus();
  37. virtual vgui::VPANEL GetCurrentMouseFocus();
  38. virtual void OnKeyCodePressed( vgui::KeyCode code );
  39. void OnEdit();
  40. void OnUndo();
  41. void OnRedo();
  42. void OnDescribeUndoStack();
  43. CDmeDag *GetScene() { return m_pClipViewPanel->GetScene(); }
  44. MESSAGE_FUNC( OnNew, "New" );
  45. MESSAGE_FUNC( OnOpen, "Open" );
  46. MESSAGE_FUNC( OnSave, "Save" );
  47. MESSAGE_FUNC( OnSaveAs, "SaveAs" );
  48. MESSAGE_FUNC( OnSaveCurrentAs, "SaveCurrentAs" );
  49. MESSAGE_FUNC( OnExit, "Exit" );
  50. MESSAGE_FUNC_CHARPTR( OnLoadFile, "LoadFile", fullpath );
  51. MESSAGE_FUNC( OnPinAndZoomIt, "PinAndZoomIt" );
  52. MESSAGE_FUNC( OnShow3DView, "Show3DView" );
  53. MESSAGE_FUNC( OnHide3DView, "Hide3DView" );
  54. MESSAGE_FUNC( OnShowComboEditor, "ShowComboEditor" );
  55. MESSAGE_FUNC( OnHideComboEditor, "HideComboEditor" );
  56. MESSAGE_FUNC( OnShowAssetBuilder, "ShowAssetBuilder" );
  57. MESSAGE_FUNC( OnHideAssetBuilder, "HideAssetBuilder" );
  58. MESSAGE_FUNC( OnShowConsole, "ShowConsole" );
  59. MESSAGE_FUNC( OnHideConsole, "HideConsole" );
  60. MESSAGE_FUNC( OnShowNerdEditor, "ShowNerdEditor" );
  61. MESSAGE_FUNC( OnHideNerdEditor, "HideNerdEditor" );
  62. MESSAGE_FUNC( OnCombinationOperatorChanged, "CombinationOperatorChanged" );
  63. MESSAGE_FUNC_CHARPTR( OnCommandSubmitted, "CommandSubmitted", command );
  64. virtual void OnSizeChanged( int newWidth, int newHeight );
  65. protected:
  66. // Inherited from IDmNotify
  67. virtual void NotifyDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
  68. // Inherited from IFileOpenStateMachineClient
  69. virtual void SetupFileOpenDialog( vgui::FileOpenDialog *pDialog, bool bOpenFile, const char *pFileFormat, KeyValues *pContextKeyValues );
  70. virtual bool OnReadFileFromDisk( const char *pFileName, const char *pFileFormat, KeyValues *pContextKeyValues );
  71. virtual bool OnWriteFileToDisk( const char *pFileName, const char *pFileFormat, KeyValues *pContextKeyValues );
  72. // Removes all data references from all vgui things
  73. void Clear();
  74. // Loads a Dmx file from disk
  75. bool Load( const char *pFilename, CUtlStringMap< Vector > *pOldComboVals = NULL );
  76. bool Reload();
  77. // Saves the current state of all delta meshes as a single OBJ
  78. bool SaveCurrentAs( const char *pFilename );
  79. // Sets all of the various editors to reference the right stuff
  80. void SetScene();
  81. // Deals with keybindings
  82. void LoadKeyBindings();
  83. void ShowKeyBindingsEditor( vgui::Panel *panel, vgui::KeyBindingContextHandle_t handle );
  84. void ShowKeyBindingsHelp( vgui::Panel *panel, vgui::KeyBindingContextHandle_t handle, vgui::KeyCode boundKey, int modifiers );
  85. vgui::KeyBindingContextHandle_t GetKeyBindingsHandle();
  86. // Keybindings
  87. vgui::KeyBindingContextHandle_t m_KeyBindingsHandle;
  88. private:
  89. // Sets up a new mesh dag
  90. CDmeModel *CreateNewMeshDag( CDmeMesh **ppMesh, DmFileId_t fileid );
  91. // Sets up a new mesh animation
  92. CDmeAnimationList *CreateNewJointAnimation( CDmeModel *pModel );
  93. // Sets up a new vertex animation
  94. CDmeAnimationList *CreateNewVertexAnimation( CDmeMesh *pMesh, CDmeCombinationOperator *pComboOp );
  95. void SendFrameToDagRenderPanel( vgui::Panel *pPanel );
  96. vgui::MenuBar *m_pMenuBar;
  97. vgui::DHANDLE< vgui::FileOpenDialog > m_hFileOpenDialog;
  98. vgui::DHANDLE< CElementPropertiesTree > m_hProperties;
  99. // Root scene object
  100. vgui::Panel *m_pClientArea;
  101. CClipViewPanel *m_pClipViewPanel;
  102. vgui::DHANDLE< CDmeCombinationSystemEditorFrame > m_pCombinationEditor;
  103. vgui::DHANDLE< CAssetBuilderFrame > m_pAssetBuilder;
  104. vgui::DHANDLE< CElementPropertiesTree > m_pNerdEditor;
  105. CDmElement *m_pRoot;
  106. vgui::FileOpenStateMachine *m_pFileOpenStateMachine;
  107. vgui::CConsoleDialog *m_pConsole;
  108. bool m_bConsolePositioned;
  109. CUtlString m_fileDirectory;
  110. CUtlString m_filename;
  111. };
  112. #endif // defined SCENEVIEWERPANEL_H_2DF240CE_62EF_4391_B733_37C393E04E9E