summaryrefslogtreecommitdiff
path: root/modules/csg
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/csg
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/csg')
-rw-r--r--modules/csg/SCsub3
-rw-r--r--modules/csg/editor/csg_gizmos.cpp (renamed from modules/csg/csg_gizmos.cpp)4
-rw-r--r--modules/csg/editor/csg_gizmos.h (renamed from modules/csg/csg_gizmos.h)6
-rw-r--r--modules/csg/register_types.cpp12
4 files changed, 20 insertions, 5 deletions
diff --git a/modules/csg/SCsub b/modules/csg/SCsub
index 641a42c187..c7307ddefd 100644
--- a/modules/csg/SCsub
+++ b/modules/csg/SCsub
@@ -3,7 +3,10 @@
Import("env")
Import("env_modules")
+# Godot's own source files
env_csg = env_modules.Clone()
# Godot's own source files
env_csg.add_source_files(env.modules_sources, "*.cpp")
+if env["tools"]:
+ env_csg.add_source_files(env.modules_sources, "editor/*.cpp")
diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/editor/csg_gizmos.cpp
index 95a0fc7ada..be29810252 100644
--- a/modules/csg/csg_gizmos.cpp
+++ b/modules/csg/editor/csg_gizmos.cpp
@@ -30,6 +30,8 @@
#include "csg_gizmos.h"
+#ifdef TOOLS_ENABLED
+
#include "editor/editor_settings.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h"
@@ -425,3 +427,5 @@ EditorPluginCSG::EditorPluginCSG() {
Ref<CSGShape3DGizmoPlugin> gizmo_plugin = Ref<CSGShape3DGizmoPlugin>(memnew(CSGShape3DGizmoPlugin));
Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
}
+
+#endif // TOOLS_ENABLED
diff --git a/modules/csg/csg_gizmos.h b/modules/csg/editor/csg_gizmos.h
index 43efe57e64..fa51010f98 100644
--- a/modules/csg/csg_gizmos.h
+++ b/modules/csg/editor/csg_gizmos.h
@@ -31,7 +31,9 @@
#ifndef CSG_GIZMOS_H
#define CSG_GIZMOS_H
-#include "csg_shape.h"
+#ifdef TOOLS_ENABLED
+
+#include "../csg_shape.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/node_3d_editor_gizmos.h"
@@ -60,4 +62,6 @@ public:
EditorPluginCSG();
};
+#endif // TOOLS_ENABLED
+
#endif // CSG_GIZMOS_H
diff --git a/modules/csg/register_types.cpp b/modules/csg/register_types.cpp
index f8db42b1a9..72ed027dc9 100644
--- a/modules/csg/register_types.cpp
+++ b/modules/csg/register_types.cpp
@@ -30,12 +30,15 @@
#include "register_types.h"
-#include "csg_gizmos.h"
+#ifndef _3D_DISABLED
+
#include "csg_shape.h"
-void register_csg_types() {
-#ifndef _3D_DISABLED
+#ifdef TOOLS_ENABLED
+#include "editor/csg_gizmos.h"
+#endif
+void register_csg_types() {
GDREGISTER_ABSTRACT_CLASS(CSGShape3D);
GDREGISTER_ABSTRACT_CLASS(CSGPrimitive3D);
GDREGISTER_CLASS(CSGMesh3D);
@@ -49,8 +52,9 @@ void register_csg_types() {
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<EditorPluginCSG>();
#endif
-#endif
}
void unregister_csg_types() {
}
+
+#endif // _3D_DISABLED