Refactor module initialization

* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
This commit is contained in:
reduz 2022-05-03 11:56:08 +02:00
parent 0a9d31a7eb
commit de0ca3b999
103 changed files with 897 additions and 454 deletions

View File

@ -556,7 +556,6 @@ typedef enum {
GDNATIVE_INITIALIZATION_CORE, GDNATIVE_INITIALIZATION_CORE,
GDNATIVE_INITIALIZATION_SERVERS, GDNATIVE_INITIALIZATION_SERVERS,
GDNATIVE_INITIALIZATION_SCENE, GDNATIVE_INITIALIZATION_SCENE,
GDNATIVE_INITIALIZATION_DRIVER,
GDNATIVE_INITIALIZATION_EDITOR, GDNATIVE_INITIALIZATION_EDITOR,
GDNATIVE_MAX_INITIALIZATION_LEVEL, GDNATIVE_MAX_INITIALIZATION_LEVEL,
} GDNativeInitializationLevel; } GDNativeInitializationLevel;

View File

@ -334,7 +334,6 @@ void NativeExtension::_bind_methods() {
BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_CORE); BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_CORE);
BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_SERVERS); BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_SERVERS);
BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_SCENE); BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_SCENE);
BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_DRIVER);
BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_EDITOR); BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_EDITOR);
} }

View File

@ -70,11 +70,10 @@ public:
void close_library(); void close_library();
enum InitializationLevel { enum InitializationLevel {
INITIALIZATION_LEVEL_CORE, INITIALIZATION_LEVEL_CORE = GDNATIVE_INITIALIZATION_CORE,
INITIALIZATION_LEVEL_SERVERS, INITIALIZATION_LEVEL_SERVERS = GDNATIVE_INITIALIZATION_SERVERS,
INITIALIZATION_LEVEL_SCENE, INITIALIZATION_LEVEL_SCENE = GDNATIVE_INITIALIZATION_SCENE,
INITIALIZATION_LEVEL_DRIVER, INITIALIZATION_LEVEL_EDITOR = GDNATIVE_INITIALIZATION_EDITOR
INITIALIZATION_LEVEL_EDITOR,
}; };
bool is_library_open() const; bool is_library_open() const;

View File

@ -43,9 +43,7 @@
</constant> </constant>
<constant name="INITIALIZATION_LEVEL_SCENE" value="2" enum="InitializationLevel"> <constant name="INITIALIZATION_LEVEL_SCENE" value="2" enum="InitializationLevel">
</constant> </constant>
<constant name="INITIALIZATION_LEVEL_DRIVER" value="3" enum="InitializationLevel"> <constant name="INITIALIZATION_LEVEL_EDITOR" value="3" enum="InitializationLevel">
</constant>
<constant name="INITIALIZATION_LEVEL_EDITOR" value="4" enum="InitializationLevel">
</constant> </constant>
</constants> </constants>
</class> </class>

View File

@ -55,9 +55,7 @@ void unregister_core_driver_types() {
} }
void register_driver_types() { void register_driver_types() {
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_DRIVER);
} }
void unregister_driver_types() { void unregister_driver_types() {
NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_DRIVER);
} }

View File

@ -31,7 +31,6 @@
#include "editor_node.h" #include "editor_node.h"
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
#include "core/extension/native_extension_manager.h"
#include "core/input/input.h" #include "core/input/input.h"
#include "core/io/config_file.h" #include "core/io/config_file.h"
#include "core/io/file_access.h" #include "core/io/file_access.h"
@ -3942,12 +3941,9 @@ void EditorNode::register_editor_types() {
GDREGISTER_CLASS(EditorScenePostImport); GDREGISTER_CLASS(EditorScenePostImport);
GDREGISTER_CLASS(EditorCommandPalette); GDREGISTER_CLASS(EditorCommandPalette);
GDREGISTER_CLASS(EditorDebuggerPlugin); GDREGISTER_CLASS(EditorDebuggerPlugin);
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_EDITOR);
} }
void EditorNode::unregister_editor_types() { void EditorNode::unregister_editor_types() {
NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_EDITOR);
_init_callbacks.clear(); _init_callbacks.clear();
if (EditorPaths::get_singleton()) { if (EditorPaths::get_singleton()) {
EditorPaths::free(); EditorPaths::free();

View File

@ -35,6 +35,7 @@
#include "core/crypto/crypto.h" #include "core/crypto/crypto.h"
#include "core/debugger/engine_debugger.h" #include "core/debugger/engine_debugger.h"
#include "core/extension/extension_api_dump.h" #include "core/extension/extension_api_dump.h"
#include "core/extension/native_extension_manager.h"
#include "core/input/input.h" #include "core/input/input.h"
#include "core/input/input_map.h" #include "core/input/input_map.h"
#include "core/io/dir_access.h" #include "core/io/dir_access.h"
@ -406,15 +407,18 @@ Error Main::test_setup() {
tsman->add_interface(ts); tsman->add_interface(ts);
} }
// From `Main::setup2()`.
initialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
register_core_extensions(); register_core_extensions();
// From `Main::setup2()`.
preregister_module_types();
preregister_server_types(); preregister_server_types();
register_core_singletons(); register_core_singletons();
/** INITIALIZE SERVERS **/
register_server_types(); register_server_types();
initialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS);
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SERVERS);
translation_server->setup(); //register translations, load them, etc. translation_server->setup(); //register translations, load them, etc.
if (!locale.is_empty()) { if (!locale.is_empty()) {
@ -428,16 +432,20 @@ Error Main::test_setup() {
register_scene_types(); register_scene_types();
register_driver_types(); register_driver_types();
initialize_modules(MODULE_INITIALIZATION_LEVEL_SCENE);
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SCENE);
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
ClassDB::set_current_api(ClassDB::API_EDITOR); ClassDB::set_current_api(ClassDB::API_EDITOR);
EditorNode::register_editor_types(); EditorNode::register_editor_types();
initialize_modules(MODULE_INITIALIZATION_LEVEL_EDITOR);
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_EDITOR);
ClassDB::set_current_api(ClassDB::API_CORE); ClassDB::set_current_api(ClassDB::API_CORE);
#endif #endif
register_platform_apis(); register_platform_apis();
register_module_types();
// Theme needs modules to be initialized so that sub-resources can be loaded. // Theme needs modules to be initialized so that sub-resources can be loaded.
initialize_theme(); initialize_theme();
@ -479,13 +487,19 @@ void Main::test_cleanup() {
ResourceSaver::remove_custom_savers(); ResourceSaver::remove_custom_savers();
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_EDITOR);
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_EDITOR);
EditorNode::unregister_editor_types(); EditorNode::unregister_editor_types();
#endif #endif
unregister_module_types(); NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SCENE);
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SCENE);
unregister_platform_apis(); unregister_platform_apis();
unregister_driver_types(); unregister_driver_types();
unregister_scene_types(); unregister_scene_types();
NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SERVERS);
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS);
unregister_server_types(); unregister_server_types();
OS::get_singleton()->finalize(); OS::get_singleton()->finalize();
@ -507,6 +521,7 @@ void Main::test_cleanup() {
} }
unregister_core_driver_types(); unregister_core_driver_types();
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
unregister_core_extensions(); unregister_core_extensions();
unregister_core_types(); unregister_core_types();
@ -1166,6 +1181,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// Initialize user data dir. // Initialize user data dir.
OS::get_singleton()->ensure_user_data_dir(); OS::get_singleton()->ensure_user_data_dir();
initialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
register_core_extensions(); // core extensions must be registered after globals setup and before display register_core_extensions(); // core extensions must be registered after globals setup and before display
ResourceUID::get_singleton()->load_from_cache(); // load UUIDs from cache. ResourceUID::get_singleton()->load_from_cache(); // load UUIDs from cache.
@ -1584,7 +1600,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
tsman->add_interface(ts); tsman->add_interface(ts);
} }
preregister_module_types();
preregister_server_types(); preregister_server_types();
// Print engine name and version // Print engine name and version
@ -1751,6 +1766,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
} }
register_server_types(); register_server_types();
initialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS);
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SERVERS);
MAIN_PRINT("Main: Load Boot Image"); MAIN_PRINT("Main: Load Boot Image");
@ -1925,14 +1942,16 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
MAIN_PRINT("Main: Load Scene Types"); MAIN_PRINT("Main: Load Scene Types");
register_scene_types(); register_scene_types();
MAIN_PRINT("Main: Load Driver Types");
register_driver_types(); register_driver_types();
initialize_modules(MODULE_INITIALIZATION_LEVEL_SCENE);
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SCENE);
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
ClassDB::set_current_api(ClassDB::API_EDITOR); ClassDB::set_current_api(ClassDB::API_EDITOR);
EditorNode::register_editor_types(); EditorNode::register_editor_types();
initialize_modules(MODULE_INITIALIZATION_LEVEL_EDITOR);
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_EDITOR);
ClassDB::set_current_api(ClassDB::API_CORE); ClassDB::set_current_api(ClassDB::API_CORE);
@ -1941,7 +1960,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
MAIN_PRINT("Main: Load Modules"); MAIN_PRINT("Main: Load Modules");
register_platform_apis(); register_platform_apis();
register_module_types();
// Theme needs modules to be initialized so that sub-resources can be loaded. // Theme needs modules to be initialized so that sub-resources can be loaded.
initialize_theme(); initialize_theme();
@ -2852,15 +2870,23 @@ void Main::cleanup(bool p_force) {
} }
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_EDITOR);
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_EDITOR);
EditorNode::unregister_editor_types(); EditorNode::unregister_editor_types();
#endif #endif
ImageLoader::cleanup(); ImageLoader::cleanup();
unregister_module_types(); NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SCENE);
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SCENE);
unregister_platform_apis(); unregister_platform_apis();
unregister_driver_types(); unregister_driver_types();
unregister_scene_types(); unregister_scene_types();
NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SERVERS);
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS);
unregister_server_types(); unregister_server_types();
EngineDebugger::deinitialize(); EngineDebugger::deinitialize();
@ -2929,6 +2955,7 @@ void Main::cleanup(bool p_force) {
unregister_core_driver_types(); unregister_core_driver_types();
unregister_core_extensions(); unregister_core_extensions();
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
unregister_core_types(); unregister_core_types();
OS::get_singleton()->finalize_core(); OS::get_singleton()->finalize_core();

View File

@ -266,25 +266,19 @@ def write_disabled_classes(class_list):
def write_modules(modules): def write_modules(modules):
includes_cpp = "" includes_cpp = ""
preregister_cpp = "" initialize_cpp = ""
register_cpp = "" uninitialize_cpp = ""
unregister_cpp = ""
for name, path in modules.items(): for name, path in modules.items():
try: try:
with open(os.path.join(path, "register_types.h")): with open(os.path.join(path, "register_types.h")):
includes_cpp += '#include "' + path + '/register_types.h"\n' includes_cpp += '#include "' + path + '/register_types.h"\n'
preregister_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n" initialize_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n"
preregister_cpp += "#ifdef MODULE_" + name.upper() + "_HAS_PREREGISTER\n" initialize_cpp += "\tinitialize_" + name + "_module(p_level);\n"
preregister_cpp += "\tpreregister_" + name + "_types();\n" initialize_cpp += "#endif\n"
preregister_cpp += "#endif\n" uninitialize_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n"
preregister_cpp += "#endif\n" uninitialize_cpp += "\tuninitialize_" + name + "_module(p_level);\n"
register_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n" uninitialize_cpp += "#endif\n"
register_cpp += "\tregister_" + name + "_types();\n"
register_cpp += "#endif\n"
unregister_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n"
unregister_cpp += "\tunregister_" + name + "_types();\n"
unregister_cpp += "#endif\n"
except OSError: except OSError:
pass pass
@ -296,22 +290,17 @@ def write_modules(modules):
%s %s
void preregister_module_types() { void initialize_modules(ModuleInitializationLevel p_level) {
%s %s
} }
void register_module_types() { void uninitialize_modules(ModuleInitializationLevel p_level) {
%s
}
void unregister_module_types() {
%s %s
} }
""" % ( """ % (
includes_cpp, includes_cpp,
preregister_cpp, initialize_cpp,
register_cpp, uninitialize_cpp,
unregister_cpp,
) )
# NOTE: It is safe to generate this file here, since this is still executed serially # NOTE: It is safe to generate this file here, since this is still executed serially

