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.

178 lines
5.4 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef SEQUENCEPICKER_H
  7. #define SEQUENCEPICKER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier1/utlstring.h"
  12. #include "vgui_controls/Frame.h"
  13. #include "vgui_controls/EditablePanel.h"
  14. #include "vgui_controls/ImageList.h"
  15. #include "datacache/imdlcache.h"
  16. #include "matsys_controls/mdlpanel.h"
  17. //-----------------------------------------------------------------------------
  18. // Forward declarations
  19. //-----------------------------------------------------------------------------
  20. namespace vgui
  21. {
  22. class Splitter;
  23. }
  24. //-----------------------------------------------------------------------------
  25. // Purpose: Sequence picker panel
  26. //-----------------------------------------------------------------------------
  27. class CSequencePicker : public vgui::EditablePanel
  28. {
  29. DECLARE_CLASS_SIMPLE( CSequencePicker, vgui::EditablePanel );
  30. public:
  31. enum PickType_t
  32. {
  33. PICK_NONE = 0,
  34. PICK_SEQUENCES = 0x1,
  35. PICK_ACTIVITIES = 0x2,
  36. PICK_ALL = PICK_SEQUENCES | PICK_ACTIVITIES,
  37. PICK_SEQUENCE_PARAMETERS = 0x10,
  38. };
  39. static const int NUM_POSE_CONTROLS = 6;
  40. static const int NUM_SEQUENCE_LAYERS = 4;
  41. // Flags come from PickType_t
  42. CSequencePicker( vgui::Panel *pParent, int nFlags = PICK_ALL );
  43. ~CSequencePicker();
  44. // overridden frame functions
  45. virtual void PerformLayout();
  46. // Process command messages
  47. virtual void OnCommand( const char *pCommand );
  48. // Sets the MDL to preview sequences for
  49. void SetMDL( const char *pMDLName );
  50. // Gets the selected activity/sequence
  51. PickType_t GetSelectedSequenceType();
  52. const char *GetSelectedSequenceName( );
  53. // Get the array of pose parameter values
  54. void GetPoseParameters( CUtlVector< float > &poseParameters ) const;
  55. // Get the array of sequence layers
  56. void GetSeqenceLayers( CUtlVector< MDLSquenceLayer_t > &sequenceLayers ) const;
  57. // Get the root motion generation state
  58. bool GetGenerateRootMotion() const;
  59. private:
  60. MESSAGE_FUNC_PARAMS( OnSliderMoved, "SliderMoved", pData );
  61. MESSAGE_FUNC_PARAMS( OnTextKillFocus, "TextKillFocus", pData );
  62. MESSAGE_FUNC_PARAMS( OnTextNewLine, "TextNewLine", pData );
  63. MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", pData );
  64. MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
  65. MESSAGE_FUNC( OnPageChanged, "PageChanged" );
  66. void RefreshActivitiesAndSequencesList();
  67. // Plays the selected activity
  68. void PlayActivity( const char *pActivityName );
  69. // Update the controls and plays the selected sequence
  70. void UpdateActiveSequence( const char *pSequenceName );
  71. // Find the index of the sequence with the specified name
  72. int FindSequence( const char *pSequenceName ) const;
  73. // Update the set of available pose parameters
  74. void UpdateAvailablePoseParmeters();
  75. // Update the value of the specified control control group
  76. void SetPoseParameterValue( float flPoseParameterValue, int nParameterIndex );
  77. // Set all pose parameters to their default values
  78. void ResetPoseParametersToDefault();
  79. // Update the pose parameter controls using the stored pose parameter values
  80. void UpdatePoseControlsFromParameters();
  81. // Update the pose parameter controls to match the set of pose parameters for the current mdl
  82. void UpdatePoseParameterControlsForMdl();
  83. // Update the sequence and weighting of the specified layer
  84. void SetSequenceLayer( int nLayerIndex, int nSequenceIndex, float flWeight );
  85. // Update the sequence layer controls to match the current layer data set
  86. void UpdateLayerControls();
  87. // Clear all the layer information and update the controls
  88. void ResetLayers();
  89. CMDLPanel *m_pMDLPreview;
  90. vgui::Splitter *m_pPreviewSplitter;
  91. vgui::PropertySheet *m_pViewsSheet;
  92. vgui::PropertyPage *m_pSequencesPage;
  93. vgui::PropertyPage *m_pActivitiesPage;
  94. vgui::ListPanel *m_pSequencesList;
  95. vgui::ListPanel *m_pActivitiesList;
  96. vgui::ComboBox *m_pLayerSequenceSelectors[ NUM_SEQUENCE_LAYERS ];
  97. vgui::Slider *m_pLayerSequenceSliders[ NUM_SEQUENCE_LAYERS ];
  98. vgui::CheckButton *m_pRootMotionCheckBox;
  99. vgui::Button *m_pPoseDefaultButton;
  100. vgui::Slider *m_pPoseValueSliders[ NUM_POSE_CONTROLS ];
  101. vgui::TextEntry *m_pPoseValueEntries[ NUM_POSE_CONTROLS ];
  102. vgui::ComboBox *m_pPoseParameterName[ NUM_POSE_CONTROLS ];
  103. MDLSquenceLayer_t m_SequenceLayers[ NUM_SEQUENCE_LAYERS ];
  104. int m_PoseControlMap[ NUM_POSE_CONTROLS ]; // Provides index of pose parameter driven by each control
  105. float m_PoseParameters[ MAXSTUDIOPOSEPARAM ]; // Array of pose parameter values to be used when rendering the mdl
  106. bool m_bSequenceParams;
  107. MDLHandle_t m_hSelectedMDL;
  108. CUtlString m_Filter;
  109. friend class CSequencePickerFrame;
  110. };
  111. //-----------------------------------------------------------------------------
  112. // Purpose: Main app window
  113. //-----------------------------------------------------------------------------
  114. class CSequencePickerFrame : public vgui::Frame
  115. {
  116. DECLARE_CLASS_SIMPLE( CSequencePickerFrame, vgui::Frame );
  117. public:
  118. CSequencePickerFrame( vgui::Panel *pParent, int nFlags );
  119. // Inherited from Frame
  120. virtual void OnCommand( const char *pCommand );
  121. // Purpose: Activate the dialog
  122. void DoModal( const char *pMDLName );
  123. private:
  124. MESSAGE_FUNC_PARAMS( OnSequencePreviewChanged, "SequencePreviewChanged", kv );
  125. CSequencePicker *m_pPicker;
  126. vgui::Button *m_pOpenButton;
  127. vgui::Button *m_pCancelButton;
  128. };
  129. #endif // SEQUENCEPICKER_H