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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#ifndef QCGENERATOR_H
#define QCGENERATOR_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/EditablePanel.h"
#include "vgui_controls/Frame.h"
#include "vgui_controls/Button.h"
#include "tier1/utlstring.h"
#include "vgui_controls/TextEntry.h"
class CQCGenerator;
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class Panel;
}
class CBrowseButton : public vgui::Button
{
DECLARE_CLASS_SIMPLE( CBrowseButton, vgui::Button );
public:
CBrowseButton( vgui::Panel *pParent );
~CBrowseButton();
void InitBrowseInfo( int x, int y, const char *pszName, const char *pszDir, const char *pszFilter, const char *pszField );
private:
char *pszStartingDirectory;
char *pszFileFilter;
char *pszTargetField;
char **GetStartingDirectory(){ return &pszStartingDirectory; }
char **GetFileFilter(){ return &pszFileFilter; }
char **GetTargetField(){ return &pszTargetField; }
void SetCharVar( char **pVar, const char *pszNewText );
void SetActionMessage();
};
struct LODInfo
{
char pszFilename[MAX_PATH];
int iLOD;
};
struct QCInfo
{
CQCGenerator *pQCGenerator;
char pszSMDPath[MAX_PATH];
char pszCollisionPath[MAX_PATH];
char pszSurfaceProperty[MAX_PATH];
char pszMaterialPath[MAX_PATH];
char pszSceneName[MAX_PATH];
bool bStaticProp;
bool bMostlyOpaque;
bool bDisableCollision;
bool bReferenceAsPhys;
bool bConcave;
bool bAutomass;
bool bNoAnimation;
CUtlVector<LODInfo> LODs;
float fScale;
float fMass;
void Init( CQCGenerator *pPanel )
{
pQCGenerator = pPanel;
V_strcpy_safe( pszSMDPath, "" );
V_strcpy_safe( pszCollisionPath, "" );
V_strcpy_safe( pszSurfaceProperty, "default" );
bStaticProp = false;
bMostlyOpaque = false;
bDisableCollision = false;
bReferenceAsPhys = false;
bConcave = false;
bAutomass = false;
bNoAnimation = true;
fScale = 1.0;
fMass = 10.0;
}
void SyncToControls();
void SyncFromControls();
};
//-----------------------------------------------------------------------------
// Purpose: Base class for generating QC files
//-----------------------------------------------------------------------------
class CQCGenerator : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CQCGenerator, vgui::EditablePanel );
public:
CQCGenerator( vgui::Panel *pParent, const char *pszPath, const char *pszScene );
~CQCGenerator();
// overridden frame functions
// virtual void Activate();
virtual void OnCommand( const char *command );
// Purpose:
// virtual void OnKeyCodeTyped( vgui::KeyCode code );
MESSAGE_FUNC( OnNewLODText, "TextNewLine" );
MESSAGE_FUNC_PARAMS( OnBrowse, "browse", data );
MESSAGE_FUNC_PARAMS( OnFileSelected, "FileSelected", data );
MESSAGE_FUNC_PARAMS( OnDirectorySelected, "DirectorySelected", data );
bool GenerateQCFile();
// void BrowseDirectory( KeyValues *data );
void BrowseFile( KeyValues *data );
void DeleteLOD( );
void EditLOD();
virtual void OnKeyCodeTyped( vgui::KeyCode code);
void InitializeSMDPaths( const char *pszPath, const char *pszScene );
protected:
// Creates standard controls. Allows the derived class to
// add these controls to various splitter windows
void CreateStandardControls( vgui::Panel *pParent );
private:
CBrowseButton *m_pCollisionBrowseButton;
char m_szTargetField[MAX_PATH];
vgui::ListPanel *m_pLODPanel;
vgui::TextEntry *m_pLODEdit;
int m_nSelectedSequence;
int m_nSelectedColumn;
QCInfo m_QCInfo_t;
};
#endif // QCGENERATOR_H
|