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.

240 lines
5.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CL_DEMOSMOOTHERPANEL_H
  8. #define CL_DEMOSMOOTHERPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============
  13. //
  14. // Purpose:
  15. //
  16. // $NoKeywords: $
  17. //=============================================================================
  18. #include <vgui_controls/Frame.h>
  19. namespace vgui
  20. {
  21. class Button;
  22. class Label;
  23. class ListPanel;
  24. class IScheme;
  25. };
  26. #include "demofile/demoformat.h"
  27. #include "demofile.h"
  28. struct demodirectory_t;
  29. class CSmoothingTypeButton;
  30. class CFixEdgeButton;
  31. typedef float (*EASEFUNC)( float t );
  32. //-----------------------------------------------------------------------------
  33. // Purpose:
  34. //-----------------------------------------------------------------------------
  35. class CDemoSmootherPanel : public vgui::Frame
  36. {
  37. DECLARE_CLASS_SIMPLE( CDemoSmootherPanel, vgui::Frame );
  38. public:
  39. CDemoSmootherPanel( vgui::Panel *parent );
  40. ~CDemoSmootherPanel();
  41. virtual void OnTick();
  42. // Command issued
  43. virtual void OnCommand(const char *command);
  44. void OnVDMChanged( void );
  45. void OnRefresh();
  46. virtual bool OverrideView( democmdinfo_t& info, int tick );
  47. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  48. virtual void DrawDebuggingInfo( int frame, float elapsed );
  49. protected:
  50. bool CanEdit();
  51. void Reset( void );
  52. demosmoothing_t *GetCurrent( void );
  53. void DrawSmoothingSample( bool original, bool processed, int samplenumber, demosmoothing_t *sample, demosmoothing_t *next );
  54. void DrawTargetSpline( void );
  55. void DrawKeySpline( void );
  56. int GetTickForFrame( int frame );
  57. int GetFrameForTick( int tick );
  58. bool GetInterpolatedViewPoint( Vector& origin, QAngle& angles );
  59. bool GetInterpolatedOriginAndAngles( bool readonly, Vector& origin, QAngle& angles );
  60. void DrawLegend( int startframe, int endframe );
  61. void OnRevert();
  62. void OnPreview( bool original );
  63. void OnSave();
  64. void OnReload();
  65. void OnSelect();
  66. void OnTogglePause();
  67. void OnStep( bool forward );
  68. void OnGotoFrame();
  69. void OnToggleKeyFrame( void );
  70. void OnToggleLookTarget( void );
  71. void OnNextKey();
  72. void OnPrevKey();
  73. void OnNextTarget();
  74. void OnPrevTarget();
  75. void OnRevertPoint( void );
  76. void PopulateMenuList();
  77. int GetStartFrame();
  78. int GetEndFrame();
  79. void OnSaveKey();
  80. void OnSetView();
  81. void OnSmoothEdges( bool left, bool right );
  82. void PerformLinearInterpolatedAngleSmoothing( int startframe, int endframe );
  83. void OnSmoothSelectionAngles( void );
  84. void OnSmoothSelectionOrigin( void );
  85. void OnLinearInterpolateAnglesBasedOnEndpoints( void );
  86. void OnLinearInterpolateOriginBasedOnEndpoints( void );
  87. void OnSplineSampleOrigin( void );
  88. void OnSplineSampleAngles( void );
  89. void OnLookAtPoints( bool spline );
  90. void OnSetKeys(float interval);
  91. void OnOriginEaseCurve( EASEFUNC easefunc );
  92. void SetLastFrame( bool jumptotarget, int frame );
  93. void AddSamplePoints( bool usetarget, bool includeboundaries, CUtlVector< demosmoothing_t * >& points, int start, int end );
  94. demosmoothing_t *GetBoundedSample( CUtlVector< demosmoothing_t * >& points, int sample );
  95. void FindSpanningPoints( int tick, CUtlVector< demosmoothing_t * >& points, int& prev, int& next );
  96. // Undo/Redo
  97. void Undo( void );
  98. void Redo( void );
  99. // Do push before changes
  100. void PushUndo( const char *description );
  101. // Do this push after changes, must match pushundo 1for1
  102. void PushRedo( const char *description );
  103. void WipeUndo( void );
  104. void WipeRedo( void );
  105. const char *GetUndoDescription( void );
  106. const char *GetRedoDescription( void );
  107. bool CanUndo( void );
  108. bool CanRedo( void );
  109. void ParseSmoothingInfo( CDemoFile &demoFile, CSmoothingContext& smoothing );
  110. void LoadSmoothingInfo( const char *filename, CSmoothingContext& smoothing );
  111. void ClearSmoothingInfo( CSmoothingContext& smoothing );
  112. void SaveSmoothingInfo( char const *filename, CSmoothingContext& smoothing );
  113. CSmoothingTypeButton *m_pType;
  114. vgui::Button *m_pRevert;
  115. vgui::Button *m_pOK;
  116. vgui::Button *m_pCancel;
  117. vgui::Button *m_pSave;
  118. vgui::Button *m_pReloadFromDisk;
  119. vgui::TextEntry *m_pStartFrame;
  120. vgui::TextEntry *m_pEndFrame;
  121. vgui::Button *m_pPreviewOriginal;
  122. vgui::Button *m_pPreviewProcessed;
  123. vgui::CheckButton *m_pBackOff;
  124. vgui::Label *m_pSelectionInfo;
  125. vgui::CheckButton *m_pShowAllSamples;
  126. vgui::Button *m_pSelectSamples;
  127. vgui::Button *m_pPauseResume;
  128. vgui::Button *m_pStepForward;
  129. vgui::Button *m_pStepBackward;
  130. vgui::CheckButton *m_pHideLegend;
  131. vgui::CheckButton *m_pHideOriginal;
  132. vgui::CheckButton *m_pHideProcessed;
  133. vgui::Button *m_pToggleKeyFrame;
  134. vgui::Button *m_pToggleLookTarget;
  135. vgui::Button *m_pRevertPoint;
  136. vgui::Button *m_pMoveCameraToPoint;
  137. vgui::Button *m_pUndo;
  138. vgui::Button *m_pRedo;
  139. vgui::Button *m_pNextKey;
  140. vgui::Button *m_pPrevKey;
  141. vgui::Button *m_pNextTarget;
  142. vgui::Button *m_pPrevTarget;
  143. CFixEdgeButton *m_pFixEdges;
  144. vgui::TextEntry *m_pFixEdgeFrames;
  145. vgui::Button *m_pProcessKey;
  146. vgui::TextEntry *m_pGotoFrame;
  147. vgui::Button *m_pGoto;
  148. bool m_bHasSelection;
  149. int m_nSelection[2];
  150. int m_iSelectionTicksSpan;
  151. bool m_bPreviewing;
  152. bool m_bPreviewOriginal;
  153. int m_iPreviewStartTick;
  154. float m_fPreviewCurrentTime;
  155. int m_nPreviewLastFrame;
  156. bool m_bPreviewPaused;
  157. CSmoothingContext m_Smoothing;
  158. bool m_bInputActive;
  159. int m_nOldCursor[2];
  160. struct DemoSmoothUndo
  161. {
  162. CSmoothingContext *undo;
  163. CSmoothingContext *redo;
  164. char *udescription;
  165. char *rdescription;
  166. };
  167. CUtlVector< DemoSmoothUndo * > m_UndoStack;
  168. int m_nUndoLevel;
  169. bool m_bRedoPending;
  170. bool m_bDirty;
  171. Vector m_vecEyeOffset;
  172. };
  173. #endif // CL_DEMOSMOOTHERPANEL_H