View File

@ -266,7 +266,11 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
return basis_universal_unpacker_ptr(r, size); return basis_universal_unpacker_ptr(r, size);
} }
void register_basis_universal_types() { void initialize_basis_universal_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
using namespace basisu; using namespace basisu;
using namespace basist; using namespace basist;
@ -277,7 +281,11 @@ void register_basis_universal_types() {
Image::basis_universal_unpacker_ptr = basis_universal_unpacker_ptr; Image::basis_universal_unpacker_ptr = basis_universal_unpacker_ptr;
} }
void unregister_basis_universal_types() { void uninitialize_basis_universal_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
Image::basis_universal_packer = nullptr; Image::basis_universal_packer = nullptr;
#endif #endif

View File

@ -31,7 +31,9 @@
#ifndef BASIS_UNIVERSAL_REGISTER_TYPES_H #ifndef BASIS_UNIVERSAL_REGISTER_TYPES_H
#define BASIS_UNIVERSAL_REGISTER_TYPES_H #define BASIS_UNIVERSAL_REGISTER_TYPES_H
void register_basis_universal_types(); #include "modules/register_module_types.h"
void unregister_basis_universal_types();
void initialize_basis_universal_module(ModuleInitializationLevel p_level);
void uninitialize_basis_universal_module(ModuleInitializationLevel p_level);
#endif // BASIS_UNIVERSAL_REGISTER_TYPES_H #endif // BASIS_UNIVERSAL_REGISTER_TYPES_H

View File

@ -34,11 +34,19 @@
static ImageLoaderBMP *image_loader_bmp = nullptr; static ImageLoaderBMP *image_loader_bmp = nullptr;
void register_bmp_types() { void initialize_bmp_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
image_loader_bmp = memnew(ImageLoaderBMP); image_loader_bmp = memnew(ImageLoaderBMP);
ImageLoader::add_image_format_loader(image_loader_bmp); ImageLoader::add_image_format_loader(image_loader_bmp);
} }
void unregister_bmp_types() { void uninitialize_bmp_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
memdelete(image_loader_bmp); memdelete(image_loader_bmp);
} }

View File

@ -31,7 +31,9 @@
#ifndef BMP_REGISTER_TYPES_H #ifndef BMP_REGISTER_TYPES_H
#define BMP_REGISTER_TYPES_H #define BMP_REGISTER_TYPES_H
void register_bmp_types(); #include "modules/register_module_types.h"
void unregister_bmp_types();
void initialize_bmp_module(ModuleInitializationLevel p_level);
void uninitialize_bmp_module(ModuleInitializationLevel p_level);
#endif // BMP_REGISTER_TYPES_H #endif // BMP_REGISTER_TYPES_H

View File

@ -37,7 +37,11 @@
#include "camera_osx.h" #include "camera_osx.h"
#endif #endif
void register_camera_types() { void initialize_camera_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
#if defined(WINDOWS_ENABLED) #if defined(WINDOWS_ENABLED)
CameraServer::make_default<CameraWindows>(); CameraServer::make_default<CameraWindows>();
#endif #endif
@ -46,5 +50,8 @@ void register_camera_types() {
#endif #endif
} }
void unregister_camera_types() { void uninitialize_camera_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,9 @@
#ifndef CAMERA_REGISTER_TYPES_H #ifndef CAMERA_REGISTER_TYPES_H
#define CAMERA_REGISTER_TYPES_H #define CAMERA_REGISTER_TYPES_H
void register_camera_types(); #include "modules/register_module_types.h"
void unregister_camera_types();
void initialize_camera_module(ModuleInitializationLevel p_level);
void uninitialize_camera_module(ModuleInitializationLevel p_level);
#endif // CAMERA_REGISTER_TYPES_H #endif // CAMERA_REGISTER_TYPES_H

View File

@ -38,7 +38,8 @@
#include "editor/csg_gizmos.h" #include "editor/csg_gizmos.h"
#endif #endif
void register_csg_types() { void initialize_csg_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
GDREGISTER_ABSTRACT_CLASS(CSGShape3D); GDREGISTER_ABSTRACT_CLASS(CSGShape3D);
GDREGISTER_ABSTRACT_CLASS(CSGPrimitive3D); GDREGISTER_ABSTRACT_CLASS(CSGPrimitive3D);
GDREGISTER_CLASS(CSGMesh3D); GDREGISTER_CLASS(CSGMesh3D);
@ -48,13 +49,18 @@ void register_csg_types() {
GDREGISTER_CLASS(CSGTorus3D); GDREGISTER_CLASS(CSGTorus3D);
GDREGISTER_CLASS(CSGPolygon3D); GDREGISTER_CLASS(CSGPolygon3D);
GDREGISTER_CLASS(CSGCombiner3D); GDREGISTER_CLASS(CSGCombiner3D);
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<EditorPluginCSG>(); EditorPlugins::add_by_type<EditorPluginCSG>();
}
#endif #endif
} }
void unregister_csg_types() { void uninitialize_csg_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }
#endif // _3D_DISABLED #endif // _3D_DISABLED

View File

@ -31,7 +31,9 @@
#ifndef CSG_REGISTER_TYPES_H #ifndef CSG_REGISTER_TYPES_H
#define CSG_REGISTER_TYPES_H #define CSG_REGISTER_TYPES_H
void register_csg_types(); #include "modules/register_module_types.h"
void unregister_csg_types();
void initialize_csg_module(ModuleInitializationLevel p_level);
void uninitialize_csg_module(ModuleInitializationLevel p_level);
#endif // CSG_REGISTER_TYPES_H #endif // CSG_REGISTER_TYPES_H

View File

@ -34,11 +34,19 @@
#include "image_compress_cvtt.h" #include "image_compress_cvtt.h"
void register_cvtt_types() { void initialize_cvtt_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
Image::set_compress_bptc_func(image_compress_cvtt); Image::set_compress_bptc_func(image_compress_cvtt);
Image::_image_decompress_bptc = image_decompress_cvtt; Image::_image_decompress_bptc = image_decompress_cvtt;
} }
void unregister_cvtt_types() {} void uninitialize_cvtt_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}
#endif #endif

View File

@ -33,8 +33,10 @@
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
void register_cvtt_types(); #include "modules/register_module_types.h"
void unregister_cvtt_types();
void initialize_cvtt_module(ModuleInitializationLevel p_level);
void uninitialize_cvtt_module(ModuleInitializationLevel p_level);
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED

View File

@ -34,12 +34,20 @@
static Ref<ResourceFormatDDS> resource_loader_dds; static Ref<ResourceFormatDDS> resource_loader_dds;
void register_dds_types() { void initialize_dds_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
resource_loader_dds.instantiate(); resource_loader_dds.instantiate();
ResourceLoader::add_resource_format_loader(resource_loader_dds); ResourceLoader::add_resource_format_loader(resource_loader_dds);
} }
void unregister_dds_types() { void uninitialize_dds_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
ResourceLoader::remove_resource_format_loader(resource_loader_dds); ResourceLoader::remove_resource_format_loader(resource_loader_dds);
resource_loader_dds.unref(); resource_loader_dds.unref();
} }

View File

@ -31,7 +31,9 @@
#ifndef DDS_REGISTER_TYPES_H #ifndef DDS_REGISTER_TYPES_H
#define DDS_REGISTER_TYPES_H #define DDS_REGISTER_TYPES_H
void register_dds_types(); #include "modules/register_module_types.h"
void unregister_dds_types();
void initialize_dds_module(ModuleInitializationLevel p_level);
void uninitialize_dds_module(ModuleInitializationLevel p_level);
#endif // DDS_REGISTER_TYPES_H #endif // DDS_REGISTER_TYPES_H

