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