diff --git a/editor_modules/cvtt/register_types.cpp b/editor_modules/cvtt/register_types.cpp index a8a9d4095..c85546558 100644 --- a/editor_modules/cvtt/register_types.cpp +++ b/editor_modules/cvtt/register_types.cpp @@ -35,8 +35,10 @@ #include "image_compress_cvtt.h" void register_cvtt_types(ModuleRegistrationLevel p_level) { - Image::set_compress_bptc_func(image_compress_cvtt); - Image::_image_decompress_bptc = image_decompress_cvtt; + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + Image::set_compress_bptc_func(image_compress_cvtt); + Image::_image_decompress_bptc = image_decompress_cvtt; + } } void unregister_cvtt_types(ModuleRegistrationLevel p_level) {} diff --git a/editor_modules/etc/register_types.cpp b/editor_modules/etc/register_types.cpp index 2a80c32e2..8b5272b37 100644 --- a/editor_modules/etc/register_types.cpp +++ b/editor_modules/etc/register_types.cpp @@ -36,13 +36,17 @@ static Ref resource_loader_pkm; void register_etc_types(ModuleRegistrationLevel p_level) { - resource_loader_pkm.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_pkm); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + resource_loader_pkm.instance(); + ResourceLoader::add_resource_format_loader(resource_loader_pkm); - _register_etc_compress_func(); + _register_etc_compress_func(); + } } void unregister_etc_types(ModuleRegistrationLevel p_level) { - ResourceLoader::remove_resource_format_loader(resource_loader_pkm); - resource_loader_pkm.unref(); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + ResourceLoader::remove_resource_format_loader(resource_loader_pkm); + resource_loader_pkm.unref(); + } } diff --git a/editor_modules/gltf/register_types.cpp b/editor_modules/gltf/register_types.cpp index 863f24a0e..5a0f7ec85 100644 --- a/editor_modules/gltf/register_types.cpp +++ b/editor_modules/gltf/register_types.cpp @@ -52,30 +52,34 @@ static void _editor_init() { void register_gltf_types(ModuleRegistrationLevel p_level) { #ifdef TOOLS_ENABLED - ClassDB::APIType prev_api = ClassDB::get_current_api(); - ClassDB::set_current_api(ClassDB::API_EDITOR); - ClassDB::register_class(); - ClassDB::register_class(); - EditorPlugins::add_by_type(); - ClassDB::set_current_api(prev_api); - EditorNode::add_init_callback(_editor_init); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + ClassDB::APIType prev_api = ClassDB::get_current_api(); + ClassDB::set_current_api(ClassDB::API_EDITOR); + ClassDB::register_class(); + ClassDB::register_class(); + EditorPlugins::add_by_type(); + ClassDB::set_current_api(prev_api); + EditorNode::add_init_callback(_editor_init); + } #endif - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_gltf_types(ModuleRegistrationLevel p_level) { diff --git a/editor_modules/plugin_refresher/register_types.cpp b/editor_modules/plugin_refresher/register_types.cpp index 1705daf7f..e8ee760d7 100644 --- a/editor_modules/plugin_refresher/register_types.cpp +++ b/editor_modules/plugin_refresher/register_types.cpp @@ -28,7 +28,9 @@ SOFTWARE. void register_plugin_refresher_types(ModuleRegistrationLevel p_level) { #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } diff --git a/editor_modules/text_editor/register_types.cpp b/editor_modules/text_editor/register_types.cpp index 0839a80cc..7bac61b9e 100644 --- a/editor_modules/text_editor/register_types.cpp +++ b/editor_modules/text_editor/register_types.cpp @@ -33,17 +33,25 @@ SOFTWARE. Ref text_editor_text_resource_loader; void register_text_editor_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + text_editor_text_resource_loader.instance(); + ResourceLoader::add_resource_format_loader(text_editor_text_resource_loader); + } - text_editor_text_resource_loader.instance(); - ResourceLoader::add_resource_format_loader(text_editor_text_resource_loader); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } void unregister_text_editor_types(ModuleRegistrationLevel p_level) { - ResourceLoader::remove_resource_format_loader(text_editor_text_resource_loader); - text_editor_text_resource_loader.unref(); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + ResourceLoader::remove_resource_format_loader(text_editor_text_resource_loader); + text_editor_text_resource_loader.unref(); + } } diff --git a/editor_modules/tinyexr/register_types.cpp b/editor_modules/tinyexr/register_types.cpp index 3e3a13c5b..a373d144d 100644 --- a/editor_modules/tinyexr/register_types.cpp +++ b/editor_modules/tinyexr/register_types.cpp @@ -36,14 +36,18 @@ static ImageLoaderTinyEXR *image_loader_tinyexr = nullptr; void register_tinyexr_types(ModuleRegistrationLevel p_level) { - image_loader_tinyexr = memnew(ImageLoaderTinyEXR); - ImageLoader::add_image_format_loader(image_loader_tinyexr); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + image_loader_tinyexr = memnew(ImageLoaderTinyEXR); + ImageLoader::add_image_format_loader(image_loader_tinyexr); - Image::save_exr_func = save_exr; + Image::save_exr_func = save_exr; + } } void unregister_tinyexr_types(ModuleRegistrationLevel p_level) { - memdelete(image_loader_tinyexr); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + memdelete(image_loader_tinyexr); - Image::save_exr_func = nullptr; + Image::save_exr_func = nullptr; + } } diff --git a/main/main.cpp b/main/main.cpp index b220526bb..113ae158d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1520,7 +1520,17 @@ Error Main::setup2(Thread::ID p_main_tid_override) { MAIN_PRINT("Main: Load Modules, Physics, Drivers, Scripts"); register_platform_apis(); + + register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_START); + register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_SINGLETON); register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_CORE); + register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_DRIVER); + register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_PLATFORM); + register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_SERVER); + register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_SCENE); + register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_EDITOR); + //register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_TEST); + register_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_FINALIZE); // Theme needs modules to be initialized so that sub-resources can be loaded. initialize_theme(); @@ -2440,7 +2450,18 @@ void Main::cleanup(bool p_force) { ImageLoader::cleanup(); unregister_driver_types(); + + unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_START); + //unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_TEST); + unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_EDITOR); + unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_SCENE); + unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_SERVER); + unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_PLATFORM); + unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_DRIVER); unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_CORE); + unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_SINGLETON); + unregister_module_types(ModuleRegistrationLevel::MODULE_REGISTRATION_LEVEL_FINALIZE); + unregister_platform_apis(); unregister_scene_types(); unregister_server_types(); diff --git a/modules/bmp/register_types.cpp b/modules/bmp/register_types.cpp index 17f0969fd..c0675f2b4 100644 --- a/modules/bmp/register_types.cpp +++ b/modules/bmp/register_types.cpp @@ -35,10 +35,14 @@ static ImageLoaderBMP *image_loader_bmp = nullptr; void register_bmp_types(ModuleRegistrationLevel p_level) { - image_loader_bmp = memnew(ImageLoaderBMP); - ImageLoader::add_image_format_loader(image_loader_bmp); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + image_loader_bmp = memnew(ImageLoaderBMP); + ImageLoader::add_image_format_loader(image_loader_bmp); + } } void unregister_bmp_types(ModuleRegistrationLevel p_level) { - memdelete(image_loader_bmp); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + memdelete(image_loader_bmp); + } } diff --git a/modules/broken_seals_module/register_types.cpp b/modules/broken_seals_module/register_types.cpp index 13967a13a..84b6b88dd 100644 --- a/modules/broken_seals_module/register_types.cpp +++ b/modules/broken_seals_module/register_types.cpp @@ -27,7 +27,9 @@ SOFTWARE. #include "biome_terrain_generator.h" void register_broken_seals_module_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } } void unregister_broken_seals_module_types(ModuleRegistrationLevel p_level) { diff --git a/modules/cscript/register_types.cpp b/modules/cscript/register_types.cpp index ce2c85efe..a1303e0f5 100644 --- a/modules/cscript/register_types.cpp +++ b/modules/cscript/register_types.cpp @@ -137,33 +137,41 @@ static void _editor_init() { #endif // TOOLS_ENABLED void register_cscript_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + script_language_cscript = memnew(CScriptLanguage); + ScriptServer::register_language(script_language_cscript); - script_language_cscript = memnew(CScriptLanguage); - ScriptServer::register_language(script_language_cscript); + resource_loader_cscript.instance(); + ResourceLoader::add_resource_format_loader(resource_loader_cscript); - resource_loader_cscript.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_cscript); + resource_saver_cscript.instance(); + ResourceSaver::add_resource_format_saver(resource_saver_cscript); + } - resource_saver_cscript.instance(); - ResourceSaver::add_resource_format_saver(resource_saver_cscript); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - ScriptEditor::register_create_syntax_highlighter_function(CScriptSyntaxHighlighter::create); - EditorNode::add_init_callback(_editor_init); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + ScriptEditor::register_create_syntax_highlighter_function(CScriptSyntaxHighlighter::create); + EditorNode::add_init_callback(_editor_init); + } #endif // TOOLS_ENABLED } void unregister_cscript_types(ModuleRegistrationLevel p_level) { - ScriptServer::unregister_language(script_language_cscript); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + ScriptServer::unregister_language(script_language_cscript); - if (script_language_cscript) { - memdelete(script_language_cscript); + if (script_language_cscript) { + memdelete(script_language_cscript); + } + + ResourceLoader::remove_resource_format_loader(resource_loader_cscript); + resource_loader_cscript.unref(); + + ResourceSaver::remove_resource_format_saver(resource_saver_cscript); + resource_saver_cscript.unref(); } - - ResourceLoader::remove_resource_format_loader(resource_loader_cscript); - resource_loader_cscript.unref(); - - ResourceSaver::remove_resource_format_saver(resource_saver_cscript); - resource_saver_cscript.unref(); } diff --git a/modules/database/register_types.cpp b/modules/database/register_types.cpp index 62c4c49a3..6acd4bedd 100644 --- a/modules/database/register_types.cpp +++ b/modules/database/register_types.cpp @@ -36,21 +36,27 @@ SOFTWARE. DatabaseManager *_database_manager = nullptr; void register_database_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + _database_manager = memnew(DatabaseManager); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("DatabaseManager", DatabaseManager::get_singleton())); + } - _database_manager = memnew(DatabaseManager); - Engine::get_singleton()->add_singleton(Engine::Singleton("DatabaseManager", DatabaseManager::get_singleton())); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_database_types(ModuleRegistrationLevel p_level) { - if (_database_manager) { - memdelete(_database_manager); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (_database_manager) { + memdelete(_database_manager); + } } } diff --git a/modules/database_sqlite/register_types.cpp b/modules/database_sqlite/register_types.cpp index 7bd081765..46d85f603 100644 --- a/modules/database_sqlite/register_types.cpp +++ b/modules/database_sqlite/register_types.cpp @@ -25,7 +25,9 @@ SOFTWARE. #include "sqlite3_database.h" void register_database_sqlite_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } } void unregister_database_sqlite_types(ModuleRegistrationLevel p_level) { diff --git a/modules/dds/register_types.cpp b/modules/dds/register_types.cpp index 93859d3c1..0d5594036 100644 --- a/modules/dds/register_types.cpp +++ b/modules/dds/register_types.cpp @@ -35,11 +35,15 @@ static Ref resource_loader_dds; void register_dds_types(ModuleRegistrationLevel p_level) { - resource_loader_dds.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_dds); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + resource_loader_dds.instance(); + ResourceLoader::add_resource_format_loader(resource_loader_dds); + } } void unregister_dds_types(ModuleRegistrationLevel p_level) { - ResourceLoader::remove_resource_format_loader(resource_loader_dds); - resource_loader_dds.unref(); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + ResourceLoader::remove_resource_format_loader(resource_loader_dds); + resource_loader_dds.unref(); + } } diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp index da5b48b6b..9c7145131 100644 --- a/modules/enet/register_types.cpp +++ b/modules/enet/register_types.cpp @@ -35,17 +35,23 @@ static bool enet_ok = false; void register_enet_types(ModuleRegistrationLevel p_level) { - if (enet_initialize() != 0) { - ERR_PRINT("ENet initialization failure"); - } else { - enet_ok = true; + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (enet_initialize() != 0) { + ERR_PRINT("ENet initialization failure"); + } else { + enet_ok = true; + } } - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } } void unregister_enet_types(ModuleRegistrationLevel p_level) { - if (enet_ok) { - enet_deinitialize(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (enet_ok) { + enet_deinitialize(); + } } } diff --git a/modules/entity_spell_system/register_types.cpp b/modules/entity_spell_system/register_types.cpp index 8f7571580..17cc8bc06 100644 --- a/modules/entity_spell_system/register_types.cpp +++ b/modules/entity_spell_system/register_types.cpp @@ -146,154 +146,162 @@ static ESS *entity_data_manager = NULL; static ProfileManager *profile_manager = NULL; void register_entity_spell_system_types(ModuleRegistrationLevel p_level) { + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + entity_data_manager = memnew(ESS); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("ESS", ESS::get_singleton())); + + profile_manager = memnew(ProfileManager); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("ProfileManager", ProfileManager::get_singleton())); + } + + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { #ifdef MODULE_PROPS_ENABLED - ClassDB::register_class(); + ClassDB::register_class(); #endif - ClassDB::register_class(); + ClassDB::register_class(); - //data - ClassDB::register_class(); - ClassDB::register_class(); + //data + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - //entity data - ClassDB::register_class(); + //entity data + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - //entities - ClassDB::register_class(); - ClassDB::register_class(); + //entities + ClassDB::register_class(); + ClassDB::register_class(); - //spellinfos - ClassDB::register_class(); + //spellinfos + ClassDB::register_class(); - //aurainfos - ClassDB::register_class(); + //aurainfos + ClassDB::register_class(); - //UI - ClassDB::register_class(); + //UI + ClassDB::register_class(); - //Skeleton - ClassDB::register_class(); - ClassDB::register_class(); + //Skeleton + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - //Projectiles - ClassDB::register_class(); + //Projectiles + ClassDB::register_class(); - //AI - ClassDB::register_class(); + //AI + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - //Resources - ClassDB::register_virtual_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + //Resources + ClassDB::register_virtual_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - //ProfileManager - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + //ProfileManager + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); #ifdef MODULE_TEXTURE_PACKER_ENABLED - ClassDB::register_class(); + ClassDB::register_class(); #endif - - entity_data_manager = memnew(ESS); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("ESS", ESS::get_singleton())); - - profile_manager = memnew(ProfileManager); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("ProfileManager", ProfileManager::get_singleton())); + } #ifdef TOOLS_ENABLED + //if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { //EditorPlugins::add_by_type(); + //} #endif } void unregister_entity_spell_system_types(ModuleRegistrationLevel p_level) { - if (entity_data_manager) { - memdelete(entity_data_manager); - } + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (entity_data_manager) { + memdelete(entity_data_manager); + } - if (profile_manager) { - memdelete(profile_manager); + if (profile_manager) { + memdelete(profile_manager); + } } } diff --git a/modules/fastnoise/register_types.cpp b/modules/fastnoise/register_types.cpp index 531dc28fc..f615ca29b 100644 --- a/modules/fastnoise/register_types.cpp +++ b/modules/fastnoise/register_types.cpp @@ -6,8 +6,10 @@ #include "noise.h" void register_fastnoise_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_fastnoise_types(ModuleRegistrationLevel p_level) { diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 99a189840..00fa63199 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -137,34 +137,42 @@ static void _editor_init() { #endif // TOOLS_ENABLED void register_gdscript_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_virtual_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + script_language_gd = memnew(GDScriptLanguage); + ScriptServer::register_language(script_language_gd); - script_language_gd = memnew(GDScriptLanguage); - ScriptServer::register_language(script_language_gd); + resource_loader_gd.instance(); + ResourceLoader::add_resource_format_loader(resource_loader_gd); - resource_loader_gd.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_gd); + resource_saver_gd.instance(); + ResourceSaver::add_resource_format_saver(resource_saver_gd); + } - resource_saver_gd.instance(); - ResourceSaver::add_resource_format_saver(resource_saver_gd); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_virtual_class(); + } #ifdef TOOLS_ENABLED - ScriptEditor::register_create_syntax_highlighter_function(GDScriptSyntaxHighlighter::create); - EditorNode::add_init_callback(_editor_init); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + ScriptEditor::register_create_syntax_highlighter_function(GDScriptSyntaxHighlighter::create); + EditorNode::add_init_callback(_editor_init); + } #endif // TOOLS_ENABLED } void unregister_gdscript_types(ModuleRegistrationLevel p_level) { - ScriptServer::unregister_language(script_language_gd); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + ScriptServer::unregister_language(script_language_gd); - if (script_language_gd) { - memdelete(script_language_gd); + if (script_language_gd) { + memdelete(script_language_gd); + } + + ResourceLoader::remove_resource_format_loader(resource_loader_gd); + resource_loader_gd.unref(); + + ResourceSaver::remove_resource_format_saver(resource_saver_gd); + resource_saver_gd.unref(); } - - ResourceLoader::remove_resource_format_loader(resource_loader_gd); - resource_loader_gd.unref(); - - ResourceSaver::remove_resource_format_saver(resource_saver_gd); - resource_saver_gd.unref(); } diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp index f7750c1e2..7fcc7947d 100644 --- a/modules/gridmap/register_types.cpp +++ b/modules/gridmap/register_types.cpp @@ -35,18 +35,23 @@ #include "mesh_library.h" #ifdef TOOLS_ENABLED -#include "mesh_library_editor_plugin.h" #include "grid_map_editor_plugin.h" +#include "mesh_library_editor_plugin.h" #endif #endif void register_gridmap_types(ModuleRegistrationLevel p_level) { #ifndef _3D_DISABLED - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + } + #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); + } #endif #endif } diff --git a/modules/hdr/register_types.cpp b/modules/hdr/register_types.cpp index 4f338936d..1822f8def 100644 --- a/modules/hdr/register_types.cpp +++ b/modules/hdr/register_types.cpp @@ -35,10 +35,14 @@ static ImageLoaderHDR *image_loader_hdr = nullptr; void register_hdr_types(ModuleRegistrationLevel p_level) { - image_loader_hdr = memnew(ImageLoaderHDR); - ImageLoader::add_image_format_loader(image_loader_hdr); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + image_loader_hdr = memnew(ImageLoaderHDR); + ImageLoader::add_image_format_loader(image_loader_hdr); + } } void unregister_hdr_types(ModuleRegistrationLevel p_level) { - memdelete(image_loader_hdr); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + memdelete(image_loader_hdr); + } } diff --git a/modules/http_server_simple/register_types.cpp b/modules/http_server_simple/register_types.cpp index 8aad0aacd..f0e42ab8d 100644 --- a/modules/http_server_simple/register_types.cpp +++ b/modules/http_server_simple/register_types.cpp @@ -24,9 +24,10 @@ SOFTWARE. #include "web_server_simple.h" - void register_http_server_simple_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } } void unregister_http_server_simple_types(ModuleRegistrationLevel p_level) { diff --git a/modules/jpg/register_types.cpp b/modules/jpg/register_types.cpp index a4e247818..eb3f502c7 100644 --- a/modules/jpg/register_types.cpp +++ b/modules/jpg/register_types.cpp @@ -35,10 +35,14 @@ static ImageLoaderJPG *image_loader_jpg = nullptr; void register_jpg_types(ModuleRegistrationLevel p_level) { - image_loader_jpg = memnew(ImageLoaderJPG); - ImageLoader::add_image_format_loader(image_loader_jpg); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + image_loader_jpg = memnew(ImageLoaderJPG); + ImageLoader::add_image_format_loader(image_loader_jpg); + } } void unregister_jpg_types(ModuleRegistrationLevel p_level) { - memdelete(image_loader_jpg); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + memdelete(image_loader_jpg); + } } diff --git a/modules/lz4/register_types.cpp b/modules/lz4/register_types.cpp index dc6527d01..38cf2c34f 100644 --- a/modules/lz4/register_types.cpp +++ b/modules/lz4/register_types.cpp @@ -4,7 +4,9 @@ #include "lz4_compressor.h" void register_lz4_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } } void unregister_lz4_types(ModuleRegistrationLevel p_level) { diff --git a/modules/material_maker/register_types.cpp b/modules/material_maker/register_types.cpp index 83fa8e6c6..9bd818c44 100644 --- a/modules/material_maker/register_types.cpp +++ b/modules/material_maker/register_types.cpp @@ -156,231 +156,238 @@ SOFTWARE. static _MMAlgos *_mm_algos_singleton = nullptr; void register_material_maker_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class<_MMAlgos>(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + _mm_algos_singleton = memnew(_MMAlgos); + ClassDB::register_class<_MMAlgos>(); + Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton())); + } - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - MMAlgos::register_node_class("Uniform", "MMUniform"); - ClassDB::register_class(); - MMAlgos::register_node_class("Uniform", "MMGreyscaleUniform"); + ClassDB::register_class(); + MMAlgos::register_node_class("Uniform", "MMUniform"); + ClassDB::register_class(); + MMAlgos::register_node_class("Uniform", "MMGreyscaleUniform"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMTranslate"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMTransform"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMTiler"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMShear"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMScale"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMRotate"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMRepeat"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMMirror"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMKaleidoscope"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMColorTiler"); - ClassDB::register_class(); - MMAlgos::register_node_class("Transform", "MMCircleMap"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMTranslate"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMTransform"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMTiler"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMShear"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMScale"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMRotate"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMRepeat"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMMirror"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMKaleidoscope"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMColorTiler"); + ClassDB::register_class(); + MMAlgos::register_node_class("Transform", "MMCircleMap"); - ClassDB::register_class(); - MMAlgos::register_node_class("Simple", "MMShape"); - ClassDB::register_class(); - MMAlgos::register_node_class("Simple", "MMImage"); - ClassDB::register_class(); - MMAlgos::register_node_class("Simple", "MMCurve"); + ClassDB::register_class(); + MMAlgos::register_node_class("Simple", "MMShape"); + ClassDB::register_class(); + MMAlgos::register_node_class("Simple", "MMImage"); + ClassDB::register_class(); + MMAlgos::register_node_class("Simple", "MMCurve"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D", "MMSdf3dColor"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D", "MMSdf3dRender"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D", "MMSdf3dColor"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D", "MMSdf3dRender"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - TF", "MMSdf3dTfTranslate"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - TF", "MMSdf3dTfScale"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - TF", "MMSdf3dTfRotate"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - TF", "MMSdf3dTfTranslate"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - TF", "MMSdf3dTfScale"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - TF", "MMSdf3dTfRotate"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeTorus"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeSphere"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeCylinder"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeCone"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeCapsule"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeBox"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeTorus"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeSphere"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeCylinder"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeCone"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeCapsule"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - Shape", "MMSdf3dShapeBox"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpSmoothBool"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpRounded"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpRevolution"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpRepeat"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpMorph"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpElongation"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpCircleRepeat"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpBool"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpSmoothBool"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpRounded"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpRevolution"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpRepeat"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpMorph"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpElongation"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpCircleRepeat"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpBool"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D", "SSSdShow"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D", "SSSdShow"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeRhombus"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapePolygon"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeLine"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeCircle"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeBox"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeArc"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeRhombus"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapePolygon"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeLine"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeCircle"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeBox"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - Shape", "MMSdShapeArc"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - TF", "MMSdTfTranslate"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - TF", "MMSdTfScale"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - TF", "MMSdTfRotate"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - TF", "MMSdTfTranslate"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - TF", "MMSdTfScale"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - TF", "MMSdTfRotate"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - OP", "MMSdOpSmoothBool"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - OP", "MMSdOpRoundedShape"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - OP", "MMSdOpRepeat"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - OP", "MMSdOpMorph"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - OP", "MMSdOpCircleRepeat"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - OP", "MMSdOpBool"); - ClassDB::register_class(); - MMAlgos::register_node_class("SDF2D - OP", "MMSdOpAnnularShape"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - OP", "MMSdOpSmoothBool"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - OP", "MMSdOpRoundedShape"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - OP", "MMSdOpRepeat"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - OP", "MMSdOpMorph"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - OP", "MMSdOpCircleRepeat"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - OP", "MMSdOpBool"); + ClassDB::register_class(); + MMAlgos::register_node_class("SDF2D - OP", "MMSdOpAnnularShape"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMWeave"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMTruchet"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMSineWave"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMScratches"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMRunes"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMPattern"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMIching"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMBricks"); - ClassDB::register_class(); - MMAlgos::register_node_class("Patterns", "MMBeehive"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMWeave"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMTruchet"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMSineWave"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMScratches"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMRunes"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMPattern"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMIching"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMBricks"); + ClassDB::register_class(); + MMAlgos::register_node_class("Patterns", "MMBeehive"); - ClassDB::register_class(); - MMAlgos::register_node_class("Output", "MMOutputImage"); + ClassDB::register_class(); + MMAlgos::register_node_class("Output", "MMOutputImage"); - ClassDB::register_class(); - MMAlgos::register_node_class("Noise", "MMVoronoi"); - ClassDB::register_class(); - MMAlgos::register_node_class("Noise", "MMNoise"); - ClassDB::register_class(); - MMAlgos::register_node_class("Noise", "MMFbmNoise"); - ClassDB::register_class(); - MMAlgos::register_node_class("Noise", "MMColorValue"); - ClassDB::register_class(); - MMAlgos::register_node_class("Noise", "MMColorNoise"); - ClassDB::register_class(); - MMAlgos::register_node_class("Noise", "MMAnisotropicNoise"); + ClassDB::register_class(); + MMAlgos::register_node_class("Noise", "MMVoronoi"); + ClassDB::register_class(); + MMAlgos::register_node_class("Noise", "MMNoise"); + ClassDB::register_class(); + MMAlgos::register_node_class("Noise", "MMFbmNoise"); + ClassDB::register_class(); + MMAlgos::register_node_class("Noise", "MMColorValue"); + ClassDB::register_class(); + MMAlgos::register_node_class("Noise", "MMColorNoise"); + ClassDB::register_class(); + MMAlgos::register_node_class("Noise", "MMAnisotropicNoise"); - ClassDB::register_class(); - MMAlgos::register_node_class("Gradient", "MMRadialGradient"); - ClassDB::register_class(); - MMAlgos::register_node_class("Gradient", "MMGradient"); - ClassDB::register_class(); - MMAlgos::register_node_class("Gradient", "MMCircularGradient"); + ClassDB::register_class(); + MMAlgos::register_node_class("Gradient", "MMRadialGradient"); + ClassDB::register_class(); + MMAlgos::register_node_class("Gradient", "MMGradient"); + ClassDB::register_class(); + MMAlgos::register_node_class("Gradient", "MMCircularGradient"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMTonality"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMSwapChannels"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMQuantize"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMMath"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMMakeTileable"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMInvert"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMGreyscale"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMFillToUv"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMFillToSize"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMFillToRandomGrey"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMFillToRandomColor"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMFillToPosition"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMFillToColor"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMFillChannel"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMEmboss"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMDecompose"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMCombine"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMColorize"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMBrightnessContrast"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMBlurGaussian"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMBlend"); - ClassDB::register_class(); - MMAlgos::register_node_class("Filter", "MMAdjustHsv"); - - _mm_algos_singleton = memnew(_MMAlgos); - Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton())); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMTonality"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMSwapChannels"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMQuantize"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMMath"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMMakeTileable"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMInvert"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMGreyscale"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMFillToUv"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMFillToSize"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMFillToRandomGrey"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMFillToRandomColor"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMFillToPosition"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMFillToColor"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMFillChannel"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMEmboss"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMDecompose"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMCombine"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMColorize"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMBrightnessContrast"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMBlurGaussian"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMBlend"); + ClassDB::register_class(); + MMAlgos::register_node_class("Filter", "MMAdjustHsv"); + } #if TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } void unregister_material_maker_types(ModuleRegistrationLevel p_level) { - if (_mm_algos_singleton) { - memdelete(_mm_algos_singleton); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (_mm_algos_singleton) { + memdelete(_mm_algos_singleton); + } } } diff --git a/modules/mbedtls/register_types.cpp b/modules/mbedtls/register_types.cpp index 92f30a064..7dee37bbd 100644 --- a/modules/mbedtls/register_types.cpp +++ b/modules/mbedtls/register_types.cpp @@ -36,15 +36,19 @@ #include "stream_peer_mbedtls.h" void register_mbedtls_types(ModuleRegistrationLevel p_level) { - CryptoMbedTLS::initialize_crypto(); - StreamPeerMbedTLS::initialize_ssl(); - PacketPeerMbedDTLS::initialize_dtls(); - DTLSServerMbedTLS::initialize(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + CryptoMbedTLS::initialize_crypto(); + StreamPeerMbedTLS::initialize_ssl(); + PacketPeerMbedDTLS::initialize_dtls(); + DTLSServerMbedTLS::initialize(); + } } void unregister_mbedtls_types(ModuleRegistrationLevel p_level) { - DTLSServerMbedTLS::finalize(); - PacketPeerMbedDTLS::finalize_dtls(); - StreamPeerMbedTLS::finalize_ssl(); - CryptoMbedTLS::finalize_crypto(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + DTLSServerMbedTLS::finalize(); + PacketPeerMbedDTLS::finalize_dtls(); + StreamPeerMbedTLS::finalize_ssl(); + CryptoMbedTLS::finalize_crypto(); + } } diff --git a/modules/mesh_data_resource/register_types.cpp b/modules/mesh_data_resource/register_types.cpp index 2dd49e9da..530cf0ed9 100644 --- a/modules/mesh_data_resource/register_types.cpp +++ b/modules/mesh_data_resource/register_types.cpp @@ -53,34 +53,36 @@ SOFTWARE. #endif void register_mesh_data_resource_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); #ifdef MODULE_PROPS_ENABLED - ClassDB::register_class(); - Ref processor = Ref(memnew(PropDataMeshData)); - PropUtils::add_processor(processor); + ClassDB::register_class(); + Ref processor = Ref(memnew(PropDataMeshData)); + PropUtils::add_processor(processor); #endif #ifdef MODULE_PROPS_2D_ENABLED - ClassDB::register_class(); - Ref prop_2d_processor = Ref(memnew(Prop2DDataMeshData)); - Prop2DUtils::add_processor(prop_2d_processor); + ClassDB::register_class(); + Ref prop_2d_processor = Ref(memnew(Prop2DDataMeshData)); + Prop2DUtils::add_processor(prop_2d_processor); #endif + } #ifdef TOOLS_ENABLED - + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { #ifdef MODULE_GLTF_ENABLED - EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); #endif #ifdef MODULE_MESH_UTILS_ENABLED - EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); #endif - + } #endif } diff --git a/modules/mesh_utils/register_types.cpp b/modules/mesh_utils/register_types.cpp index 051620949..3f373de2c 100644 --- a/modules/mesh_utils/register_types.cpp +++ b/modules/mesh_utils/register_types.cpp @@ -33,16 +33,22 @@ SOFTWARE. static MeshUtils *mesh_utils = NULL; void register_mesh_utils_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + mesh_utils = memnew(MeshUtils); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("MeshUtils", MeshUtils::get_singleton())); + } - mesh_utils = memnew(MeshUtils); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("MeshUtils", MeshUtils::get_singleton())); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_mesh_utils_types(ModuleRegistrationLevel p_level) { - if (mesh_utils) { - memdelete(mesh_utils); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (mesh_utils) { + memdelete(mesh_utils); + } } } diff --git a/modules/minimp3/register_types.cpp b/modules/minimp3/register_types.cpp index 43dba8b2b..83308e092 100644 --- a/modules/minimp3/register_types.cpp +++ b/modules/minimp3/register_types.cpp @@ -38,14 +38,19 @@ #endif void register_minimp3_types(ModuleRegistrationLevel p_level) { + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } + #ifdef TOOLS_ENABLED - if (Engine::get_singleton()->is_editor_hint()) { - Ref mp3_import; - mp3_import.instance(); - ResourceFormatImporter::get_singleton()->add_importer(mp3_import); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + if (Engine::get_singleton()->is_editor_hint()) { + Ref mp3_import; + mp3_import.instance(); + ResourceFormatImporter::get_singleton()->add_importer(mp3_import); + } } #endif - ClassDB::register_class(); } void unregister_minimp3_types(ModuleRegistrationLevel p_level) { diff --git a/modules/navigation/register_types.cpp b/modules/navigation/register_types.cpp index 1686abdb8..15de869d2 100644 --- a/modules/navigation/register_types.cpp +++ b/modules/navigation/register_types.cpp @@ -51,23 +51,29 @@ NavigationServer *new_server() { } void register_navigation_types(ModuleRegistrationLevel p_level) { - NavigationServerManager::set_default_server(new_server); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + NavigationServerManager::set_default_server(new_server); #ifndef _3D_DISABLED - _nav_mesh_generator = memnew(NavigationMeshGenerator); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", NavigationMeshGenerator::get_singleton())); + _nav_mesh_generator = memnew(NavigationMeshGenerator); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", NavigationMeshGenerator::get_singleton())); #endif + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } void unregister_navigation_types(ModuleRegistrationLevel p_level) { #ifndef _3D_DISABLED - if (_nav_mesh_generator) { - memdelete(_nav_mesh_generator); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (_nav_mesh_generator) { + memdelete(_nav_mesh_generator); + } } #endif } diff --git a/modules/network_synchronizer/register_types.cpp b/modules/network_synchronizer/register_types.cpp index 55c68c0e6..0df345092 100644 --- a/modules/network_synchronizer/register_types.cpp +++ b/modules/network_synchronizer/register_types.cpp @@ -34,23 +34,24 @@ #include "register_types.h" +#include "core/config/project_settings.h" #include "data_buffer.h" #include "interpolator.h" #include "networked_controller.h" #include "scene_diff.h" #include "scene_synchronizer.h" -#include "core/config/project_settings.h" - void register_network_synchronizer_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - GLOBAL_DEF("NetworkSynchronizer/debug_server_speedup", false); - GLOBAL_DEF("NetworkSynchronizer/debug_doll_speedup", false); + GLOBAL_DEF("NetworkSynchronizer/debug_server_speedup", false); + GLOBAL_DEF("NetworkSynchronizer/debug_doll_speedup", false); + } } void unregister_network_synchronizer_types(ModuleRegistrationLevel p_level) { diff --git a/modules/opensimplex/register_types.cpp b/modules/opensimplex/register_types.cpp index a5e7eda74..64b2a025b 100644 --- a/modules/opensimplex/register_types.cpp +++ b/modules/opensimplex/register_types.cpp @@ -33,8 +33,10 @@ #include "open_simplex_noise.h" void register_opensimplex_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_opensimplex_types(ModuleRegistrationLevel p_level) { diff --git a/modules/paint/register_types.cpp b/modules/paint/register_types.cpp index 16dde86fe..40fbfbb7a 100644 --- a/modules/paint/register_types.cpp +++ b/modules/paint/register_types.cpp @@ -53,34 +53,38 @@ SOFTWARE. #endif void register_paint_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } diff --git a/modules/props/register_types.cpp b/modules/props/register_types.cpp index d1baf7ac9..6a1ab686b 100644 --- a/modules/props/register_types.cpp +++ b/modules/props/register_types.cpp @@ -72,78 +72,86 @@ static PropUtils *prop_utils = NULL; static PropCache *prop_texture_cache = NULL; void register_props_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + prop_utils = memnew(PropUtils); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("PropUtils", PropUtils::get_singleton())); - ClassDB::register_class(); + prop_texture_cache = memnew(PropCache); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("PropCache", PropCache::get_singleton())); + } - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + + ClassDB::register_class(); + + ClassDB::register_class(); #ifdef MODULE_TEXTURE_PACKER_ENABLED - ClassDB::register_class(); + ClassDB::register_class(); #endif - prop_utils = memnew(PropUtils); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("PropUtils", PropUtils::get_singleton())); + Ref light_processor = Ref(memnew(PropDataLight)); + PropUtils::add_processor(light_processor); - prop_texture_cache = memnew(PropCache); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("PropCache", PropCache::get_singleton())); + Ref prop_processor = Ref(memnew(PropDataProp)); + PropUtils::add_processor(prop_processor); - Ref light_processor = Ref(memnew(PropDataLight)); - PropUtils::add_processor(light_processor); + Ref scene_processor = Ref(memnew(PropDataScene)); + PropUtils::add_processor(scene_processor); - Ref prop_processor = Ref(memnew(PropDataProp)); - PropUtils::add_processor(prop_processor); + Ref portal_processor = Ref(memnew(PropDataPortal)); + PropUtils::add_processor(portal_processor); - Ref scene_processor = Ref(memnew(PropDataScene)); - PropUtils::add_processor(scene_processor); - - Ref portal_processor = Ref(memnew(PropDataPortal)); - PropUtils::add_processor(portal_processor); - - Ref tiled_wall_processor = Ref(memnew(PropDataTiledWall)); - PropUtils::add_processor(tiled_wall_processor); + Ref tiled_wall_processor = Ref(memnew(PropDataTiledWall)); + PropUtils::add_processor(tiled_wall_processor); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } void unregister_props_types(ModuleRegistrationLevel p_level) { - if (prop_utils) { - memdelete(prop_utils); - } + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (prop_utils) { + memdelete(prop_utils); + } - if (prop_texture_cache) { - memdelete(prop_texture_cache); + if (prop_texture_cache) { + memdelete(prop_texture_cache); + } } } diff --git a/modules/props_2d/register_types.cpp b/modules/props_2d/register_types.cpp index 766d21d0b..d3616bf6d 100644 --- a/modules/props_2d/register_types.cpp +++ b/modules/props_2d/register_types.cpp @@ -72,81 +72,89 @@ static Prop2DUtils *prop_utils = NULL; static Prop2DCache *prop_texture_cache = NULL; void register_props_2d_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + prop_utils = memnew(Prop2DUtils); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("Prop2DUtils", Prop2DUtils::get_singleton())); - ClassDB::register_class(); + prop_texture_cache = memnew(Prop2DCache); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("Prop2DCache", Prop2DCache::get_singleton())); + } - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + + ClassDB::register_class(); + + ClassDB::register_class(); #ifdef MODULE_TEXTURE_PACKER_ENABLED - ClassDB::register_class(); + ClassDB::register_class(); #endif - prop_utils = memnew(Prop2DUtils); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("Prop2DUtils", Prop2DUtils::get_singleton())); + Ref light_processor = Ref(memnew(Prop2DDataLight)); + Prop2DUtils::add_processor(light_processor); - prop_texture_cache = memnew(Prop2DCache); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("Prop2DCache", Prop2DCache::get_singleton())); + Ref prop_processor = Ref(memnew(Prop2DDataProp2D)); + Prop2DUtils::add_processor(prop_processor); - Ref light_processor = Ref(memnew(Prop2DDataLight)); - Prop2DUtils::add_processor(light_processor); + Ref scene_processor = Ref(memnew(Prop2DDataScene)); + Prop2DUtils::add_processor(scene_processor); - Ref prop_processor = Ref(memnew(Prop2DDataProp2D)); - Prop2DUtils::add_processor(prop_processor); + Ref portal_processor = Ref(memnew(Prop2DDataPortal)); + Prop2DUtils::add_processor(portal_processor); - Ref scene_processor = Ref(memnew(Prop2DDataScene)); - Prop2DUtils::add_processor(scene_processor); + Ref tiled_wall_processor = Ref(memnew(Prop2DDataTiledWall2D)); + Prop2DUtils::add_processor(tiled_wall_processor); - Ref portal_processor = Ref(memnew(Prop2DDataPortal)); - Prop2DUtils::add_processor(portal_processor); - - Ref tiled_wall_processor = Ref(memnew(Prop2DDataTiledWall2D)); - Prop2DUtils::add_processor(tiled_wall_processor); - - Ref sprite_processor = Ref(memnew(Prop2DDataSprite)); - Prop2DUtils::add_processor(sprite_processor); + Ref sprite_processor = Ref(memnew(Prop2DDataSprite)); + Prop2DUtils::add_processor(sprite_processor); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } void unregister_props_2d_types(ModuleRegistrationLevel p_level) { - if (prop_utils) { - memdelete(prop_utils); - } + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (prop_utils) { + memdelete(prop_utils); + } - if (prop_texture_cache) { - memdelete(prop_texture_cache); + if (prop_texture_cache) { + memdelete(prop_texture_cache); + } } } diff --git a/modules/pvr/register_types.cpp b/modules/pvr/register_types.cpp index ab4f76ff5..48e85d1a4 100644 --- a/modules/pvr/register_types.cpp +++ b/modules/pvr/register_types.cpp @@ -36,13 +36,17 @@ static Ref resource_loader_pvr; void register_pvr_types(ModuleRegistrationLevel p_level) { - resource_loader_pvr.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_pvr); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + resource_loader_pvr.instance(); + ResourceLoader::add_resource_format_loader(resource_loader_pvr); - _register_pvrtc_compress_func(); + _register_pvrtc_compress_func(); + } } void unregister_pvr_types(ModuleRegistrationLevel p_level) { - ResourceLoader::remove_resource_format_loader(resource_loader_pvr); - resource_loader_pvr.unref(); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + ResourceLoader::remove_resource_format_loader(resource_loader_pvr); + resource_loader_pvr.unref(); + } } diff --git a/modules/regex/register_types.cpp b/modules/regex/register_types.cpp index 1843ef311..34de4aea0 100644 --- a/modules/regex/register_types.cpp +++ b/modules/regex/register_types.cpp @@ -33,8 +33,10 @@ #include "regex.h" void register_regex_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_regex_types(ModuleRegistrationLevel p_level) { diff --git a/modules/skeleton_2d/register_types.cpp b/modules/skeleton_2d/register_types.cpp index 7777d67e3..2a0dfa62b 100644 --- a/modules/skeleton_2d/register_types.cpp +++ b/modules/skeleton_2d/register_types.cpp @@ -19,24 +19,28 @@ #endif void register_skeleton_2d_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } diff --git a/modules/skeleton_3d/register_types.cpp b/modules/skeleton_3d/register_types.cpp index d37d869a7..b051f0089 100644 --- a/modules/skeleton_3d/register_types.cpp +++ b/modules/skeleton_3d/register_types.cpp @@ -19,35 +19,39 @@ #include "resources/skeleton_modification_stack_3d.h" #ifdef TOOLS_ENABLED +#include "editor/physical_bone_plugin.h" #include "editor/skeleton_editor_plugin.h" #include "editor/skeleton_ik_editor_plugin.h" -#include "editor/physical_bone_plugin.h" #endif void register_skeleton_3d_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); - EditorPlugins::add_by_type(); - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); + } #endif } diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp index 54a5ab3e1..46dda1bcc 100644 --- a/modules/squish/register_types.cpp +++ b/modules/squish/register_types.cpp @@ -32,8 +32,10 @@ #include "image_compress_squish.h" void register_squish_types(ModuleRegistrationLevel p_level) { - Image::set_compress_bc_func(image_compress_squish); - Image::_image_decompress_bc = image_decompress_squish; + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + Image::set_compress_bc_func(image_compress_squish); + Image::_image_decompress_bc = image_decompress_squish; + } } void unregister_squish_types(ModuleRegistrationLevel p_level) {} diff --git a/modules/stb_vorbis/register_types.cpp b/modules/stb_vorbis/register_types.cpp index 503350cd8..56aa75a78 100644 --- a/modules/stb_vorbis/register_types.cpp +++ b/modules/stb_vorbis/register_types.cpp @@ -38,14 +38,19 @@ #endif void register_stb_vorbis_types(ModuleRegistrationLevel p_level) { + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } + #ifdef TOOLS_ENABLED - if (Engine::get_singleton()->is_editor_hint()) { - Ref ogg_import; - ogg_import.instance(); - ResourceFormatImporter::get_singleton()->add_importer(ogg_import); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + if (Engine::get_singleton()->is_editor_hint()) { + Ref ogg_import; + ogg_import.instance(); + ResourceFormatImporter::get_singleton()->add_importer(ogg_import); + } } #endif - ClassDB::register_class(); } void unregister_stb_vorbis_types(ModuleRegistrationLevel p_level) { diff --git a/modules/steering_ai/register_types.cpp b/modules/steering_ai/register_types.cpp index 676ba6ecf..6b3ada97f 100644 --- a/modules/steering_ai/register_types.cpp +++ b/modules/steering_ai/register_types.cpp @@ -62,45 +62,51 @@ SOFTWARE. static GSAIUtils *gs_ai_utils = NULL; void register_steering_ai_types(ModuleRegistrationLevel p_level) { - gs_ai_utils = memnew(GSAIUtils); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("GSAIUtils", GSAIUtils::get_singleton())); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + gs_ai_utils = memnew(GSAIUtils); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("GSAIUtils", GSAIUtils::get_singleton())); + } - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_steering_ai_types(ModuleRegistrationLevel p_level) { - if (gs_ai_utils) { - memdelete(gs_ai_utils); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (gs_ai_utils) { + memdelete(gs_ai_utils); + } } } diff --git a/modules/svg/register_types.cpp b/modules/svg/register_types.cpp index 8ac4ec256..2f1174941 100644 --- a/modules/svg/register_types.cpp +++ b/modules/svg/register_types.cpp @@ -35,10 +35,14 @@ static ImageLoaderSVG *image_loader_svg = nullptr; void register_svg_types(ModuleRegistrationLevel p_level) { - image_loader_svg = memnew(ImageLoaderSVG); - ImageLoader::add_image_format_loader(image_loader_svg); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + image_loader_svg = memnew(ImageLoaderSVG); + ImageLoader::add_image_format_loader(image_loader_svg); + } } void unregister_svg_types(ModuleRegistrationLevel p_level) { - memdelete(image_loader_svg); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + memdelete(image_loader_svg); + } } diff --git a/modules/terraman/register_types.cpp b/modules/terraman/register_types.cpp index 8596f99c2..a8597f69d 100644 --- a/modules/terraman/register_types.cpp +++ b/modules/terraman/register_types.cpp @@ -71,53 +71,57 @@ SOFTWARE. #include "world/jobs/terrain_terrain_job.h" void register_terraman_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); #ifdef MODULE_TEXTURE_PACKER_ENABLED - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); #endif - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } diff --git a/modules/terraman_2d/register_types.cpp b/modules/terraman_2d/register_types.cpp index 04db9681e..68c1910f2 100644 --- a/modules/terraman_2d/register_types.cpp +++ b/modules/terraman_2d/register_types.cpp @@ -73,56 +73,60 @@ SOFTWARE. #include "world/jobs/terrain_2d_terrain_job.h" void register_terraman_2d_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); #ifdef MODULE_TEXTURE_PACKER_ENABLED - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); #endif - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } diff --git a/modules/texture_packer/register_types.cpp b/modules/texture_packer/register_types.cpp index cf60265eb..95a1470c2 100644 --- a/modules/texture_packer/register_types.cpp +++ b/modules/texture_packer/register_types.cpp @@ -36,15 +36,19 @@ SOFTWARE. #endif void register_texture_packer_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } diff --git a/modules/tga/register_types.cpp b/modules/tga/register_types.cpp index a9635edfb..bb5cbd9f3 100644 --- a/modules/tga/register_types.cpp +++ b/modules/tga/register_types.cpp @@ -35,10 +35,14 @@ static ImageLoaderTGA *image_loader_tga = nullptr; void register_tga_types(ModuleRegistrationLevel p_level) { - image_loader_tga = memnew(ImageLoaderTGA); - ImageLoader::add_image_format_loader(image_loader_tga); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + image_loader_tga = memnew(ImageLoaderTGA); + ImageLoader::add_image_format_loader(image_loader_tga); + } } void unregister_tga_types(ModuleRegistrationLevel p_level) { - memdelete(image_loader_tga); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + memdelete(image_loader_tga); + } } diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp index 284b93901..07ed7e0d3 100644 --- a/modules/theora/register_types.cpp +++ b/modules/theora/register_types.cpp @@ -35,13 +35,19 @@ static Ref resource_loader_theora; void register_theora_types(ModuleRegistrationLevel p_level) { - resource_loader_theora.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_theora, true); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + resource_loader_theora.instance(); + ResourceLoader::add_resource_format_loader(resource_loader_theora, true); + } - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + } } void unregister_theora_types(ModuleRegistrationLevel p_level) { - ResourceLoader::remove_resource_format_loader(resource_loader_theora); - resource_loader_theora.unref(); + if (p_level == MODULE_REGISTRATION_LEVEL_CORE) { + ResourceLoader::remove_resource_format_loader(resource_loader_theora); + resource_loader_theora.unref(); + } } diff --git a/modules/tile_map/register_types.cpp b/modules/tile_map/register_types.cpp index 62ff6b6cb..7ea084fb2 100644 --- a/modules/tile_map/register_types.cpp +++ b/modules/tile_map/register_types.cpp @@ -31,13 +31,17 @@ SOFTWARE. #endif void register_tile_map_types(ModuleRegistrationLevel p_level) { -#ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); - EditorPlugins::add_by_type(); -#endif + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + } - ClassDB::register_class(); - ClassDB::register_class(); +#ifdef TOOLS_ENABLED + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); + } +#endif } void unregister_tile_map_types(ModuleRegistrationLevel p_level) { diff --git a/modules/ui_extensions/register_types.cpp b/modules/ui_extensions/register_types.cpp index 8f1271d4c..4fba74785 100644 --- a/modules/ui_extensions/register_types.cpp +++ b/modules/ui_extensions/register_types.cpp @@ -23,14 +23,16 @@ SOFTWARE. #include "register_types.h" #include "bs_input_event_key.h" -#include "input_map_editor.h" #include "core/input/shortcut.h" +#include "input_map_editor.h" #include "touch_button.h" void register_ui_extensions_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_ui_extensions_types(ModuleRegistrationLevel p_level) { diff --git a/modules/upnp/register_types.cpp b/modules/upnp/register_types.cpp index 2561ace65..ce9f0314d 100644 --- a/modules/upnp/register_types.cpp +++ b/modules/upnp/register_types.cpp @@ -36,8 +36,10 @@ #include "upnp_device.h" void register_upnp_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_upnp_types(ModuleRegistrationLevel p_level) { diff --git a/modules/users/register_types.cpp b/modules/users/register_types.cpp index f89f2a236..782d1a3c4 100644 --- a/modules/users/register_types.cpp +++ b/modules/users/register_types.cpp @@ -55,38 +55,43 @@ SOFTWARE. UserDB *_user_db = nullptr; void register_users_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + _user_db = memnew(UserDB); + ClassDB::register_class(); + Engine::get_singleton()->add_singleton(Engine::Singleton("UserDB", UserDB::get_singleton())); + } - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - - _user_db = memnew(UserDB); - Engine::get_singleton()->add_singleton(Engine::Singleton("UserDB", UserDB::get_singleton())); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); #ifdef MODULE_WEB_ENABLED - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); #endif #ifdef MODULE_DATABASE_ENABLED - ClassDB::register_class(); + ClassDB::register_class(); #endif + } } void unregister_users_types(ModuleRegistrationLevel p_level) { - if (_user_db) { - memdelete(_user_db); + if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { + if (_user_db) { + memdelete(_user_db); + } } } diff --git a/modules/vhacd/register_types.cpp b/modules/vhacd/register_types.cpp index b213cf1f5..14b561548 100644 --- a/modules/vhacd/register_types.cpp +++ b/modules/vhacd/register_types.cpp @@ -79,9 +79,13 @@ static Vector> convex_decompose(const real_t *p_vertices, in } void register_vhacd_types(ModuleRegistrationLevel p_level) { - Mesh::convex_decomposition_function = convex_decompose; + if (p_level == MODULE_REGISTRATION_LEVEL_DRIVER) { + Mesh::convex_decomposition_function = convex_decompose; + } } void unregister_vhacd_types(ModuleRegistrationLevel p_level) { - Mesh::convex_decomposition_function = nullptr; + if (p_level == MODULE_REGISTRATION_LEVEL_DRIVER) { + Mesh::convex_decomposition_function = nullptr; + } } diff --git a/modules/voxelman/register_types.cpp b/modules/voxelman/register_types.cpp index a76b05f9d..583c8e685 100644 --- a/modules/voxelman/register_types.cpp +++ b/modules/voxelman/register_types.cpp @@ -84,66 +84,70 @@ SOFTWARE. #include "world/jobs/voxel_terrain_job.h" void register_voxelman_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); #ifdef MODULE_TEXTURE_PACKER_ENABLED - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); #endif - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } diff --git a/modules/web/register_types.cpp b/modules/web/register_types.cpp index 91c807b4c..5d9c729b7 100644 --- a/modules/web/register_types.cpp +++ b/modules/web/register_types.cpp @@ -73,76 +73,80 @@ SOFTWARE. #endif void register_web_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class<_HTMLBuilder>(); - ClassDB::register_class<_HTMLTag>(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class<_HTMLBuilder>(); + ClassDB::register_class<_HTMLTag>(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - //ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + //ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); #ifdef MODULE_DATABASE_ENABLED - ClassDB::register_class(); + ClassDB::register_class(); #endif + } #if TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } diff --git a/modules/websocket/register_types.cpp b/modules/websocket/register_types.cpp index 8aabf80ca..4261583d0 100644 --- a/modules/websocket/register_types.cpp +++ b/modules/websocket/register_types.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "register_types.h" -#include "core/error/error_macros.h" #include "core/config/project_settings.h" +#include "core/error/error_macros.h" #ifdef JAVASCRIPT_ENABLED #include "emscripten.h" #include "emws_client.h" @@ -42,36 +42,40 @@ #endif void register_websocket_types(ModuleRegistrationLevel p_level) { + if (p_level == MODULE_REGISTRATION_LEVEL_DRIVER) { #define _SET_HINT(NAME, _VAL_, _MAX_) \ GLOBAL_DEF(NAME, _VAL_); \ ProjectSettings::get_singleton()->set_custom_property_info(NAME, PropertyInfo(Variant::INT, NAME, PROPERTY_HINT_RANGE, "2," #_MAX_ ",1,or_greater")); - // Client buffers project settings - _SET_HINT(WSC_IN_BUF, 64, 4096); - _SET_HINT(WSC_IN_PKT, 1024, 16384); - _SET_HINT(WSC_OUT_BUF, 64, 4096); - _SET_HINT(WSC_OUT_PKT, 1024, 16384); + // Client buffers project settings + _SET_HINT(WSC_IN_BUF, 64, 4096); + _SET_HINT(WSC_IN_PKT, 1024, 16384); + _SET_HINT(WSC_OUT_BUF, 64, 4096); + _SET_HINT(WSC_OUT_PKT, 1024, 16384); - // Server buffers project settings - _SET_HINT(WSS_IN_BUF, 64, 4096); - _SET_HINT(WSS_IN_PKT, 1024, 16384); - _SET_HINT(WSS_OUT_BUF, 64, 4096); - _SET_HINT(WSS_OUT_PKT, 1024, 16384); + // Server buffers project settings + _SET_HINT(WSS_IN_BUF, 64, 4096); + _SET_HINT(WSS_IN_PKT, 1024, 16384); + _SET_HINT(WSS_OUT_BUF, 64, 4096); + _SET_HINT(WSS_OUT_PKT, 1024, 16384); #ifdef JAVASCRIPT_ENABLED - EMWSPeer::make_default(); - EMWSClient::make_default(); - EMWSServer::make_default(); + EMWSPeer::make_default(); + EMWSClient::make_default(); + EMWSServer::make_default(); #else - WSLPeer::make_default(); - WSLClient::make_default(); - WSLServer::make_default(); + WSLPeer::make_default(); + WSLClient::make_default(); + WSLServer::make_default(); #endif + } - ClassDB::register_virtual_class(); - ClassDB::register_custom_instance_class(); - ClassDB::register_custom_instance_class(); - ClassDB::register_custom_instance_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_virtual_class(); + ClassDB::register_custom_instance_class(); + ClassDB::register_custom_instance_class(); + ClassDB::register_custom_instance_class(); + } } void unregister_websocket_types(ModuleRegistrationLevel p_level) {} diff --git a/modules/wfc/register_types.cpp b/modules/wfc/register_types.cpp index 8ed4e6848..73a6ba271 100644 --- a/modules/wfc/register_types.cpp +++ b/modules/wfc/register_types.cpp @@ -1,16 +1,18 @@ #include "register_types.h" +#include "image_indexer.h" #include "overlapping_wave_form_collapse.h" #include "tiling_wave_form_collapse.h" #include "wave_form_collapse.h" -#include "image_indexer.h" void register_wfc_types(ModuleRegistrationLevel p_level) { - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); + } } void unregister_wfc_types(ModuleRegistrationLevel p_level) {