View File

@ -32,9 +32,16 @@
#include "core/config/engine.h" #include "core/config/engine.h"
#include "lightmap_denoiser.h" #include "lightmap_denoiser.h"
void register_denoise_types() { void initialize_denoise_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
LightmapDenoiserOIDN::make_default_denoiser(); LightmapDenoiserOIDN::make_default_denoiser();
} }
void unregister_denoise_types() { void uninitialize_denoise_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,9 @@
#ifndef DENOISE_REGISTER_TYPES_H #ifndef DENOISE_REGISTER_TYPES_H
#define DENOISE_REGISTER_TYPES_H #define DENOISE_REGISTER_TYPES_H
void register_denoise_types(); #include "modules/register_module_types.h"
void unregister_denoise_types();
void initialize_denoise_module(ModuleInitializationLevel p_level);
void uninitialize_denoise_module(ModuleInitializationLevel p_level);
#endif // DENOISE_REGISTER_TYPES_H #endif // DENOISE_REGISTER_TYPES_H

View File

@ -36,7 +36,11 @@
static bool enet_ok = false; static bool enet_ok = false;
void register_enet_types() { void initialize_enet_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
if (enet_initialize() != 0) { if (enet_initialize() != 0) {
ERR_PRINT("ENet initialization failure"); ERR_PRINT("ENet initialization failure");
} else { } else {
@ -48,7 +52,11 @@ void register_enet_types() {
GDREGISTER_CLASS(ENetConnection); GDREGISTER_CLASS(ENetConnection);
} }
void unregister_enet_types() { void uninitialize_enet_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
if (enet_ok) { if (enet_ok) {
enet_deinitialize(); enet_deinitialize();
} }

View File

@ -31,7 +31,9 @@
#ifndef ENET_REGISTER_TYPES_H #ifndef ENET_REGISTER_TYPES_H
#define ENET_REGISTER_TYPES_H #define ENET_REGISTER_TYPES_H
void register_enet_types(); #include "modules/register_module_types.h"
void unregister_enet_types();
void initialize_enet_module(ModuleInitializationLevel p_level);
void uninitialize_enet_module(ModuleInitializationLevel p_level);
#endif // ENET_REGISTER_TYPES_H #endif // ENET_REGISTER_TYPES_H

View File

@ -32,11 +32,18 @@
#include "image_compress_etcpak.h" #include "image_compress_etcpak.h"
void register_etcpak_types() { void initialize_etcpak_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
Image::_image_compress_etc1_func = _compress_etc1; Image::_image_compress_etc1_func = _compress_etc1;
Image::_image_compress_etc2_func = _compress_etc2; Image::_image_compress_etc2_func = _compress_etc2;
Image::_image_compress_bc_func = _compress_bc; Image::_image_compress_bc_func = _compress_bc;
} }
void unregister_etcpak_types() { void uninitialize_etcpak_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,11 @@
#ifndef ETCPAK_REGISTER_TYPES_H #ifndef ETCPAK_REGISTER_TYPES_H
#define ETCPAK_REGISTER_TYPES_H #define ETCPAK_REGISTER_TYPES_H
void register_etcpak_types(); #include "modules/register_module_types.h"
void unregister_etcpak_types();
#include "modules/register_module_types.h"
void initialize_etcpak_module(ModuleInitializationLevel p_level);
void uninitialize_etcpak_module(ModuleInitializationLevel p_level);
#endif // ETCPAK_REGISTER_TYPES_H #endif // ETCPAK_REGISTER_TYPES_H

View File

@ -30,6 +30,14 @@
#include "register_types.h" #include "register_types.h"
void register_freetype_types() {} void initialize_freetype_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}
void unregister_freetype_types() {} void uninitialize_freetype_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}

View File

@ -31,7 +31,9 @@
#ifndef FREETYPE_REGISTER_TYPES_H #ifndef FREETYPE_REGISTER_TYPES_H
#define FREETYPE_REGISTER_TYPES_H #define FREETYPE_REGISTER_TYPES_H
void register_freetype_types(); #include "modules/register_module_types.h"
void unregister_freetype_types();
void initialize_freetype_module(ModuleInitializationLevel p_level);
void uninitialize_freetype_module(ModuleInitializationLevel p_level);
#endif // FREETYPE_REGISTER_TYPES_H #endif // FREETYPE_REGISTER_TYPES_H

View File

@ -111,7 +111,8 @@ static void _editor_init() {
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
void register_gdscript_types() { void initialize_gdscript_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
GDREGISTER_CLASS(GDScript); GDREGISTER_CLASS(GDScript);
script_language_gd = memnew(GDScriptLanguage); script_language_gd = memnew(GDScriptLanguage);
@ -125,17 +126,21 @@ void register_gdscript_types() {
gdscript_cache = memnew(GDScriptCache); gdscript_cache = memnew(GDScriptCache);
GDScriptUtilityFunctions::register_functions();
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
EditorNode::add_init_callback(_editor_init); EditorNode::add_init_callback(_editor_init);
gdscript_translation_parser_plugin.instantiate(); gdscript_translation_parser_plugin.instantiate();
EditorTranslationParser::get_singleton()->add_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD); EditorTranslationParser::get_singleton()->add_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD);
}
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
GDScriptUtilityFunctions::register_functions();
} }
void unregister_gdscript_types() { void uninitialize_gdscript_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
ScriptServer::unregister_language(script_language_gd); ScriptServer::unregister_language(script_language_gd);
if (gdscript_cache) { if (gdscript_cache) {
@ -152,15 +157,18 @@ void unregister_gdscript_types() {
ResourceSaver::remove_resource_format_saver(resource_saver_gd); ResourceSaver::remove_resource_format_saver(resource_saver_gd);
resource_saver_gd.unref(); resource_saver_gd.unref();
#ifdef TOOLS_ENABLED
EditorTranslationParser::get_singleton()->remove_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD);
gdscript_translation_parser_plugin.unref();
#endif // TOOLS_ENABLED
GDScriptParser::cleanup(); GDScriptParser::cleanup();
GDScriptUtilityFunctions::unregister_functions(); GDScriptUtilityFunctions::unregister_functions();
} }
#ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorTranslationParser::get_singleton()->remove_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD);
gdscript_translation_parser_plugin.unref();
}
#endif // TOOLS_ENABLED
}
#ifdef TESTS_ENABLED #ifdef TESTS_ENABLED
void test_tokenizer() { void test_tokenizer() {
GDScriptTests::test(GDScriptTests::TestType::TEST_TOKENIZER); GDScriptTests::test(GDScriptTests::TestType::TEST_TOKENIZER);

View File

@ -31,7 +31,9 @@
#ifndef GDSCRIPT_REGISTER_TYPES_H #ifndef GDSCRIPT_REGISTER_TYPES_H
#define GDSCRIPT_REGISTER_TYPES_H #define GDSCRIPT_REGISTER_TYPES_H
void register_gdscript_types(); #include "modules/register_module_types.h"
void unregister_gdscript_types();
void initialize_gdscript_module(ModuleInitializationLevel p_level);
void uninitialize_gdscript_module(ModuleInitializationLevel p_level);
#endif // GDSCRIPT_REGISTER_TYPES_H #endif // GDSCRIPT_REGISTER_TYPES_H

View File

@ -190,7 +190,11 @@ static String _get_cache_key_function_glsl(const RenderingDevice::Capabilities *
return version; return version;
} }
void preregister_glslang_types() { void initialize_glslang_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_CORE) {
return;
}
// Initialize in case it's not initialized. This is done once per thread // Initialize in case it's not initialized. This is done once per thread
// and it's safe to call multiple times. // and it's safe to call multiple times.
glslang::InitializeProcess(); glslang::InitializeProcess();
@ -198,9 +202,10 @@ void preregister_glslang_types() {
RenderingDevice::shader_set_get_cache_key_function(_get_cache_key_function_glsl); RenderingDevice::shader_set_get_cache_key_function(_get_cache_key_function_glsl);
} }
void register_glslang_types() { void uninitialize_glslang_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_CORE) {
return;
} }
void unregister_glslang_types() {
glslang::FinalizeProcess(); glslang::FinalizeProcess();
} }

View File

@ -33,8 +33,9 @@
#define MODULE_GLSLANG_HAS_PREREGISTER #define MODULE_GLSLANG_HAS_PREREGISTER
void preregister_glslang_types(); #include "modules/register_module_types.h"
void register_glslang_types();
void unregister_glslang_types(); void initialize_glslang_module(ModuleInitializationLevel p_level);
void uninitialize_glslang_module(ModuleInitializationLevel p_level);
#endif // GLSLANG_REGISTER_TYPES_H #endif // GLSLANG_REGISTER_TYPES_H

View File

@ -101,7 +101,8 @@ static void _editor_init() {
} }
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
void register_gltf_types() { void initialize_gltf_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
// glTF API available at runtime. // glTF API available at runtime.
GDREGISTER_CLASS(GLTFAccessor); GDREGISTER_CLASS(GLTFAccessor);
GDREGISTER_CLASS(GLTFAnimation); GDREGISTER_CLASS(GLTFAnimation);
@ -118,8 +119,10 @@ void register_gltf_types() {
GDREGISTER_CLASS(GLTFSpecGloss); GDREGISTER_CLASS(GLTFSpecGloss);
GDREGISTER_CLASS(GLTFState); GDREGISTER_CLASS(GLTFState);
GDREGISTER_CLASS(GLTFTexture); GDREGISTER_CLASS(GLTFTexture);
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
// Editor-specific API. // Editor-specific API.
ClassDB::APIType prev_api = ClassDB::get_current_api(); ClassDB::APIType prev_api = ClassDB::get_current_api();
ClassDB::set_current_api(ClassDB::API_EDITOR); ClassDB::set_current_api(ClassDB::API_EDITOR);
@ -135,11 +138,15 @@ void register_gltf_types() {
ClassDB::set_current_api(prev_api); ClassDB::set_current_api(prev_api);
EditorNode::add_init_callback(_editor_init); EditorNode::add_init_callback(_editor_init);
}
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
} }
void unregister_gltf_types() { void uninitialize_gltf_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }
#endif // _3D_DISABLED #endif // _3D_DISABLED

