-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweenModule.cpp
More file actions
124 lines (99 loc) · 3.49 KB
/
Copy pathTweenModule.cpp
File metadata and controls
124 lines (99 loc) · 3.49 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
* @file TweenPackage.cpp
* @brief Package entry point for deki-tween DLL
*
* This file exports the standard Deki plugin interface so the editor
* can load deki-tween.dll and register its components (TweenComponent).
*
* For linked DLLs (not dynamically loaded), DekiTween_EnsureRegistered()
* must be called from the main executable to trigger the static initializers.
*/
#include "interop/DekiPlugin.h"
#include "TweenComponent.h"
#include "TweenManager.h"
#include "reflection/ComponentRegistry.h"
#include "reflection/ComponentFactory.h"
#ifdef DEKI_EDITOR
// =============================================================================
// Linked DLL initialization
// =============================================================================
// When deki-tween is linked (not dynamically loaded), the editor must call
// this function to ensure the DLL code is actually loaded and the static
// initializers (REGISTER_COMPONENT) have run.
// Auto-generated registration helpers
extern void DekiTween_RegisterComponents();
extern int DekiTween_GetAutoComponentCount();
extern const DekiComponentMeta* DekiTween_GetAutoComponentMeta(int index);
// Track if already registered to avoid duplicates
static bool s_TweenRegistered = false;
extern "C" {
/**
* @brief Ensure deki-tween package is loaded and components are registered
*
* Call this from the editor at startup. Simply calling this function is enough
* to force the linker to include the DLL and trigger static initializers.
*
* @return Number of components registered by this package
*/
DEKI_TWEEN_API int DekiTween_EnsureRegistered(void)
{
if (s_TweenRegistered)
return DekiTween_GetAutoComponentCount();
s_TweenRegistered = true;
// Auto-generated: registers all Tween components with ComponentRegistry + ComponentFactory
DekiTween_RegisterComponents();
return DekiTween_GetAutoComponentCount();
}
} // extern "C"
// =============================================================================
// Plugin metadata (for dynamic loading compatibility)
// =============================================================================
extern "C" {
DEKI_PLUGIN_API const char* DekiPlugin_GetName(void)
{
return "Deki Tween Package";
}
DEKI_PLUGIN_API const char* DekiPlugin_GetVersion(void)
{
#ifdef DEKI_PACKAGE_VERSION
return DEKI_PACKAGE_VERSION;
#else
return "0.0.0-dev";
#endif
}
DEKI_PLUGIN_API int DekiPlugin_Init(void)
{
// No special initialization needed
return 0;
}
DEKI_PLUGIN_API void DekiPlugin_Shutdown(void)
{
s_TweenRegistered = false;
}
DEKI_PLUGIN_API int DekiPlugin_GetComponentCount(void)
{
return DekiTween_GetAutoComponentCount();
}
DEKI_PLUGIN_API const DekiComponentMeta* DekiPlugin_GetComponentMeta(int index)
{
return DekiTween_GetAutoComponentMeta(index);
}
DEKI_PLUGIN_API void DekiPlugin_RegisterComponents(void)
{
DekiTween_EnsureRegistered();
}
DEKI_PLUGIN_API void DekiPlugin_OnPlayModeStop(void)
{
Deki::TweenManager::Instance().KillAll();
}
// deki-tween renders no editor UI of its own, so it links no ImGui and shares no
// ImGui context. Its component inspectors are drawn by the editor via reflection.
// =============================================================================
// Package-specific feature API (for linked DLL access without name conflicts)
// =============================================================================
DEKI_TWEEN_API const char* DekiTween_GetName(void)
{
return "Tween";
}
} // extern "C"
#endif // DEKI_EDITOR