summaryrefslogtreecommitdiff
path: root/modules/csg
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-04 19:08:43 +0200
committerGitHub <noreply@github.com>2022-05-04 19:08:43 +0200
commit84f64ddde956f5ecba4674750442df89b75556c9 (patch)
tree920e09993cd21dc3f809735a4669b6adaf7cd7cd /modules/csg
parent3a82b7eeef005fdc654aaccadbaa80b4520b5f13 (diff)
parentde0ca3b999819a99a5dcab99f0083a760277b95e (diff)
Merge pull request #60723 from reduz/refactor-module-initialization
Diffstat (limited to 'modules/csg')
-rw-r--r--modules/csg/register_types.cpp32
-rw-r--r--modules/csg/register_types.h6
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