View File

@ -28,5 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
void register_gltf_types(); #include "modules/register_module_types.h"
void unregister_gltf_types();
void initialize_gltf_module(ModuleInitializationLevel p_level);
void uninitialize_gltf_module(ModuleInitializationLevel p_level);

View File

@ -39,14 +39,21 @@
#include "editor/grid_map_editor_plugin.h" #include "editor/grid_map_editor_plugin.h"
#endif #endif
void register_gridmap_types() { void initialize_gridmap_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
GDREGISTER_CLASS(GridMap); GDREGISTER_CLASS(GridMap);
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<GridMapEditorPlugin>(); EditorPlugins::add_by_type<GridMapEditorPlugin>();
}
#endif #endif
} }
void unregister_gridmap_types() { void uninitialize_gridmap_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }
#endif // _3D_DISABLED #endif // _3D_DISABLED

View File

@ -31,7 +31,9 @@
#ifndef GRIDMAP_REGISTER_TYPES_H #ifndef GRIDMAP_REGISTER_TYPES_H
#define GRIDMAP_REGISTER_TYPES_H #define GRIDMAP_REGISTER_TYPES_H
void register_gridmap_types(); #include "modules/register_module_types.h"
void unregister_gridmap_types();
void initialize_gridmap_module(ModuleInitializationLevel p_level);
void uninitialize_gridmap_module(ModuleInitializationLevel p_level);
#endif // GRIDMAP_REGISTER_TYPES_H #endif // GRIDMAP_REGISTER_TYPES_H

View File

@ -34,11 +34,19 @@
static ImageLoaderHDR *image_loader_hdr = nullptr; static ImageLoaderHDR *image_loader_hdr = nullptr;
void register_hdr_types() { void initialize_hdr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
image_loader_hdr = memnew(ImageLoaderHDR); image_loader_hdr = memnew(ImageLoaderHDR);
ImageLoader::add_image_format_loader(image_loader_hdr); ImageLoader::add_image_format_loader(image_loader_hdr);
} }
void unregister_hdr_types() { void uninitialize_hdr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
memdelete(image_loader_hdr); memdelete(image_loader_hdr);
} }

View File

@ -31,7 +31,9 @@
#ifndef HDR_REGISTER_TYPES_H #ifndef HDR_REGISTER_TYPES_H
#define HDR_REGISTER_TYPES_H #define HDR_REGISTER_TYPES_H
void register_hdr_types(); #include "modules/register_module_types.h"
void unregister_hdr_types();
void initialize_hdr_module(ModuleInitializationLevel p_level);
void uninitialize_hdr_module(ModuleInitializationLevel p_level);
#endif // HDR_REGISTER_TYPES_H #endif // HDR_REGISTER_TYPES_H

View File

@ -34,11 +34,19 @@
static ImageLoaderJPG *image_loader_jpg = nullptr; static ImageLoaderJPG *image_loader_jpg = nullptr;
void register_jpg_types() { void initialize_jpg_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
image_loader_jpg = memnew(ImageLoaderJPG); image_loader_jpg = memnew(ImageLoaderJPG);
ImageLoader::add_image_format_loader(image_loader_jpg); ImageLoader::add_image_format_loader(image_loader_jpg);
} }
void unregister_jpg_types() { void uninitialize_jpg_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
memdelete(image_loader_jpg); memdelete(image_loader_jpg);
} }

View File

@ -31,7 +31,9 @@
#ifndef JPG_REGISTER_TYPES_H #ifndef JPG_REGISTER_TYPES_H
#define JPG_REGISTER_TYPES_H #define JPG_REGISTER_TYPES_H
void register_jpg_types(); #include "modules/register_module_types.h"
void unregister_jpg_types();
void initialize_jpg_module(ModuleInitializationLevel p_level);
void uninitialize_jpg_module(ModuleInitializationLevel p_level);
#endif // JPG_REGISTER_TYPES_H #endif // JPG_REGISTER_TYPES_H

View File

