summaryrefslogtreecommitdiff
path: root/modules/gridmap
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gridmap')
-rw-r--r--modules/gridmap/editor/grid_map_editor_plugin.cpp2
-rw-r--r--modules/gridmap/register_types.cpp15
-rw-r--r--modules/gridmap/register_types.h6
3 files changed, 16 insertions, 7 deletions
diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp
index 68968325dd..2f613768ee 100644
--- a/modules/gridmap/editor/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp
@@ -957,7 +957,7 @@ void GridMapEditor::update_grid() {
}
void GridMapEditor::_draw_grids(const Vector3 &cell_size) {
- Vector3 edited_floor = node->has_meta("_editor_floor_") ? node->get_meta("_editor_floor_") : Variant();
+ Vector3 edited_floor = node->get_meta("_editor_floor_", Vector3());
for (int i = 0; i < 3; i++) {
RS::get_singleton()->mesh_clear(grid[i]);
diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp
index d7c9f5c92e..9efd18a265 100644
--- a/modules/gridmap/register_types.cpp
+++ b/modules/gridmap/register_types.cpp
@@ -39,14 +39,21 @@
#include "editor/grid_map_editor_plugin.h"
#endif
-void register_gridmap_types() {
- GDREGISTER_CLASS(GridMap);
+void initialize_gridmap_module(ModuleInitializationLevel p_level) {
+ if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
+ GDREGISTER_CLASS(GridMap);
+ }
#ifdef TOOLS_ENABLED
- EditorPlugins::add_by_type<GridMapEditorPlugin>();
+ if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
+ EditorPlugins::add_by_type<GridMapEditorPlugin>();
+ }
#endif
}
-void unregister_gridmap_types() {
+void uninitialize_gridmap_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
+ return;
+ }
}
#endif // _3D_DISABLED
diff --git a/modules/gridmap/register_types.h b/modules/gridmap/register_types.h
index fa3511c5d1..28f14cd398 100644
--- a/modules/gridmap/register_types.h
+++ b/modules/gridmap/register_types.h
@@ -31,7 +31,9 @@
#ifndef GRIDMAP_REGISTER_TYPES_H
#define GRIDMAP_REGISTER_TYPES_H
-void register_gridmap_types();
-void unregister_gridmap_types();
+#include "modules/register_module_types.h"
+
+void initialize_gridmap_module(ModuleInitializationLevel p_level);
+void uninitialize_gridmap_module(ModuleInitializationLevel p_level);
#endif // GRIDMAP_REGISTER_TYPES_H