Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeGraphPackage.cpp
More file actions
Latest commit
103 lines (87 loc) · 3.22 KB
/
Copy pathNodeGraphPackage.cpp
File metadata and controls
103 lines (87 loc) · 3.22 KB
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
/**
* @file NodeGraphPackage.cpp
* @brief Package entry point for the deki-nodegraph DLL.
*
* deki-nodegraph owns the whole node-graph feature: the runtime container
* (NodeGraphData) and factory that every platform needs, plus the editor-side
* registries, document, undo commands and the generic Node Graph window.
*
* It declares no node types and no components of its own. Node types and graph
* domains come from the packages and project DLLs that consume it (deki-fsm's
* states and actions, a game's own nodes) via DEKI_NODE / the registration
* macros in DekiNode.h.
*/
#include"interop/DekiPlugin.h"
#include"deki-nodegraph/DekiNode.h"
#include"DekiLogSystem.h"
#ifdef DEKI_EDITOR
// Auto-generated registration helpers (no components, but the codegen always
// emits the trio so the plugin interface below has something to call).
externvoidDekiNodeGraph_RegisterComponents();
externintDekiNodeGraph_GetAutoComponentCount();
externconst DekiComponentMeta* DekiNodeGraph_GetAutoComponentMeta(int index);
#endif
staticbool s_NodeGraphRegistered = false;
extern"C" {
DEKI_NODEGRAPH_APIintDekiNodeGraph_EnsureRegistered(void)
{
#ifdef DEKI_EDITOR
if (s_NodeGraphRegistered) returnDekiNodeGraph_GetAutoComponentCount();
s_NodeGraphRegistered = true;
DekiNodeGraph_RegisterComponents();
returnDekiNodeGraph_GetAutoComponentCount();
#else
return0;
#endif
}
DEKI_PLUGIN_APIconstchar* DekiPlugin_GetName(void) { return"Deki Node Graph Package"; }
DEKI_PLUGIN_APIconstchar* DekiPlugin_GetVersion(void)
{
#ifdef DEKI_PACKAGE_VERSION
returnDEKI_PACKAGE_VERSION;
#else
return"0.0.0-dev";
#endif
}
DEKI_PLUGIN_APIintDekiPlugin_Init(void) { return0; }
DEKI_PLUGIN_APIvoidDekiPlugin_Shutdown(void) { s_NodeGraphRegistered = false; }
#ifdef DEKI_EDITOR
DEKI_PLUGIN_APIintDekiPlugin_GetComponentCount(void)
{
returnDekiNodeGraph_GetAutoComponentCount();
}
DEKI_PLUGIN_APIconst DekiComponentMeta* DekiPlugin_GetComponentMeta(int index)
{
returnDekiNodeGraph_GetAutoComponentMeta(index);
}
#else
DEKI_PLUGIN_APIintDekiPlugin_GetComponentCount(void) { return0; }
DEKI_PLUGIN_APIconst DekiComponentMeta* DekiPlugin_GetComponentMeta(int) { returnnullptr; }
#endif
DEKI_PLUGIN_APIvoidDekiPlugin_RegisterComponents(void)
{
DekiNodeGraph_EnsureRegistered();
}
#ifdef DEKI_EDITOR
/**
* @brief Drop every registered node type, factory thunk and graph domain.
*
* The editor calls this on each loaded package before it unloads plugin or
* package DLLs: the registries hold meta and thunk pointers INTO those DLLs,
* and reading them after FreeLibrary is a crash. Owning the wipe here is what
* keeps the editor free of node-graph knowledge — it just asks every package to
* clean up after itself.
*
* Consumers repopulate on the way back up: full reloads rerun their static
* registrars, plugin-only reloads go through DekiPlugin_RegisterComponents
* (see deki-fsm's DekiFsm_RegisterGraphTypes).
*/
DEKI_PLUGIN_APIvoidDekiPlugin_ClearRegistries(void)
{
SceneFormat::NodeFactory::Instance().Clear();
NodeTypeRegistry::Instance().Clear();
NodeGraphDomainRegistry::Instance().Clear();
}
#endif
// Infrastructure package — no systems to install into the engine at load.
} // extern "C"