@ -32,9 +32,16 @@
#include "core/object/class_db.h" #include "core/object/class_db.h"
#include "jsonrpc.h" #include "jsonrpc.h"
void register_jsonrpc_types() { void initialize_jsonrpc_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_CLASS(JSONRPC); GDREGISTER_CLASS(JSONRPC);
} }
void unregister_jsonrpc_types() { void uninitialize_jsonrpc_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,9 @@
#ifndef JSONRPC_REGISTER_TYPES_H #ifndef JSONRPC_REGISTER_TYPES_H
#define JSONRPC_REGISTER_TYPES_H #define JSONRPC_REGISTER_TYPES_H
void register_jsonrpc_types(); #include "modules/register_module_types.h"
void unregister_jsonrpc_types();
void initialize_jsonrpc_module(ModuleInitializationLevel p_level);
void uninitialize_jsonrpc_module(ModuleInitializationLevel p_level);
#endif // JSONRPC_REGISTER_TYPES_H #endif // JSONRPC_REGISTER_TYPES_H

View File

@ -40,7 +40,11 @@ static Lightmapper *create_lightmapper_rd() {
} }
#endif #endif
void register_lightmapper_rd_types() { void initialize_lightmapper_rd_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GLOBAL_DEF("rendering/lightmapping/bake_quality/low_quality_ray_count", 16); GLOBAL_DEF("rendering/lightmapping/bake_quality/low_quality_ray_count", 16);
GLOBAL_DEF("rendering/lightmapping/bake_quality/medium_quality_ray_count", 64); GLOBAL_DEF("rendering/lightmapping/bake_quality/medium_quality_ray_count", 64);
GLOBAL_DEF("rendering/lightmapping/bake_quality/high_quality_ray_count", 256); GLOBAL_DEF("rendering/lightmapping/bake_quality/high_quality_ray_count", 256);
@ -59,5 +63,8 @@ void register_lightmapper_rd_types() {
#endif #endif
} }
void unregister_lightmapper_rd_types() { void uninitialize_lightmapper_rd_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,9 @@
#ifndef LIGHTMAPPER_RD_REGISTER_TYPES_H #ifndef LIGHTMAPPER_RD_REGISTER_TYPES_H
#define LIGHTMAPPER_RD_REGISTER_TYPES_H #define LIGHTMAPPER_RD_REGISTER_TYPES_H
void register_lightmapper_rd_types(); #include "modules/register_module_types.h"
void unregister_lightmapper_rd_types();
void initialize_lightmapper_rd_module(ModuleInitializationLevel p_level);
void uninitialize_lightmapper_rd_module(ModuleInitializationLevel p_level);
#endif // XATLAS_UNWRAP_REGISTER_TYPES_H #endif // XATLAS_UNWRAP_REGISTER_TYPES_H

View File

@ -39,14 +39,22 @@
#include "tests/test_crypto_mbedtls.h" #include "tests/test_crypto_mbedtls.h"
#endif #endif
void register_mbedtls_types() { void initialize_mbedtls_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
CryptoMbedTLS::initialize_crypto(); CryptoMbedTLS::initialize_crypto();
StreamPeerMbedTLS::initialize_ssl(); StreamPeerMbedTLS::initialize_ssl();
PacketPeerMbedDTLS::initialize_dtls(); PacketPeerMbedDTLS::initialize_dtls();
DTLSServerMbedTLS::initialize(); DTLSServerMbedTLS::initialize();
} }
void unregister_mbedtls_types() { void uninitialize_mbedtls_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
DTLSServerMbedTLS::finalize(); DTLSServerMbedTLS::finalize();
PacketPeerMbedDTLS::finalize_dtls(); PacketPeerMbedDTLS::finalize_dtls();
StreamPeerMbedTLS::finalize_ssl(); StreamPeerMbedTLS::finalize_ssl();

View File

@ -31,7 +31,9 @@
#ifndef MBEDTLS_REGISTER_TYPES_H #ifndef MBEDTLS_REGISTER_TYPES_H
#define MBEDTLS_REGISTER_TYPES_H #define MBEDTLS_REGISTER_TYPES_H
void register_mbedtls_types(); #include "modules/register_module_types.h"
void unregister_mbedtls_types();
void initialize_mbedtls_module(ModuleInitializationLevel p_level);
void uninitialize_mbedtls_module(ModuleInitializationLevel p_level);
#endif // MBEDTLS_REGISTER_TYPES_H #endif // MBEDTLS_REGISTER_TYPES_H

View File

@ -32,7 +32,11 @@
#include "scene/resources/surface_tool.h" #include "scene/resources/surface_tool.h"
#include "thirdparty/meshoptimizer/meshoptimizer.h" #include "thirdparty/meshoptimizer/meshoptimizer.h"
void register_meshoptimizer_types() { void initialize_meshoptimizer_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
SurfaceTool::optimize_vertex_cache_func = meshopt_optimizeVertexCache; SurfaceTool::optimize_vertex_cache_func = meshopt_optimizeVertexCache;
SurfaceTool::simplify_func = meshopt_simplify; SurfaceTool::simplify_func = meshopt_simplify;
SurfaceTool::simplify_with_attrib_func = meshopt_simplifyWithAttributes; SurfaceTool::simplify_with_attrib_func = meshopt_simplifyWithAttributes;
@ -43,7 +47,11 @@ void register_meshoptimizer_types() {
SurfaceTool::remap_index_func = meshopt_remapIndexBuffer; SurfaceTool::remap_index_func = meshopt_remapIndexBuffer;
} }
void unregister_meshoptimizer_types() { void uninitialize_meshoptimizer_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
SurfaceTool::optimize_vertex_cache_func = nullptr; SurfaceTool::optimize_vertex_cache_func = nullptr;
SurfaceTool::simplify_func = nullptr; SurfaceTool::simplify_func = nullptr;
SurfaceTool::simplify_scale_func = nullptr; SurfaceTool::simplify_scale_func = nullptr;

View File

@ -31,7 +31,9 @@
#ifndef MESHOPTIMIZER_REGISTER_TYPES_H #ifndef MESHOPTIMIZER_REGISTER_TYPES_H
#define MESHOPTIMIZER_REGISTER_TYPES_H #define MESHOPTIMIZER_REGISTER_TYPES_H
void register_meshoptimizer_types(); #include "modules/register_module_types.h"
void unregister_meshoptimizer_types();
void initialize_meshoptimizer_module(ModuleInitializationLevel p_level);
void uninitialize_meshoptimizer_module(ModuleInitializationLevel p_level);
#endif // PVR_REGISTER_TYPES_H #endif // PVR_REGISTER_TYPES_H

View File

@ -37,7 +37,11 @@
#include "resource_importer_mp3.h" #include "resource_importer_mp3.h"
#endif #endif
void register_minimp3_types() { void initialize_minimp3_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) { if (Engine::get_singleton()->is_editor_hint()) {
Ref<ResourceImporterMP3> mp3_import; Ref<ResourceImporterMP3> mp3_import;
@ -48,5 +52,8 @@ void register_minimp3_types() {
GDREGISTER_CLASS(AudioStreamMP3); GDREGISTER_CLASS(AudioStreamMP3);
} }
void unregister_minimp3_types() { void uninitialize_minimp3_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,9 @@
#ifndef MINIMP3_REGISTER_TYPES_H #ifndef MINIMP3_REGISTER_TYPES_H
#define MINIMP3_REGISTER_TYPES_H #define MINIMP3_REGISTER_TYPES_H
void register_minimp3_types(); #include "modules/register_module_types.h"
void unregister_minimp3_types();
void initialize_minimp3_module(ModuleInitializationLevel p_level);
void uninitialize_minimp3_module(ModuleInitializationLevel p_level);
#endif // MINIMP3_REGISTER_TYPES_H #endif // MINIMP3_REGISTER_TYPES_H

View File

@ -34,7 +34,11 @@
Ref<MobileVRInterface> mobile_vr; Ref<MobileVRInterface> mobile_vr;
void register_mobile_vr_types() { void initialize_mobile_vr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_CLASS(MobileVRInterface); GDREGISTER_CLASS(MobileVRInterface);
if (XRServer::get_singleton()) { if (XRServer::get_singleton()) {
@ -43,7 +47,11 @@ void register_mobile_vr_types() {
} }
} }
void unregister_mobile_vr_types() { void uninitialize_mobile_vr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
if (mobile_vr.is_valid()) { if (mobile_vr.is_valid()) {
// uninitialise our interface if it is initialised // uninitialise our interface if it is initialised
if (mobile_vr->is_initialized()) { if (mobile_vr->is_initialized()) {

View File

@ -31,7 +31,9 @@
#ifndef MOBILE_VR_REGISTER_TYPES_H #ifndef MOBILE_VR_REGISTER_TYPES_H
#define MOBILE_VR_REGISTER_TYPES_H #define MOBILE_VR_REGISTER_TYPES_H
void register_mobile_vr_types(); #include "modules/register_module_types.h"
void unregister_mobile_vr_types();
void initialize_mobile_vr_module(ModuleInitializationLevel p_level);
void uninitialize_mobile_vr_module(ModuleInitializationLevel p_level);
#endif // MOBILE_VR_REGISTER_TYPES_H #endif // MOBILE_VR_REGISTER_TYPES_H

View File

@ -40,7 +40,11 @@ Ref<ResourceFormatSaverCSharpScript> resource_saver_cs;
mono_bind::GodotSharp *_godotsharp = nullptr; mono_bind::GodotSharp *_godotsharp = nullptr;
void register_mono_types() { void initialize_mono_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_CLASS(CSharpScript); GDREGISTER_CLASS(CSharpScript);
_godotsharp = memnew(mono_bind::GodotSharp); _godotsharp = memnew(mono_bind::GodotSharp);
@ -59,7 +63,11 @@ void register_mono_types() {
ResourceSaver::add_resource_format_saver(resource_saver_cs); ResourceSaver::add_resource_format_saver(resource_saver_cs);
} }
void unregister_mono_types() { void uninitialize_mono_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
ScriptServer::unregister_language(script_language_cs); ScriptServer::unregister_language(script_language_cs);
if (script_language_cs) { if (script_language_cs) {

View File

@ -31,7 +31,9 @@
#ifndef MONO_REGISTER_TYPES_H #ifndef MONO_REGISTER_TYPES_H
#define MONO_REGISTER_TYPES_H #define MONO_REGISTER_TYPES_H
void register_mono_types(); #include "modules/register_module_types.h"
void unregister_mono_types();
void initialize_mono_module(ModuleInitializationLevel p_level);
void uninitialize_mono_module(ModuleInitializationLevel p_level);
#endif // MONO_REGISTER_TYPES_H #endif // MONO_REGISTER_TYPES_H

View File

@ -30,6 +30,14 @@
#include "register_types.h" #include "register_types.h"
void register_msdfgen_types() {} void initialize_msdfgen_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}
void unregister_msdfgen_types() {} void uninitialize_msdfgen_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}

View File

@ -31,7 +31,9 @@
#ifndef MSDFGEN_REGISTER_TYPES_H #ifndef MSDFGEN_REGISTER_TYPES_H
#define MSDFGEN_REGISTER_TYPES_H #define MSDFGEN_REGISTER_TYPES_H
void register_msdfgen_types(); #include "modules/register_module_types.h"
void unregister_msdfgen_types();
void initialize_msdfgen_module(ModuleInitializationLevel p_level);
void uninitialize_msdfgen_module(ModuleInitializationLevel p_level);
#endif // MSDFGEN_REGISTER_TYPES_H #endif // MSDFGEN_REGISTER_TYPES_H

View File

@ -51,7 +51,8 @@ NavigationServer3D *new_server() {
return memnew(GodotNavigationServer); return memnew(GodotNavigationServer);
} }
void register_navigation_types() { void initialize_navigation_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
NavigationServer3DManager::set_default_server(new_server); NavigationServer3DManager::set_default_server(new_server);
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
@ -59,13 +60,20 @@ void register_navigation_types() {
GDREGISTER_CLASS(NavigationMeshGenerator); GDREGISTER_CLASS(NavigationMeshGenerator);
Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", NavigationMeshGenerator::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", NavigationMeshGenerator::get_singleton()));
#endif #endif
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<NavigationMeshEditorPlugin>(); EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
}
#endif #endif
} }
void unregister_navigation_types() { void uninitialize_navigation_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
return;
}
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
if (_nav_mesh_generator) { if (_nav_mesh_generator) {
memdelete(_nav_mesh_generator); memdelete(_nav_mesh_generator);

View File

@ -31,7 +31,9 @@
#ifndef NAVIGATION_REGISTER_TYPES_H #ifndef NAVIGATION_REGISTER_TYPES_H
#define NAVIGATION_REGISTER_TYPES_H #define NAVIGATION_REGISTER_TYPES_H
void register_navigation_types(); #include "modules/register_module_types.h"
void unregister_navigation_types();
void initialize_navigation_module(ModuleInitializationLevel p_level);
void uninitialize_navigation_module(ModuleInitializationLevel p_level);
#endif // NAVIGATION_REGISTER_TYPES_H #endif // NAVIGATION_REGISTER_TYPES_H

View File

@ -39,15 +39,22 @@
#include "editor/noise_editor_plugin.h" #include "editor/noise_editor_plugin.h"
#endif #endif
void register_noise_types() { void initialize_noise_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
GDREGISTER_CLASS(NoiseTexture); GDREGISTER_CLASS(NoiseTexture);
GDREGISTER_ABSTRACT_CLASS(Noise); GDREGISTER_ABSTRACT_CLASS(Noise);
GDREGISTER_CLASS(FastNoiseLite); GDREGISTER_CLASS(FastNoiseLite);
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<NoiseEditorPlugin>(); EditorPlugins::add_by_type<NoiseEditorPlugin>();
}
#endif #endif
} }
void unregister_noise_types() { void uninitialize_noise_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,9 @@
#ifndef NOISE_REGISTER_TYPES_H #ifndef NOISE_REGISTER_TYPES_H
#define NOISE_REGISTER_TYPES_H #define NOISE_REGISTER_TYPES_H
void register_noise_types(); #include "modules/register_module_types.h"
void unregister_noise_types();
void initialize_noise_module(ModuleInitializationLevel p_level);
void uninitialize_noise_module(ModuleInitializationLevel p_level);
#endif // NOISE_REGISTER_TYPES_H #endif // NOISE_REGISTER_TYPES_H

View File

@ -32,9 +32,17 @@
#include "ogg_packet_sequence.h" #include "ogg_packet_sequence.h"
void register_ogg_types() { void initialize_ogg_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_CLASS(OGGPacketSequence); GDREGISTER_CLASS(OGGPacketSequence);
GDREGISTER_CLASS(OGGPacketSequencePlayback); GDREGISTER_CLASS(OGGPacketSequencePlayback);
} }
void unregister_ogg_types() {} void uninitialize_ogg_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}

View File

@ -31,7 +31,9 @@
#ifndef OGG_REGISTER_TYPES_H #ifndef OGG_REGISTER_TYPES_H
#define OGG_REGISTER_TYPES_H #define OGG_REGISTER_TYPES_H
void register_ogg_types(); #include "modules/register_module_types.h"
void unregister_ogg_types();
void initialize_ogg_module(ModuleInitializationLevel p_level);
void uninitialize_ogg_module(ModuleInitializationLevel p_level);
#endif // OGG_REGISTER_TYPES_H #endif // OGG_REGISTER_TYPES_H

View File

@ -54,10 +54,11 @@ static void _editor_init() {
#endif #endif
OpenXRAPI *openxr_api = nullptr; static OpenXRAPI *openxr_api = nullptr;
Ref<OpenXRInterface> openxr_interface; static Ref<OpenXRInterface> openxr_interface;
void preregister_openxr_types() { void initialize_openxr_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
// For now we create our openxr device here. If we merge it with openxr_interface we'll create that here soon. // For now we create our openxr device here. If we merge it with openxr_interface we'll create that here soon.
if (OpenXRAPI::openxr_is_enabled()) { if (OpenXRAPI::openxr_is_enabled()) {
@ -72,7 +73,7 @@ void preregister_openxr_types() {
} }
} }
void register_openxr_types() { if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
GDREGISTER_CLASS(OpenXRInterface); GDREGISTER_CLASS(OpenXRInterface);
GDREGISTER_CLASS(OpenXRAction); GDREGISTER_CLASS(OpenXRAction);
@ -95,8 +96,13 @@ void register_openxr_types() {
EditorNode::add_init_callback(_editor_init); EditorNode::add_init_callback(_editor_init);
#endif #endif
} }
}
void uninitialize_openxr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
void unregister_openxr_types() {
if (openxr_interface.is_valid()) { if (openxr_interface.is_valid()) {
// uninitialize just in case // uninitialize just in case
if (openxr_interface->is_initialized()) { if (openxr_interface->is_initialized()) {

View File

@ -33,8 +33,9 @@
#define MODULE_OPENXR_HAS_PREREGISTER #define MODULE_OPENXR_HAS_PREREGISTER
void preregister_openxr_types(); #include "modules/register_module_types.h"
void register_openxr_types();
void unregister_openxr_types(); void initialize_openxr_module(ModuleInitializationLevel p_level);
void uninitialize_openxr_module(ModuleInitializationLevel p_level);
#endif // OPENXR_REGISTER_TYPES_H #endif // OPENXR_REGISTER_TYPES_H

View File

@ -36,7 +36,11 @@
RaycastOcclusionCull *raycast_occlusion_cull = nullptr; RaycastOcclusionCull *raycast_occlusion_cull = nullptr;
void register_raycast_types() { void initialize_raycast_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
LightmapRaycasterEmbree::make_default_raycaster(); LightmapRaycasterEmbree::make_default_raycaster();
StaticRaycasterEmbree::make_default_raycaster(); StaticRaycasterEmbree::make_default_raycaster();
@ -44,7 +48,11 @@ void register_raycast_types() {
raycast_occlusion_cull = memnew(RaycastOcclusionCull); raycast_occlusion_cull = memnew(RaycastOcclusionCull);
} }
void unregister_raycast_types() { void uninitialize_raycast_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
if (raycast_occlusion_cull) { if (raycast_occlusion_cull) {
memdelete(raycast_occlusion_cull); memdelete(raycast_occlusion_cull);
} }

View File

@ -28,5 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
void register_raycast_types(); #include "modules/register_module_types.h"
void unregister_raycast_types();
void initialize_raycast_module(ModuleInitializationLevel p_level);
void uninitialize_raycast_module(ModuleInitializationLevel p_level);

View File

@ -32,10 +32,17 @@
#include "core/object/class_db.h" #include "core/object/class_db.h"
#include "regex.h" #include "regex.h"
void register_regex_types() { void initialize_regex_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_CLASS(RegExMatch); GDREGISTER_CLASS(RegExMatch);
GDREGISTER_CLASS(RegEx); GDREGISTER_CLASS(RegEx);
} }
void unregister_regex_types() { void uninitialize_regex_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,9 @@
#ifndef REGEX_REGISTER_TYPES_H #ifndef REGEX_REGISTER_TYPES_H
#define REGEX_REGISTER_TYPES_H #define REGEX_REGISTER_TYPES_H
void register_regex_types(); #include "modules/register_module_types.h"
void unregister_regex_types();
void initialize_regex_module(ModuleInitializationLevel p_level);
void uninitialize_regex_module(ModuleInitializationLevel p_level);
#endif // REGEX_REGISTER_TYPES_H #endif // REGEX_REGISTER_TYPES_H

View File

@ -31,8 +31,16 @@
#ifndef REGISTER_MODULE_TYPES_H #ifndef REGISTER_MODULE_TYPES_H
#define REGISTER_MODULE_TYPES_H #define REGISTER_MODULE_TYPES_H
void preregister_module_types(); #include "core/extension/gdnative_interface.h"
void register_module_types();
void unregister_module_types(); enum ModuleInitializationLevel {
MODULE_INITIALIZATION_LEVEL_CORE = GDNATIVE_INITIALIZATION_CORE,
MODULE_INITIALIZATION_LEVEL_SERVERS = GDNATIVE_INITIALIZATION_SERVERS,
MODULE_INITIALIZATION_LEVEL_SCENE = GDNATIVE_INITIALIZATION_SCENE,
MODULE_INITIALIZATION_LEVEL_EDITOR = GDNATIVE_INITIALIZATION_EDITOR
};
void initialize_modules(ModuleInitializationLevel p_level);
void uninitialize_modules(ModuleInitializationLevel p_level);
#endif // REGISTER_MODULE_TYPES_H #endif // REGISTER_MODULE_TYPES_H

View File

@ -32,8 +32,16 @@
#include "image_decompress_squish.h" #include "image_decompress_squish.h"
void register_squish_types() { void initialize_squish_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
Image::_image_decompress_bc = image_decompress_squish; Image::_image_decompress_bc = image_decompress_squish;
} }
void unregister_squish_types() {} void uninitialize_squish_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}

View File

@ -31,7 +31,9 @@
#ifndef SQUISH_REGISTER_TYPES_H #ifndef SQUISH_REGISTER_TYPES_H
#define SQUISH_REGISTER_TYPES_H #define SQUISH_REGISTER_TYPES_H
void register_squish_types(); #include "modules/register_module_types.h"
void unregister_squish_types();
void initialize_squish_module(ModuleInitializationLevel p_level);
void uninitialize_squish_module(ModuleInitializationLevel p_level);
#endif // SQUISH_REGISTER_TYPES_H #endif // SQUISH_REGISTER_TYPES_H

View File

@ -36,7 +36,11 @@
static ImageLoaderSVG *image_loader_svg = nullptr; static ImageLoaderSVG *image_loader_svg = nullptr;
void register_svg_types() { void initialize_svg_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
tvg::CanvasEngine tvgEngine = tvg::CanvasEngine::Sw; tvg::CanvasEngine tvgEngine = tvg::CanvasEngine::Sw;
if (tvg::Initializer::init(tvgEngine, 1) != tvg::Result::Success) { if (tvg::Initializer::init(tvgEngine, 1) != tvg::Result::Success) {
return; return;
@ -45,7 +49,11 @@ void register_svg_types() {
ImageLoader::add_image_format_loader(image_loader_svg); ImageLoader::add_image_format_loader(image_loader_svg);
} }
void unregister_svg_types() { void uninitialize_svg_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
if (!image_loader_svg) { if (!image_loader_svg) {
return; return;
} }

View File

@ -31,7 +31,9 @@
#ifndef SVG_REGISTER_TYPES_H #ifndef SVG_REGISTER_TYPES_H
#define SVG_REGISTER_TYPES_H #define SVG_REGISTER_TYPES_H
void register_svg_types(); #include "modules/register_module_types.h"
void unregister_svg_types();
void initialize_svg_module(ModuleInitializationLevel p_level);
void uninitialize_svg_module(ModuleInitializationLevel p_level);
#endif // SVG_REGISTER_TYPES_H #endif // SVG_REGISTER_TYPES_H

View File

@ -32,7 +32,11 @@
#include "text_server_adv.h" #include "text_server_adv.h"
void preregister_text_server_adv_types() { void initialize_text_server_adv_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
return;
}
GDREGISTER_CLASS(TextServerAdvanced); GDREGISTER_CLASS(TextServerAdvanced);
TextServerManager *tsman = TextServerManager::get_singleton(); TextServerManager *tsman = TextServerManager::get_singleton();
if (tsman) { if (tsman) {
@ -42,10 +46,10 @@ void preregister_text_server_adv_types() {
} }
} }
void register_text_server_adv_types() { void uninitialize_text_server_adv_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
return;
} }
void unregister_text_server_adv_types() {
} }
#ifdef GDEXTENSION #ifdef GDEXTENSION
@ -61,8 +65,9 @@ extern "C" {
GDNativeBool GDN_EXPORT textserver_advanced_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) { GDNativeBool GDN_EXPORT textserver_advanced_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
init_obj.register_server_initializer(&preregister_text_server_adv_types); init_obj.register_initializer(&initialize_text_server_adv_module);
init_obj.register_server_terminator(&unregister_text_server_adv_types); init_obj.register_terminator(&uninitialize_text_server_adv_module);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SERVERS);
return init_obj.init(); return init_obj.init();
} }

View File

@ -31,10 +31,14 @@
#ifndef TEXT_SERVER_ADV_REGISTER_TYPES_H #ifndef TEXT_SERVER_ADV_REGISTER_TYPES_H
#define TEXT_SERVER_ADV_REGISTER_TYPES_H #define TEXT_SERVER_ADV_REGISTER_TYPES_H
#define MODULE_TEXT_SERVER_ADV_HAS_PREREGISTER #ifdef GDEXTENSION
#include <godot_cpp/core/class_db.hpp>
using namespace godot;
#else
#include "modules/register_module_types.h"
#endif
void preregister_text_server_adv_types(); void initialize_text_server_adv_module(ModuleInitializationLevel p_level);
void register_text_server_adv_types(); void uninitialize_text_server_adv_module(ModuleInitializationLevel p_level);
void unregister_text_server_adv_types();
#endif // TEXT_SERVER_ADV_REGISTER_TYPES_H #endif // TEXT_SERVER_ADV_REGISTER_TYPES_H

View File

@ -32,7 +32,11 @@
#include "text_server_fb.h" #include "text_server_fb.h"
void preregister_text_server_fb_types() { void initialize_text_server_fb_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
return;
}
GDREGISTER_CLASS(TextServerFallback); GDREGISTER_CLASS(TextServerFallback);
TextServerManager *tsman = TextServerManager::get_singleton(); TextServerManager *tsman = TextServerManager::get_singleton();
if (tsman) { if (tsman) {
@ -42,10 +46,10 @@ void preregister_text_server_fb_types() {
} }
} }
void register_text_server_fb_types() { void uninitialize_text_server_fb_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
return;
} }
void unregister_text_server_fb_types() {
} }
#ifdef GDEXTENSION #ifdef GDEXTENSION
@ -61,8 +65,9 @@ extern "C" {
GDNativeBool GDN_EXPORT textserver_fallback_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) { GDNativeBool GDN_EXPORT textserver_fallback_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
init_obj.register_server_initializer(&preregister_text_server_fb_types); init_obj.register_initializer(&initialize_text_server_fb_module);
init_obj.register_server_terminator(&unregister_text_server_fb_types); init_obj.register_terminator(&uninitialize_text_server_fb_module);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SERVERS);
return init_obj.init(); return init_obj.init();
} }

View File

@ -31,10 +31,14 @@
#ifndef TEXT_SERVER_FB_REGISTER_TYPES_H #ifndef TEXT_SERVER_FB_REGISTER_TYPES_H
#define TEXT_SERVER_FB_REGISTER_TYPES_H #define TEXT_SERVER_FB_REGISTER_TYPES_H
#define MODULE_TEXT_SERVER_FB_HAS_PREREGISTER #ifdef GDEXTENSION
#include <godot_cpp/core/class_db.hpp>
using namespace godot;
#else
#include "modules/register_module_types.h"
#endif
void preregister_text_server_fb_types(); void initialize_text_server_fb_module(ModuleInitializationLevel p_level);
void register_text_server_fb_types(); void uninitialize_text_server_fb_module(ModuleInitializationLevel p_level);
void unregister_text_server_fb_types();
#endif // TEXT_SERVER_FB_REGISTER_TYPES_H #endif // TEXT_SERVER_FB_REGISTER_TYPES_H

View File

@ -34,11 +34,19 @@
static ImageLoaderTGA *image_loader_tga = nullptr; static ImageLoaderTGA *image_loader_tga = nullptr;
void register_tga_types() { void initialize_tga_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
image_loader_tga = memnew(ImageLoaderTGA); image_loader_tga = memnew(ImageLoaderTGA);
ImageLoader::add_image_format_loader(image_loader_tga); ImageLoader::add_image_format_loader(image_loader_tga);
} }
void unregister_tga_types() { void uninitialize_tga_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
memdelete(image_loader_tga); memdelete(image_loader_tga);
} }

