Updated register_types.h and cpp to the current godot 4 style.

This commit is contained in:
Relintai 2023-01-08 15:55:55 +01:00
parent b52a261c31
commit 30d5e204e5
2 changed files with 19 additions and 13 deletions

View File

@ -38,17 +38,21 @@ SOFTWARE.
static MeshUtils *mesh_utils = NULL; static MeshUtils *mesh_utils = NULL;
void register_mesh_utils_types() { void initialize_mesh_utils_module(ModuleInitializationLevel p_level) {
ClassDB::register_class<FastQuadraticMeshSimplifier>(); if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
ClassDB::register_class<MeshMerger>(); GDREGISTER_CLASS(FastQuadraticMeshSimplifier);
GDREGISTER_CLASS(MeshMerger);
mesh_utils = memnew(MeshUtils); mesh_utils = memnew(MeshUtils);
ClassDB::register_class<MeshUtils>(); GDREGISTER_CLASS(MeshUtils);
Engine::get_singleton()->add_singleton(Engine::Singleton("MeshUtils", MeshUtils::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("MeshUtils", MeshUtils::get_singleton()));
} }
}
void unregister_mesh_utils_types() {
if (mesh_utils) { void initialize_mesh_utils_module(ModuleInitializationLevel p_level) {
memdelete(mesh_utils); if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
if (mesh_utils) {
memdelete(mesh_utils);
}
} }
} }

View File

@ -25,7 +25,9 @@ SOFTWARE.
*/ */
void register_mesh_utils_types(); #include "modules/register_module_types.h"
void unregister_mesh_utils_types();
void initialize_mesh_utils_module(ModuleInitializationLevel p_level);
void uninitialize_mesh_utils_module(ModuleInitializationLevel p_level);
#endif #endif