From a36b7a8ab6943b1a961808c910edccdf1b8ce883 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 31 Mar 2020 00:57:58 +0200 Subject: [PATCH] Fix linux build with tools=no. --- SCsub | 6 +++++- prop_tool/prop_tool.cpp | 6 +++++- prop_tool/prop_tool.h | 2 ++ prop_tool/prop_tool_editor_plugin.cpp | 5 +++++ prop_tool/prop_tool_editor_plugin.h | 13 ++----------- prop_tool/prop_tool_entity.cpp | 4 ++++ prop_tool/prop_tool_entity.h | 2 ++ prop_tool/prop_tool_light.cpp | 4 ++++ prop_tool/prop_tool_light.h | 2 ++ prop_tool/prop_tool_mesh.cpp | 4 ++++ prop_tool/prop_tool_mesh.h | 2 ++ prop_tool/prop_tool_prop.cpp | 4 ++++ prop_tool/prop_tool_prop.h | 2 ++ prop_tool/prop_tool_scene.cpp | 4 ++++ prop_tool/prop_tool_scene.h | 2 ++ register_types.cpp | 8 ++++---- 16 files changed, 53 insertions(+), 17 deletions(-) diff --git a/SCsub b/SCsub index f4de6ff..3c93bc5 100644 --- a/SCsub +++ b/SCsub @@ -64,9 +64,13 @@ sources = [ "prop_tool/prop_tool_scene.cpp", "prop_tool/prop_tool_light.cpp", "prop_tool/prop_tool_mesh.cpp", - "prop_tool/prop_tool_editor_plugin.cpp", + + ] +if env['tools']: + sources.append("prop_tool/prop_tool_editor_plugin.cpp") + if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': # Shared lib compilation module_env.Append(CCFLAGS=['-fPIC']) diff --git a/prop_tool/prop_tool.cpp b/prop_tool/prop_tool.cpp index 347bf11..282b45e 100644 --- a/prop_tool/prop_tool.cpp +++ b/prop_tool/prop_tool.cpp @@ -1,5 +1,7 @@ #include "prop_tool.h" +#ifdef TOOLS_ENABLED + #include "../props/prop_data.h" #include "../props/prop_data_entity.h" #include "../props/prop_data_light.h" @@ -206,4 +208,6 @@ PropTool::~PropTool() { } void PropTool::_bind_methods() { -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/prop_tool/prop_tool.h b/prop_tool/prop_tool.h index 7a8569e..2255fc8 100644 --- a/prop_tool/prop_tool.h +++ b/prop_tool/prop_tool.h @@ -37,6 +37,7 @@ class PropToolEditorPlugin; class PropTool : public Spatial { GDCLASS(PropTool, Spatial); +#ifdef TOOLS_ENABLED public: void edit(const Ref &prop); @@ -64,6 +65,7 @@ private: bool _snap_to_mesh; Vector3 _snap_axis; PropToolEditorPlugin *_plugin; +#endif }; #endif diff --git a/prop_tool/prop_tool_editor_plugin.cpp b/prop_tool/prop_tool_editor_plugin.cpp index 12d7a6d..4df37bb 100644 --- a/prop_tool/prop_tool_editor_plugin.cpp +++ b/prop_tool/prop_tool_editor_plugin.cpp @@ -25,14 +25,19 @@ SOFTWARE. #include "core/os/dir_access.h" #include "core/os/file_access.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" #include "scene/resources/packed_scene.h" +#include "../props/prop_data.h" + #include "prop_tool.h" #include "prop_tool_entity.h" #include "prop_tool_light.h" #include "prop_tool_mesh.h" #include "prop_tool_scene.h" +#include "editor/plugins/spatial_editor_plugin.h" + void PropToolEditorPlugin::edit(Object *p_object) { Ref pedited_prop(Object::cast_to(p_object)); diff --git a/prop_tool/prop_tool_editor_plugin.h b/prop_tool/prop_tool_editor_plugin.h index 483de36..494a6c4 100644 --- a/prop_tool/prop_tool_editor_plugin.h +++ b/prop_tool/prop_tool_editor_plugin.h @@ -23,19 +23,10 @@ SOFTWARE. #ifndef PROP_TOOL_EDITOR_PLUGIN_H #define PROP_TOOL_EDITOR_PLUGIN_H +#include "editor/editor_node.h" #include "editor/editor_plugin.h" -#include "editor/pane_drag.h" - -#include "scene/gui/graph_edit.h" -#include "scene/gui/menu_button.h" -#include "scene/main/viewport.h" - -#include "../props/prop_data.h" - -#include "scene/gui/viewport_container.h" - -#include "editor/plugins/spatial_editor_plugin.h" +class PropData; class PropTool; class PropToolEditorPlugin : public EditorPlugin { diff --git a/prop_tool/prop_tool_entity.cpp b/prop_tool/prop_tool_entity.cpp index 75371ed..d382307 100644 --- a/prop_tool/prop_tool_entity.cpp +++ b/prop_tool/prop_tool_entity.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "prop_tool_entity.h" +#ifdef TOOLS_ENABLED + #include "../../entity_spell_system/entities/data/entity_data.h" #include "../../entity_spell_system/entities/entity.h" @@ -146,3 +148,5 @@ void PropToolEntity::_bind_methods() { ClassDB::bind_method(D_METHOD("evaluate_children"), &PropToolEntity::evaluate_children); } + +#endif \ No newline at end of file diff --git a/prop_tool/prop_tool_entity.h b/prop_tool/prop_tool_entity.h index 72ab665..31a2d09 100644 --- a/prop_tool/prop_tool_entity.h +++ b/prop_tool/prop_tool_entity.h @@ -34,6 +34,7 @@ class Entity; class PropToolEntity : public Spatial { GDCLASS(PropToolEntity, Spatial); +#ifdef TOOLS_ENABLED public: Ref get_data(); void set_data(const Ref &data); @@ -62,6 +63,7 @@ private: Ref _prop_entity; Entity *_entity; +#endif }; #endif diff --git a/prop_tool/prop_tool_light.cpp b/prop_tool/prop_tool_light.cpp index 06c2f33..274c9c9 100644 --- a/prop_tool/prop_tool_light.cpp +++ b/prop_tool/prop_tool_light.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "prop_tool_light.h" +#ifdef TOOLS_ENABLED + Ref PropToolLight::get_data() { if (!is_visible()) @@ -68,3 +70,5 @@ void PropToolLight::_bind_methods() { ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &PropToolLight::set_snap_to_mesh); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "snap_to_mesh"), "set_snap_to_mesh", "get_snap_to_mesh"); } + +#endif \ No newline at end of file diff --git a/prop_tool/prop_tool_light.h b/prop_tool/prop_tool_light.h index 0d4b612..8e9c0ac 100644 --- a/prop_tool/prop_tool_light.h +++ b/prop_tool/prop_tool_light.h @@ -35,6 +35,7 @@ class propData; class PropToolLight : public OmniLight { GDCLASS(PropToolLight, OmniLight); +#ifdef TOOLS_ENABLED public: Ref get_data(); void set_data(const Ref &data); @@ -51,6 +52,7 @@ protected: private: Ref _prop_light; bool _snap_to_mesh; +#endif }; #endif diff --git a/prop_tool/prop_tool_mesh.cpp b/prop_tool/prop_tool_mesh.cpp index 08c6dac..33f09cf 100644 --- a/prop_tool/prop_tool_mesh.cpp +++ b/prop_tool/prop_tool_mesh.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "prop_tool_mesh.h" +#ifdef TOOLS_ENABLED + Ref PropToolMesh::get_mesh_data() { return _mesh_data; } @@ -177,3 +179,5 @@ void PropToolMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("set_generate"), &PropToolMesh::set_generate); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "generate"), "set_generate", "get_generate"); } + +#endif \ No newline at end of file diff --git a/prop_tool/prop_tool_mesh.h b/prop_tool/prop_tool_mesh.h index 8b640ce..9fa77f5 100644 --- a/prop_tool/prop_tool_mesh.h +++ b/prop_tool/prop_tool_mesh.h @@ -31,6 +31,7 @@ SOFTWARE. class PropToolMesh : public MeshInstance { GDCLASS(PropToolMesh, MeshInstance); +#ifdef TOOLS_ENABLED public: Ref get_mesh_data(); void set_mesh_data(const Ref &data); @@ -68,6 +69,7 @@ private: Ref _material; bool _snap_to_mesh; Vector3 _snap_axis; +#endif }; #endif diff --git a/prop_tool/prop_tool_prop.cpp b/prop_tool/prop_tool_prop.cpp index 52b0776..5317e55 100644 --- a/prop_tool/prop_tool_prop.cpp +++ b/prop_tool/prop_tool_prop.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "prop_tool_prop.h" +#ifdef TOOLS_ENABLED + Ref PropToolProp::get_data() { if (!is_visible() || !_prop_data.is_valid()) return Ref(); @@ -93,3 +95,5 @@ void PropToolProp::_bind_methods() { ClassDB::bind_method(D_METHOD("set_prop_data", "value"), &PropToolProp::set_prop_data); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_data", PROPERTY_HINT_RESOURCE_TYPE, "PropData"), "set_prop_data", "get_prop_data"); } + +#endif \ No newline at end of file diff --git a/prop_tool/prop_tool_prop.h b/prop_tool/prop_tool_prop.h index 091fae4..c3d9d1a 100644 --- a/prop_tool/prop_tool_prop.h +++ b/prop_tool/prop_tool_prop.h @@ -31,6 +31,7 @@ SOFTWARE. class PropToolProp : public Spatial { GDCLASS(PropToolProp, Spatial); +#ifdef TOOLS_ENABLED public: Ref get_data(); void set_data(const Ref &data); @@ -55,6 +56,7 @@ private: bool _snap_to_mesh; Vector3 _snap_axis; Ref _prop_prop; +#endif }; #endif diff --git a/prop_tool/prop_tool_scene.cpp b/prop_tool/prop_tool_scene.cpp index 3409e65..1e4bf24 100644 --- a/prop_tool/prop_tool_scene.cpp +++ b/prop_tool/prop_tool_scene.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "prop_tool_scene.h" +#ifdef TOOLS_ENABLED + Ref PropToolScene::get_data() { if (!is_visible() || !_scene_data.is_valid()) return Ref(); @@ -93,3 +95,5 @@ void PropToolScene::_bind_methods() { ClassDB::bind_method(D_METHOD("set_scene_data", "value"), &PropToolScene::set_scene_data); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "scene_data", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_scene_data", "get_scene_data"); } + +#endif \ No newline at end of file diff --git a/prop_tool/prop_tool_scene.h b/prop_tool/prop_tool_scene.h index 412ddb8..744d43a 100644 --- a/prop_tool/prop_tool_scene.h +++ b/prop_tool/prop_tool_scene.h @@ -30,6 +30,7 @@ SOFTWARE. class PropToolScene : public Spatial { GDCLASS(PropToolScene, Spatial); +#ifdef TOOLS_ENABLED public: Ref get_data(); void set_data(const Ref &data); @@ -54,6 +55,7 @@ private: bool _snap_to_mesh; Vector3 _snap_axis; Ref _prop_scene; +#endif }; #endif diff --git a/register_types.cpp b/register_types.cpp index 6a1d46c..f8e60fb 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -67,13 +67,16 @@ SOFTWARE. #include "world/voxel_world_editor.h" #include "prop_tool/prop_tool.h" -#include "prop_tool/prop_tool_editor_plugin.h" #include "prop_tool/prop_tool_entity.h" #include "prop_tool/prop_tool_light.h" #include "prop_tool/prop_tool_mesh.h" #include "prop_tool/prop_tool_prop.h" #include "prop_tool/prop_tool_scene.h" +#ifdef TOOLS_ENABLED +#include "prop_tool/prop_tool_editor_plugin.h" +#endif + void register_voxelman_types() { ClassDB::register_class(); ClassDB::register_class(); @@ -126,9 +129,6 @@ void register_voxelman_types() { #ifdef TOOLS_ENABLED EditorPlugins::add_by_type(); -#endif - -#ifdef TOOLS_ENABLED EditorPlugins::add_by_type(); #endif }