-
Notifications
You must be signed in to change notification settings - Fork 8
/
EventSources.h
283 lines (223 loc) · 7.5 KB
/
EventSources.h
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#pragma once
// quite clunky and can be done better with templates
// too late to change it now, hooray for technical debt!
namespace cse
{
namespace events
{
class TypedEventSource : public SME::MiscGunk::IEventSource
{
typedef std::vector<TypedEventSource*> EventSourceArrayT;
static EventSourceArrayT& GetRegistry();
static void Unregister(TypedEventSource* Source);
static void Register(TypedEventSource* Source);
protected:
UInt32 TypeID;
public:
TypedEventSource(UInt32 TypeID);
virtual ~TypedEventSource();
const UInt32 GetTypeID() const;
static void Deinitialize();
enum
{
kType__BEGIN = 0,
kType_Shutdown, // when the editor shuts down
kType_Plugin_PreLoad, // before a load plugins op
kType_Plugin_PostLoad, // after a load plugins opp
kType_Plugin_PreSave, // right before the save file's header is updated
kType_Plugin_PostSave, // after the post-save cleanup is performed
kType_Plugin_ClearData, // when the data handler clears its data
kType_Plugin_ConstructSpecialForms, // after the data handler constructs the special forms
kType_Renderer_Release, // before the renderer is released
kType_Renderer_Renew, // after the renderer is recreated/renewed
kType_Renderer_PreMainSceneGraphRender, // before the main scenegraph is rendered
kType_Renderer_PostMainSceneGraphRender, // after the main scenegraph is rendered
kType_Renderer_PostRenderWindowUpdate, // after the render window viewport is refreshed (post-scene rendering)
kType_Renderer_PreBSFadeNodeDraw, // before a BSFadeNode is accumulated for rendering
kType_Renderer_PostBSFadeNodeDraw, // after a BSFadeNode is accumulated for rendering
kType_Form_Instantiation, // when a TESForm object is instantiated
kType_Form_SetActive,
kType_Form_SetDeleted,
kType_Form_SetFormID,
kType_Form_SetEditorID,
kType_Dialog_CloseAll, // when the editor's child dialogs are being closed
kType__BEGIN_CELLVIEW,
kType_CellView_SelectCell, // when a cell is selected in the cell list
kType__END_CELLVIEW,
kType__BEGIN_RENDERWINDOW,
kType_RenderWindow_PlaceRef, // when references are dropped into the render window from either the object/prefab/palette windows
kType__END_RENDERWINDOW,
kType__END
};
};
class BasicEventSource : public TypedEventSource
{
BasicEventSource();
public:
BasicEventSource(UInt32 Type);
void RaiseEvent() const;
};
class BasicTESFileEventSource : public TypedEventSource
{
BasicTESFileEventSource();
public:
BasicTESFileEventSource(UInt32 Type);
void RaiseEvent(TESFile* File) const;
};
struct TESFileEventData : public SME::MiscGunk::IEventData
{
TESFile* File;
TESFileEventData(const BasicTESFileEventSource* Source, TESFile* File);
};
class BasicTESFormEventSource : public TypedEventSource
{
BasicTESFormEventSource();
public:
BasicTESFormEventSource(UInt32 Type);
void HandleInstantiation(TESForm* Form) const;
void HandleSetActive(TESForm* Form, bool State) const;
void HandleSetDeleted(TESForm* Form, bool State) const;
void HandleSetFormID(TESForm* Form, UInt32 FormID) const;
void HandleSetEditorID(TESForm* Form, const char* EditorID) const;
};
struct TESFormEventData : public SME::MiscGunk::IEventData
{
enum
{
kType_Instantiation = 0,
kType_SetActive,
kType_SetDeleted,
kType_SetFormID,
kType_SetEditorID,
};
TESForm* Form;
UInt8 EventType;
union
{
bool ActiveState;
bool DeletedState;
UInt32 NewFormID;
const char* NewEditorID;
};
TESFormEventData(const BasicTESFormEventSource* Source, TESForm* Form, UInt8 Type);
};
namespace general
{
extern BasicEventSource kShutdown;
}
namespace plugin
{
extern BasicEventSource kPreLoad;
extern BasicEventSource kPostLoad;
extern BasicTESFileEventSource kPreSave;
extern BasicEventSource kPostSave;
extern BasicEventSource kClearData;
extern BasicEventSource kConstructSpecialForms;
}
namespace renderer
{
class PreSceneGraphRenderEventSource : public TypedEventSource
{
public:
PreSceneGraphRenderEventSource();
void RaiseEvent(NiCamera* Camera,
NiNode* SceneGraph,
NiCullingProcess* CullingProc,
BSRenderedTexture* RenderTarget) const;
};
struct PreSceneGraphRenderData : public SME::MiscGunk::IEventData
{
NiCamera* Camera;
NiNode* SceneGraph;
NiCullingProcess* CullingProc;
BSRenderedTexture* RenderTarget;
PreSceneGraphRenderData(const PreSceneGraphRenderEventSource* Source,
NiCamera* Camera, NiNode* SceneGraph, NiCullingProcess* CullingProc, BSRenderedTexture* RenderTarget);
};
class BSFadeNodeDrawEventSource;
struct BSFadeNodeDrawData : public SME::MiscGunk::IEventData
{
enum
{
kType_PreDraw = 0,
kType_PostDraw
};
BSFadeNode* Node;
TESObjectREFR* ParentRef;
UInt32 EventType;
BSFadeNodeDrawData(const BSFadeNodeDrawEventSource* Source, BSFadeNode* Node, UInt32 EventType);
};
class BSFadeNodeDrawEventSource : public TypedEventSource
{
public:
BSFadeNodeDrawEventSource(UInt32 EventType);
void RaiseEvent(BSFadeNode* Node) const;
};
extern BasicEventSource kRelease;
extern BasicEventSource kRenew;
extern PreSceneGraphRenderEventSource kPreSceneGraphRender;
extern BasicEventSource kPostSceneGraphRender;
extern BasicEventSource kPostRenderWindowUpdate;
extern BSFadeNodeDrawEventSource kPreBSFadeNodeDraw;
extern BSFadeNodeDrawEventSource kPostBSFadeNodeDraw;
}
namespace dialog
{
extern BasicEventSource kCloseAll;
namespace cellView
{
class CellViewDialogEventSource : public TypedEventSource
{
CellViewDialogEventSource();
public:
CellViewDialogEventSource(UInt32 Type);
void HandleSelectCell(TESObjectCELL* Cell) const;
};
struct CellViewDialogEventData : public SME::MiscGunk::IEventData
{
enum
{
kType_SelectCell = 0,
};
TESObjectCELL* Cell;
UInt32 EventType;
CellViewDialogEventData(const CellViewDialogEventSource* Source, TESObjectCELL* Cell, UInt32 Type);
};
extern CellViewDialogEventSource kSelectCell;
}
namespace renderWindow
{
class RenderWindowDialogEventSource : public TypedEventSource
{
RenderWindowDialogEventSource();
public:
RenderWindowDialogEventSource(UInt32 Type);
void HandlePlaceRef(TESObjectREFR* NewRef) const;
};
struct RenderWindowDialogEventData : public SME::MiscGunk::IEventData
{
enum
{
kType_PlaceRef = 0,
};
UInt32 EventType;
TESObjectREFR* PlacedRef;
RenderWindowDialogEventData(const RenderWindowDialogEventSource* Source, UInt32 Type);
};
extern RenderWindowDialogEventSource kPlaceRef;
}
}
namespace form
{
extern BasicTESFormEventSource kInstantiation;
extern BasicTESFormEventSource kSetActive;
extern BasicTESFormEventSource kSetDeleted;
extern BasicTESFormEventSource kSetFormID;
extern BasicTESFormEventSource kSetEditorID;
extern BasicTESFormEventSource kSetEditorID;
extern BasicTESFormEventSource kDataHandlerConstructSpecialForms;
}
void InitializeSources();
void DeinitializeSources();
}
}