Fix linux build with tools=no.

This commit is contained in:
Relintai 2020-03-31 00:57:58 +02:00
parent 3969e0ba5f
commit a36b7a8ab6
16 changed files with 53 additions and 17 deletions

6
SCsub
View File

@ -64,9 +64,13 @@ sources = [
"prop_tool/prop_tool_scene.cpp", "prop_tool/prop_tool_scene.cpp",
"prop_tool/prop_tool_light.cpp", "prop_tool/prop_tool_light.cpp",
"prop_tool/prop_tool_mesh.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': if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
# Shared lib compilation # Shared lib compilation
module_env.Append(CCFLAGS=['-fPIC']) module_env.Append(CCFLAGS=['-fPIC'])

View File

@ -1,5 +1,7 @@
#include "prop_tool.h" #include "prop_tool.h"
#ifdef TOOLS_ENABLED
#include "../props/prop_data.h" #include "../props/prop_data.h"
#include "../props/prop_data_entity.h" #include "../props/prop_data_entity.h"
#include "../props/prop_data_light.h" #include "../props/prop_data_light.h"
@ -206,4 +208,6 @@ PropTool::~PropTool() {
} }
void PropTool::_bind_methods() { void PropTool::_bind_methods() {
} }
#endif

View File

@ -37,6 +37,7 @@ class PropToolEditorPlugin;
class PropTool : public Spatial { class PropTool : public Spatial {
GDCLASS(PropTool, Spatial); GDCLASS(PropTool, Spatial);
#ifdef TOOLS_ENABLED
public: public:
void edit(const Ref<PropData> &prop); void edit(const Ref<PropData> &prop);
@ -64,6 +65,7 @@ private:
bool _snap_to_mesh; bool _snap_to_mesh;
Vector3 _snap_axis; Vector3 _snap_axis;
PropToolEditorPlugin *_plugin; PropToolEditorPlugin *_plugin;
#endif
}; };
#endif #endif

View File

@ -25,14 +25,19 @@ SOFTWARE.
#include "core/os/dir_access.h" #include "core/os/dir_access.h"
#include "core/os/file_access.h" #include "core/os/file_access.h"
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
#include "../props/prop_data.h"
#include "prop_tool.h" #include "prop_tool.h"
#include "prop_tool_entity.h" #include "prop_tool_entity.h"
#include "prop_tool_light.h" #include "prop_tool_light.h"
#include "prop_tool_mesh.h" #include "prop_tool_mesh.h"
#include "prop_tool_scene.h" #include "prop_tool_scene.h"
#include "editor/plugins/spatial_editor_plugin.h"
void PropToolEditorPlugin::edit(Object *p_object) { void PropToolEditorPlugin::edit(Object *p_object) {
Ref<PropData> pedited_prop(Object::cast_to<PropData>(p_object)); Ref<PropData> pedited_prop(Object::cast_to<PropData>(p_object));

View File

@ -23,19 +23,10 @@ SOFTWARE.
#ifndef PROP_TOOL_EDITOR_PLUGIN_H #ifndef PROP_TOOL_EDITOR_PLUGIN_H
#define PROP_TOOL_EDITOR_PLUGIN_H #define PROP_TOOL_EDITOR_PLUGIN_H
#include "editor/editor_node.h"
#include "editor/editor_plugin.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 PropTool;
class PropToolEditorPlugin : public EditorPlugin { class PropToolEditorPlugin : public EditorPlugin {

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "prop_tool_entity.h" #include "prop_tool_entity.h"
#ifdef TOOLS_ENABLED
#include "../../entity_spell_system/entities/data/entity_data.h" #include "../../entity_spell_system/entities/data/entity_data.h"
#include "../../entity_spell_system/entities/entity.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); ClassDB::bind_method(D_METHOD("evaluate_children"), &PropToolEntity::evaluate_children);
} }
#endif

View File

@ -34,6 +34,7 @@ class Entity;
class PropToolEntity : public Spatial { class PropToolEntity : public Spatial {
GDCLASS(PropToolEntity, Spatial); GDCLASS(PropToolEntity, Spatial);
#ifdef TOOLS_ENABLED
public: public:
Ref<PropDataEntity> get_data(); Ref<PropDataEntity> get_data();
void set_data(const Ref<PropDataEntity> &data); void set_data(const Ref<PropDataEntity> &data);
@ -62,6 +63,7 @@ private:
Ref<PropDataEntity> _prop_entity; Ref<PropDataEntity> _prop_entity;
Entity *_entity; Entity *_entity;
#endif
}; };
#endif #endif

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "prop_tool_light.h" #include "prop_tool_light.h"
#ifdef TOOLS_ENABLED
Ref<PropDataLight> PropToolLight::get_data() { Ref<PropDataLight> PropToolLight::get_data() {
if (!is_visible()) 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); 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"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "snap_to_mesh"), "set_snap_to_mesh", "get_snap_to_mesh");
} }
#endif

View File

@ -35,6 +35,7 @@ class propData;
class PropToolLight : public OmniLight { class PropToolLight : public OmniLight {
GDCLASS(PropToolLight, OmniLight); GDCLASS(PropToolLight, OmniLight);
#ifdef TOOLS_ENABLED
public: public:
Ref<PropDataLight> get_data(); Ref<PropDataLight> get_data();
void set_data(const Ref<PropDataLight> &data); void set_data(const Ref<PropDataLight> &data);
@ -51,6 +52,7 @@ protected:
private: private:
Ref<PropDataLight> _prop_light; Ref<PropDataLight> _prop_light;
bool _snap_to_mesh; bool _snap_to_mesh;
#endif
}; };
#endif #endif

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "prop_tool_mesh.h" #include "prop_tool_mesh.h"
#ifdef TOOLS_ENABLED
Ref<MeshDataResource> PropToolMesh::get_mesh_data() { Ref<MeshDataResource> PropToolMesh::get_mesh_data() {
return _mesh_data; return _mesh_data;
} }
@ -177,3 +179,5 @@ void PropToolMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_generate"), &PropToolMesh::set_generate); ClassDB::bind_method(D_METHOD("set_generate"), &PropToolMesh::set_generate);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "generate"), "set_generate", "get_generate"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "generate"), "set_generate", "get_generate");
} }
#endif