View File

@ -31,7 +31,9 @@
#ifndef TGA_REGISTER_TYPES_H #ifndef TGA_REGISTER_TYPES_H
#define TGA_REGISTER_TYPES_H #define TGA_REGISTER_TYPES_H
void register_tga_types(); #include "modules/register_module_types.h"
void unregister_tga_types();
void initialize_tga_module(ModuleInitializationLevel p_level);
void uninitialize_tga_module(ModuleInitializationLevel p_level);
#endif // TGA_REGISTER_TYPES_H #endif // TGA_REGISTER_TYPES_H

View File

@ -34,14 +34,22 @@
static Ref<ResourceFormatLoaderTheora> resource_loader_theora; static Ref<ResourceFormatLoaderTheora> resource_loader_theora;
void register_theora_types() { void initialize_theora_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
resource_loader_theora.instantiate(); resource_loader_theora.instantiate();
ResourceLoader::add_resource_format_loader(resource_loader_theora, true); ResourceLoader::add_resource_format_loader(resource_loader_theora, true);
GDREGISTER_CLASS(VideoStreamTheora); GDREGISTER_CLASS(VideoStreamTheora);
} }
void unregister_theora_types() { void uninitialize_theora_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
ResourceLoader::remove_resource_format_loader(resource_loader_theora); ResourceLoader::remove_resource_format_loader(resource_loader_theora);
resource_loader_theora.unref(); resource_loader_theora.unref();
} }

