summaryrefslogtreecommitdiff
path: root/modules/gridmap
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-03-28 14:10:28 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-03-28 16:48:15 +0200
commit5fe6984639b5db9efa14103698e489040315ebfb (patch)
tree11a76ba5ab636182d0b0a334bb2ada196ef86e98 /modules/gridmap
parent41d075de5865c8b088c83219431661bc2d1f1802 (diff)
Modules: Don't build editor-specific classes in templates
They're moved to an `editor` subfolder so that we can easily handle them separately.
Diffstat (limited to 'modules/gridmap')
-rw-r--r--modules/gridmap/SCsub3
-rw-r--r--modules/gridmap/editor/grid_map_editor_plugin.cpp (renamed from modules/gridmap/grid_map_editor_plugin.cpp)8
-rw-r--r--modules/gridmap/editor/grid_map_editor_plugin.h (renamed from modules/gridmap/grid_map_editor_plugin.h)8
-rw-r--r--modules/gridmap/register_types.cpp12
4 files changed, 23 insertions, 8 deletions
diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub
index 970ce534f0..52777235b8 100644
--- a/modules/gridmap/SCsub
+++ b/modules/gridmap/SCsub
@@ -5,4 +5,7 @@ Import("env_modules")
env_gridmap = env_modules.Clone()
+# Godot's own source files
env_gridmap.add_source_files(env.modules_sources, "*.cpp")
+if env["tools"]:
+ env_gridmap.add_source_files(env.modules_sources, "editor/*.cpp")
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp
index e8e096d52b..68968325dd 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp
@@ -29,14 +29,16 @@
/*************************************************************************/
#include "grid_map_editor_plugin.h"
+
+#ifdef TOOLS_ENABLED
+
#include "core/input/input.h"
+#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h"
-
-#include "core/os/keyboard.h"
#include "scene/main/window.h"
void GridMapEditor::_node_removed(Node *p_node) {
@@ -1479,3 +1481,5 @@ GridMapEditorPlugin::GridMapEditorPlugin() {
GridMapEditorPlugin::~GridMapEditorPlugin() {
}
+
+#endif // TOOLS_ENABLED
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/editor/grid_map_editor_plugin.h
index c44c4ca7e0..adb0da6e2c 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/editor/grid_map_editor_plugin.h
@@ -31,8 +31,10 @@
#ifndef GRID_MAP_EDITOR_PLUGIN_H
#define GRID_MAP_EDITOR_PLUGIN_H
+#ifdef TOOLS_ENABLED
+
+#include "../grid_map.h"
#include "editor/editor_plugin.h"
-#include "grid_map.h"
#include "scene/gui/item_list.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
@@ -249,4 +251,6 @@ public:
~GridMapEditorPlugin();
};
-#endif // CUBE_GRID_MAP_EDITOR_PLUGIN_H
+#endif // TOOLS_ENABLED
+
+#endif // GRID_MAP_EDITOR_PLUGIN_H
diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp
index f05c5de18b..d7c9f5c92e 100644
--- a/modules/gridmap/register_types.cpp
+++ b/modules/gridmap/register_types.cpp
@@ -28,21 +28,25 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "register_types.h"
#ifndef _3D_DISABLED
+
+#include "register_types.h"
+
#include "core/object/class_db.h"
#include "grid_map.h"
-#include "grid_map_editor_plugin.h"
+
+#ifdef TOOLS_ENABLED
+#include "editor/grid_map_editor_plugin.h"
#endif
void register_gridmap_types() {
-#ifndef _3D_DISABLED
GDREGISTER_CLASS(GridMap);
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<GridMapEditorPlugin>();
#endif
-#endif
}
void unregister_gridmap_types() {
}
+
+#endif // _3D_DISABLED