View File

@ -31,6 +31,7 @@ SOFTWARE.
class PropToolMesh : public MeshInstance { class PropToolMesh : public MeshInstance {
GDCLASS(PropToolMesh, MeshInstance); GDCLASS(PropToolMesh, MeshInstance);
#ifdef TOOLS_ENABLED
public: public:
Ref<MeshDataResource> get_mesh_data(); Ref<MeshDataResource> get_mesh_data();
void set_mesh_data(const Ref<MeshDataResource> &data); void set_mesh_data(const Ref<MeshDataResource> &data);
@ -68,6 +69,7 @@ private:
Ref<SpatialMaterial> _material; Ref<SpatialMaterial> _material;
bool _snap_to_mesh; bool _snap_to_mesh;
Vector3 _snap_axis; Vector3 _snap_axis;
#endif
}; };
#endif #endif

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "prop_tool_prop.h" #include "prop_tool_prop.h"
#ifdef TOOLS_ENABLED
Ref<PropDataProp> PropToolProp::get_data() { Ref<PropDataProp> PropToolProp::get_data() {
if (!is_visible() || !_prop_data.is_valid()) if (!is_visible() || !_prop_data.is_valid())
return Ref<PropDataProp>(); return Ref<PropDataProp>();
@ -93,3 +95,5 @@ void PropToolProp::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_prop_data", "value"), &PropToolProp::set_prop_data); 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"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_data", PROPERTY_HINT_RESOURCE_TYPE, "PropData"), "set_prop_data", "get_prop_data");
} }
#endif

View File

@ -31,6 +31,7 @@ SOFTWARE.
class PropToolProp : public Spatial { class PropToolProp : public Spatial {
GDCLASS(PropToolProp, Spatial); GDCLASS(PropToolProp, Spatial);
#ifdef TOOLS_ENABLED
public: public:
Ref<PropDataProp> get_data(); Ref<PropDataProp> get_data();
void set_data(const Ref<PropDataProp> &data); void set_data(const Ref<PropDataProp> &data);
@ -55,6 +56,7 @@ private:
bool _snap_to_mesh; bool _snap_to_mesh;
Vector3 _snap_axis; Vector3 _snap_axis;
Ref<PropDataProp> _prop_prop; Ref<PropDataProp> _prop_prop;
#endif
}; };
#endif #endif

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "prop_tool_scene.h" #include "prop_tool_scene.h"
#ifdef TOOLS_ENABLED
Ref<PropDataScene> PropToolScene::get_data() { Ref<PropDataScene> PropToolScene::get_data() {
if (!is_visible() || !_scene_data.is_valid()) if (!is_visible() || !_scene_data.is_valid())
return Ref<PropDataScene>(); return Ref<PropDataScene>();
@ -93,3 +95,5 @@ void PropToolScene::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_scene_data", "value"), &PropToolScene::set_scene_data); 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"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "scene_data", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_scene_data", "get_scene_data");
} }
#endif

View File

@ -30,6 +30,7 @@ SOFTWARE.
class PropToolScene : public Spatial { class PropToolScene : public Spatial {
GDCLASS(PropToolScene, Spatial); GDCLASS(PropToolScene, Spatial);
#ifdef TOOLS_ENABLED
public: public:
Ref<PropDataScene> get_data(); Ref<PropDataScene> get_data();
void set_data(const Ref<PropDataScene> &data); void set_data(const Ref<PropDataScene> &data);
@ -54,6 +55,7 @@ private:
bool _snap_to_mesh; bool _snap_to_mesh;
Vector3 _snap_axis; Vector3 _snap_axis;
Ref<PropDataScene> _prop_scene; Ref<PropDataScene> _prop_scene;
#endif
}; };
#endif #endif

View File

@ -67,13 +67,16 @@ SOFTWARE.
#include "world/voxel_world_editor.h" #include "world/voxel_world_editor.h"
#include "prop_tool/prop_tool.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_entity.h"
#include "prop_tool/prop_tool_light.h" #include "prop_tool/prop_tool_light.h"
#include "prop_tool/prop_tool_mesh.h" #include "prop_tool/prop_tool_mesh.h"
#include "prop_tool/prop_tool_prop.h" #include "prop_tool/prop_tool_prop.h"
#include "prop_tool/prop_tool_scene.h" #include "prop_tool/prop_tool_scene.h"
#ifdef TOOLS_ENABLED
#include "prop_tool/prop_tool_editor_plugin.h"
#endif
void register_voxelman_types() { void register_voxelman_types() {
ClassDB::register_class<VoxelmanQueue>(); ClassDB::register_class<VoxelmanQueue>();
ClassDB::register_class<VoxelmanUnboundedQueue>(); ClassDB::register_class<VoxelmanUnboundedQueue>();
@ -126,9 +129,6 @@ void register_voxelman_types() {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<VoxelWorldEditorPlugin>(); EditorPlugins::add_by_type<VoxelWorldEditorPlugin>();
#endif
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<PropToolEditorPlugin>(); EditorPlugins::add_by_type<PropToolEditorPlugin>();
#endif #endif
} }