View File

@ -31,7 +31,9 @@
#ifndef THEORA_REGISTER_TYPES_H #ifndef THEORA_REGISTER_TYPES_H
#define THEORA_REGISTER_TYPES_H #define THEORA_REGISTER_TYPES_H
void register_theora_types(); #include "modules/register_module_types.h"
void unregister_theora_types();
void initialize_theora_module(ModuleInitializationLevel p_level);
void uninitialize_theora_module(ModuleInitializationLevel p_level);
#endif // THEORA_REGISTER_TYPES_H #endif // THEORA_REGISTER_TYPES_H

View File

@ -35,14 +35,22 @@
static ImageLoaderTinyEXR *image_loader_tinyexr = nullptr; static ImageLoaderTinyEXR *image_loader_tinyexr = nullptr;
void register_tinyexr_types() { void initialize_tinyexr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
image_loader_tinyexr = memnew(ImageLoaderTinyEXR); image_loader_tinyexr = memnew(ImageLoaderTinyEXR);
ImageLoader::add_image_format_loader(image_loader_tinyexr); ImageLoader::add_image_format_loader(image_loader_tinyexr);
Image::save_exr_func = save_exr; Image::save_exr_func = save_exr;
} }
void unregister_tinyexr_types() { void uninitialize_tinyexr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
memdelete(image_loader_tinyexr); memdelete(image_loader_tinyexr);
Image::save_exr_func = nullptr; Image::save_exr_func = nullptr;

View File

@ -31,7 +31,9 @@
#ifndef TINYEXR_REGISTER_TYPES_H #ifndef TINYEXR_REGISTER_TYPES_H
#define TINYEXR_REGISTER_TYPES_H #define TINYEXR_REGISTER_TYPES_H
void register_tinyexr_types(); #include "modules/register_module_types.h"
void unregister_tinyexr_types();
void initialize_tinyexr_module(ModuleInitializationLevel p_level);
void uninitialize_tinyexr_module(ModuleInitializationLevel p_level);
#endif // TINYEXR_REGISTER_TYPES_H #endif // TINYEXR_REGISTER_TYPES_H

View File

@ -35,10 +35,17 @@
#include "upnp.h" #include "upnp.h"
#include "upnp_device.h" #include "upnp_device.h"
void register_upnp_types() { void initialize_upnp_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_CLASS(UPNP); GDREGISTER_CLASS(UPNP);
GDREGISTER_CLASS(UPNPDevice); GDREGISTER_CLASS(UPNPDevice);
} }
void unregister_upnp_types() { void uninitialize_upnp_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

View File

@ -31,7 +31,9 @@
#ifndef UPNP_REGISTER_TYPES_H #ifndef UPNP_REGISTER_TYPES_H
#define UPNP_REGISTER_TYPES_H #define UPNP_REGISTER_TYPES_H
void register_upnp_types(); #include "modules/register_module_types.h"
void unregister_upnp_types();
void initialize_upnp_module(ModuleInitializationLevel p_level);
void uninitialize_upnp_module(ModuleInitializationLevel p_level);
#endif // UPNP_REGISTER_TYPES_H #endif // UPNP_REGISTER_TYPES_H

View File

@ -89,10 +89,18 @@ static Vector<Vector<Vector3>> convex_decompose(const real_t *p_vertices, int p_
return ret; return ret;
} }
void register_vhacd_types() { void initialize_vhacd_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
Mesh::convex_decomposition_function = convex_decompose; Mesh::convex_decomposition_function = convex_decompose;
} }
void unregister_vhacd_types() { void uninitialize_vhacd_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
Mesh::convex_decomposition_function = nullptr; Mesh::convex_decomposition_function = nullptr;
} }

View File

@ -31,7 +31,9 @@
#ifndef VHACD_REGISTER_TYPES_H #ifndef VHACD_REGISTER_TYPES_H
#define VHACD_REGISTER_TYPES_H #define VHACD_REGISTER_TYPES_H
void register_vhacd_types(); #include "modules/register_module_types.h"
void unregister_vhacd_types();
void initialize_vhacd_module(ModuleInitializationLevel p_level);
void uninitialize_vhacd_module(ModuleInitializationLevel p_level);
#endif // VHACD_REGISTER_TYPES_H #endif // VHACD_REGISTER_TYPES_H

View File

@ -47,7 +47,8 @@ VisualScriptLanguage *visual_script_language = nullptr;
static VisualScriptCustomNodes *vs_custom_nodes_singleton = nullptr; static VisualScriptCustomNodes *vs_custom_nodes_singleton = nullptr;
#endif #endif
void register_visual_script_types() { void initialize_visual_script_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
visual_script_language = memnew(VisualScriptLanguage); visual_script_language = memnew(VisualScriptLanguage);
//script_language_gd->init(); //script_language_gd->init();
ScriptServer::register_language(visual_script_language); ScriptServer::register_language(visual_script_language);
@ -112,8 +113,10 @@ void register_visual_script_types() {
register_visual_script_flow_control_nodes(); register_visual_script_flow_control_nodes();
register_visual_script_yield_nodes(); register_visual_script_yield_nodes();
register_visual_script_expression_node(); register_visual_script_expression_node();
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
ClassDB::set_current_api(ClassDB::API_EDITOR); ClassDB::set_current_api(ClassDB::API_EDITOR);
GDREGISTER_CLASS(VisualScriptCustomNodes); GDREGISTER_CLASS(VisualScriptCustomNodes);
ClassDB::set_current_api(ClassDB::API_CORE); ClassDB::set_current_api(ClassDB::API_CORE);
@ -121,21 +124,27 @@ void register_visual_script_types() {
Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptCustomNodes", VisualScriptCustomNodes::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptCustomNodes", VisualScriptCustomNodes::get_singleton()));
VisualScriptEditor::register_editor(); VisualScriptEditor::register_editor();
}
#endif #endif
} }
void unregister_visual_script_types() { void uninitialize_visual_script_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
unregister_visual_script_nodes(); unregister_visual_script_nodes();
ScriptServer::unregister_language(visual_script_language); ScriptServer::unregister_language(visual_script_language);
#ifdef TOOLS_ENABLED
VisualScriptEditor::free_clipboard();
if (vs_custom_nodes_singleton) {
memdelete(vs_custom_nodes_singleton);
}
#endif
if (visual_script_language) { if (visual_script_language) {
memdelete(visual_script_language); memdelete(visual_script_language);
} }
} }
#ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
VisualScriptEditor::free_clipboard();
if (vs_custom_nodes_singleton) {
memdelete(vs_custom_nodes_singleton);
}
}
#endif
}

