diff --git a/register_types.cpp b/register_types.cpp index 486d31c..29fefdd 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -38,17 +38,21 @@ SOFTWARE. static MeshUtils *mesh_utils = NULL; -void register_mesh_utils_types() { - ClassDB::register_class(); - ClassDB::register_class(); +void initialize_mesh_utils_module(ModuleInitializationLevel p_level) { + if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) { + GDREGISTER_CLASS(FastQuadraticMeshSimplifier); + GDREGISTER_CLASS(MeshMerger); - mesh_utils = memnew(MeshUtils); - ClassDB::register_class(); - Engine::get_singleton()->add_singleton(Engine::Singleton("MeshUtils", MeshUtils::get_singleton())); -} - -void unregister_mesh_utils_types() { - if (mesh_utils) { - memdelete(mesh_utils); + mesh_utils = memnew(MeshUtils); + GDREGISTER_CLASS(MeshUtils); + Engine::get_singleton()->add_singleton(Engine::Singleton("MeshUtils", MeshUtils::get_singleton())); + } +} + +void initialize_mesh_utils_module(ModuleInitializationLevel p_level) { + if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) { + if (mesh_utils) { + memdelete(mesh_utils); + } } } diff --git a/register_types.h b/register_types.h index b5fec5c..d5ed615 100644 --- a/register_types.h +++ b/register_types.h @@ -25,7 +25,9 @@ SOFTWARE. */ -void register_mesh_utils_types(); -void unregister_mesh_utils_types(); +#include "modules/register_module_types.h" + +void initialize_mesh_utils_module(ModuleInitializationLevel p_level); +void uninitialize_mesh_utils_module(ModuleInitializationLevel p_level); #endif