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;
void register_mesh_utils_types() {
ClassDB::register_class<FastQuadraticMeshSimplifier>();
ClassDB::register_class<MeshMerger>();
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<MeshUtils>();
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);
}
}
}

View File

@ -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