diff options
Diffstat (limited to 'modules/csg')
-rw-r--r-- | modules/csg/register_types.cpp | 32 | ||||
-rw-r--r-- | modules/csg/register_types.h | 6 |
2 files changed, 23 insertions, 15 deletions
diff --git a/modules/csg/register_types.cpp b/modules/csg/register_types.cpp index 72ed027dc9..9b5888dafe 100644 --- a/modules/csg/register_types.cpp +++ b/modules/csg/register_types.cpp @@ -38,23 +38,29 @@ #include "editor/csg_gizmos.h" #endif -void register_csg_types() { - GDREGISTER_ABSTRACT_CLASS(CSGShape3D); - GDREGISTER_ABSTRACT_CLASS(CSGPrimitive3D); - GDREGISTER_CLASS(CSGMesh3D); - GDREGISTER_CLASS(CSGSphere3D); - GDREGISTER_CLASS(CSGBox3D); - GDREGISTER_CLASS(CSGCylinder3D); - GDREGISTER_CLASS(CSGTorus3D); - GDREGISTER_CLASS(CSGPolygon3D); - GDREGISTER_CLASS(CSGCombiner3D); - +void initialize_csg_module(ModuleInitializationLevel p_level) { + if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) { + GDREGISTER_ABSTRACT_CLASS(CSGShape3D); + GDREGISTER_ABSTRACT_CLASS(CSGPrimitive3D); + GDREGISTER_CLASS(CSGMesh3D); + GDREGISTER_CLASS(CSGSphere3D); + GDREGISTER_CLASS(CSGBox3D); + GDREGISTER_CLASS(CSGCylinder3D); + GDREGISTER_CLASS(CSGTorus3D); + GDREGISTER_CLASS(CSGPolygon3D); + GDREGISTER_CLASS(CSGCombiner3D); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type<EditorPluginCSG>(); + if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type<EditorPluginCSG>(); + } #endif } -void unregister_csg_types() { +void uninitialize_csg_module(ModuleInitializationLevel p_level) { + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { + return; + } } #endif // _3D_DISABLED diff --git a/modules/csg/register_types.h b/modules/csg/register_types.h index 59d84dd52a..ec65adde9c 100644 --- a/modules/csg/register_types.h +++ b/modules/csg/register_types.h @@ -31,7 +31,9 @@ #ifndef CSG_REGISTER_TYPES_H #define CSG_REGISTER_TYPES_H -void register_csg_types(); -void unregister_csg_types(); +#include "modules/register_module_types.h" + +void initialize_csg_module(ModuleInitializationLevel p_level); +void uninitialize_csg_module(ModuleInitializationLevel p_level); #endif // CSG_REGISTER_TYPES_H |