View File

@ -31,7 +31,9 @@
#ifndef VISUAL_SCRIPT_REGISTER_TYPES_H #ifndef VISUAL_SCRIPT_REGISTER_TYPES_H
#define VISUAL_SCRIPT_REGISTER_TYPES_H #define VISUAL_SCRIPT_REGISTER_TYPES_H
void register_visual_script_types(); #include "modules/register_module_types.h"
void unregister_visual_script_types();
void initialize_visual_script_module(ModuleInitializationLevel p_level);
void uninitialize_visual_script_module(ModuleInitializationLevel p_level);
#endif // VISUAL_SCRIPT_REGISTER_TYPES_H #endif // VISUAL_SCRIPT_REGISTER_TYPES_H

View File

@ -33,7 +33,11 @@
#include "audio_stream_ogg_vorbis.h" #include "audio_stream_ogg_vorbis.h"
#include "resource_importer_ogg_vorbis.h" #include "resource_importer_ogg_vorbis.h"
void register_vorbis_types() { void initialize_vorbis_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) { if (Engine::get_singleton()->is_editor_hint()) {
Ref<ResourceImporterOGGVorbis> ogg_vorbis_importer; Ref<ResourceImporterOGGVorbis> ogg_vorbis_importer;
@ -45,4 +49,8 @@ void register_vorbis_types() {
GDREGISTER_CLASS(AudioStreamPlaybackOGGVorbis); GDREGISTER_CLASS(AudioStreamPlaybackOGGVorbis);
} }
void unregister_vorbis_types() {} void uninitialize_vorbis_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}

View File

@ -31,7 +31,9 @@
#ifndef VORBIS_REGISTER_TYPES_H #ifndef VORBIS_REGISTER_TYPES_H
#define VORBIS_REGISTER_TYPES_H #define VORBIS_REGISTER_TYPES_H
void register_vorbis_types(); #include "modules/register_module_types.h"
void unregister_vorbis_types();
void initialize_vorbis_module(ModuleInitializationLevel p_level);
void uninitialize_vorbis_module(ModuleInitializationLevel p_level);
#endif // VORBIS_REGISTER_TYPES_H #endif // VORBIS_REGISTER_TYPES_H

View File

@ -34,11 +34,19 @@
static ImageLoaderWEBP *image_loader_webp = nullptr; static ImageLoaderWEBP *image_loader_webp = nullptr;
void register_webp_types() { void initialize_webp_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
image_loader_webp = memnew(ImageLoaderWEBP); image_loader_webp = memnew(ImageLoaderWEBP);
ImageLoader::add_image_format_loader(image_loader_webp); ImageLoader::add_image_format_loader(image_loader_webp);
} }
void unregister_webp_types() { void uninitialize_webp_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
memdelete(image_loader_webp); memdelete(image_loader_webp);
} }

View File

@ -31,7 +31,9 @@
#ifndef WEBP_REGISTER_TYPES_H #ifndef WEBP_REGISTER_TYPES_H
#define WEBP_REGISTER_TYPES_H #define WEBP_REGISTER_TYPES_H
void register_webp_types(); #include "modules/register_module_types.h"
void unregister_webp_types();
void initialize_webp_module(ModuleInitializationLevel p_level);
void uninitialize_webp_module(ModuleInitializationLevel p_level);
#endif // WEBP_REGISTER_TYPES_H #endif // WEBP_REGISTER_TYPES_H

View File

@ -37,7 +37,11 @@
#include "webrtc_data_channel_extension.h" #include "webrtc_data_channel_extension.h"
#include "webrtc_peer_connection_extension.h" #include "webrtc_peer_connection_extension.h"
void register_webrtc_types() { void initialize_webrtc_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
#define SET_HINT(NAME, _VAL_, _MAX_) \ #define SET_HINT(NAME, _VAL_, _MAX_) \
GLOBAL_DEF(NAME, _VAL_); \ GLOBAL_DEF(NAME, _VAL_); \
ProjectSettings::get_singleton()->set_custom_property_info(NAME, PropertyInfo(Variant::INT, NAME, PROPERTY_HINT_RANGE, "2," #_MAX_ ",1,or_greater")); ProjectSettings::get_singleton()->set_custom_property_info(NAME, PropertyInfo(Variant::INT, NAME, PROPERTY_HINT_RANGE, "2," #_MAX_ ",1,or_greater"));
@ -55,4 +59,8 @@ void register_webrtc_types() {
#undef SET_HINT #undef SET_HINT
} }
void unregister_webrtc_types() {} void uninitialize_webrtc_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}

View File

@ -31,7 +31,9 @@
#ifndef WEBRTC_REGISTER_TYPES_H #ifndef WEBRTC_REGISTER_TYPES_H
#define WEBRTC_REGISTER_TYPES_H #define WEBRTC_REGISTER_TYPES_H
void register_webrtc_types(); #include "modules/register_module_types.h"
void unregister_webrtc_types();
void initialize_webrtc_module(ModuleInitializationLevel p_level);
void uninitialize_webrtc_module(ModuleInitializationLevel p_level);
#endif // WEBRTC_REGISTER_TYPES_H #endif // WEBRTC_REGISTER_TYPES_H

View File

@ -55,7 +55,8 @@ static void _editor_init_callback() {
} }
#endif #endif
void register_websocket_types() { void initialize_websocket_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
#ifdef JAVASCRIPT_ENABLED #ifdef JAVASCRIPT_ENABLED
EMWSPeer::make_default(); EMWSPeer::make_default();
EMWSClient::make_default(); EMWSClient::make_default();
@ -70,10 +71,17 @@ void register_websocket_types() {
ClassDB::register_custom_instance_class<WebSocketServer>(); ClassDB::register_custom_instance_class<WebSocketServer>();
ClassDB::register_custom_instance_class<WebSocketClient>(); ClassDB::register_custom_instance_class<WebSocketClient>();
ClassDB::register_custom_instance_class<WebSocketPeer>(); ClassDB::register_custom_instance_class<WebSocketPeer>();
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorNode::add_init_callback(&_editor_init_callback); EditorNode::add_init_callback(&_editor_init_callback);
}
#endif #endif
} }
void unregister_websocket_types() {} void uninitialize_websocket_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}

View File

@ -31,7 +31,9 @@
#ifndef WEBSOCKET_REGISTER_TYPES_H #ifndef WEBSOCKET_REGISTER_TYPES_H
#define WEBSOCKET_REGISTER_TYPES_H #define WEBSOCKET_REGISTER_TYPES_H
void register_websocket_types(); #include "modules/register_module_types.h"
void unregister_websocket_types();
void initialize_websocket_module(ModuleInitializationLevel p_level);
void uninitialize_websocket_module(ModuleInitializationLevel p_level);
#endif // WEBSOCKET_REGISTER_TYPES_H #endif // WEBSOCKET_REGISTER_TYPES_H

View File

@ -37,7 +37,11 @@
Ref<WebXRInterfaceJS> webxr; Ref<WebXRInterfaceJS> webxr;
#endif #endif
void register_webxr_types() { void initialize_webxr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_ABSTRACT_CLASS(WebXRInterface); GDREGISTER_ABSTRACT_CLASS(WebXRInterface);
#ifdef JAVASCRIPT_ENABLED #ifdef JAVASCRIPT_ENABLED
@ -46,7 +50,11 @@ void register_webxr_types() {
#endif #endif
} }
void unregister_webxr_types() { void uninitialize_webxr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
#ifdef JAVASCRIPT_ENABLED #ifdef JAVASCRIPT_ENABLED
if (webxr.is_valid()) { if (webxr.is_valid()) {
// uninitialise our interface if it is initialised // uninitialise our interface if it is initialised

View File

@ -31,7 +31,9 @@
#ifndef WEBXR_REGISTER_TYPES_H #ifndef WEBXR_REGISTER_TYPES_H
#define WEBXR_REGISTER_TYPES_H #define WEBXR_REGISTER_TYPES_H
void register_webxr_types(); #include "modules/register_module_types.h"
void unregister_webxr_types();
void initialize_webxr_module(ModuleInitializationLevel p_level);
void uninitialize_webxr_module(ModuleInitializationLevel p_level);
#endif // WEBXR_REGISTER_TYPES_H #endif // WEBXR_REGISTER_TYPES_H

View File

@ -222,9 +222,16 @@ bool xatlas_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_ver
return true; return true;
} }
void register_xatlas_unwrap_types() { void initialize_xatlas_unwrap_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
array_mesh_lightmap_unwrap_callback = xatlas_mesh_lightmap_unwrap_callback; array_mesh_lightmap_unwrap_callback = xatlas_mesh_lightmap_unwrap_callback;
} }
void unregister_xatlas_unwrap_types() { void uninitialize_xatlas_unwrap_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
} }

Some files were not shown because too many files have changed in this diff Show More