diff --git a/modules/bullet_physics/SCsub b/modules/bullet_physics/SCsub index 511d919b..935abe2d 100644 --- a/modules/bullet_physics/SCsub +++ b/modules/bullet_physics/SCsub @@ -223,3 +223,6 @@ if env["builtin_bullet"]: # Bullet Physics ECS env_bullet.add_source_files(env.modules_sources, "*.cpp") + +if env_bullet.editor_build: + env_bullet.add_source_files(env.modules_sources, "editor/*.cpp") diff --git a/modules/bullet_physics/components_gizmos.cpp b/modules/bullet_physics/editor/components_gizmos.cpp similarity index 99% rename from modules/bullet_physics/components_gizmos.cpp rename to modules/bullet_physics/editor/components_gizmos.cpp index 2e7b91d0..6457428a 100644 --- a/modules/bullet_physics/components_gizmos.cpp +++ b/modules/bullet_physics/editor/components_gizmos.cpp @@ -1,10 +1,10 @@ #include "components_gizmos.h" -#include "debug_utilities.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" #include "editor/editor_undo_redo_manager.h" #include "editor/plugins/node_3d_editor_plugin.h" +#include "../debug_utilities.h" void BtBoxGizmo::init() { const Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); @@ -752,6 +752,7 @@ void BtConvexGizmo::init() { } void BtConvexGizmo::redraw(EditorNode3DGizmo *p_gizmo) { +#ifdef TOOLS_ENABLED Entity3D *entity = static_cast(p_gizmo->get_node_3d()); ERR_FAIL_COND(entity == nullptr); @@ -767,7 +768,6 @@ void BtConvexGizmo::redraw(EditorNode3DGizmo *p_gizmo) { mesh = td->mesh; } } - if (mesh.is_null()) { const Vector points = entity->get_component_value(convex_component_name, points_name); mesh = generate_mesh_from_points(points); @@ -778,6 +778,7 @@ void BtConvexGizmo::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->add_mesh(mesh, material); } +#endif } int BtConvexGizmo::get_handle_count(const EditorNode3DGizmo *p_gizmo) const { @@ -804,6 +805,7 @@ void BtTrimeshGizmo::init() { } void BtTrimeshGizmo::redraw(EditorNode3DGizmo *p_gizmo) { +#ifdef TOOLS_ENABLED Entity3D *entity = static_cast(p_gizmo->get_node_3d()); ERR_FAIL_COND(entity == nullptr); @@ -819,7 +821,6 @@ void BtTrimeshGizmo::redraw(EditorNode3DGizmo *p_gizmo) { mesh = td->mesh; } } - if (mesh.is_null()) { const Vector faces = entity->get_component_value(trimesh_component_name, faces_name); mesh = generate_mesh_from_faces(faces); @@ -830,6 +831,7 @@ void BtTrimeshGizmo::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->add_mesh(mesh, material); } +#endif } int BtTrimeshGizmo::get_handle_count(const EditorNode3DGizmo *p_gizmo) const { diff --git a/modules/bullet_physics/components_gizmos.h b/modules/bullet_physics/editor/components_gizmos.h similarity index 99% rename from modules/bullet_physics/components_gizmos.h rename to modules/bullet_physics/editor/components_gizmos.h index ae3038de..566548a4 100644 --- a/modules/bullet_physics/components_gizmos.h +++ b/modules/bullet_physics/editor/components_gizmos.h @@ -1,6 +1,6 @@ #pragma once -#include "../godot/editor_plugins/components_gizmo_3d.h" +#include "../../godot/editor_plugins/components_gizmo_3d.h" class BtBoxGizmo : public ComponentGizmo { StringName box_component_name = "BtBox"; diff --git a/modules/bullet_physics/register_types.cpp b/modules/bullet_physics/register_types.cpp index 9f8827a3..9ef59002 100644 --- a/modules/bullet_physics/register_types.cpp +++ b/modules/bullet_physics/register_types.cpp @@ -4,7 +4,9 @@ #include "../godot/editor_plugins/components_gizmo_3d.h" #include "components_area.h" #include "components_generic.h" -#include "components_gizmos.h" +#ifdef TOOLS_ENABLED +#include "editor/components_gizmos.h" +#endif #include "components_pawn.h" #include "components_rigid_body.h" #include "databag_space.h" @@ -153,6 +155,7 @@ void initialize_bullet_physics_module(ModuleInitializationLevel p_level) { .add("BtOverlapCheck"); } else if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) { +#ifdef TOOLS_ENABLED // Register gizmos Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtBoxGizmo)); Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtSphereGizmo)); @@ -162,6 +165,7 @@ void initialize_bullet_physics_module(ModuleInitializationLevel p_level) { Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtConvexGizmo)); Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtTrimeshGizmo)); Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtPawnGizmo)); +#endif } } diff --git a/modules/godot/SCsub b/modules/godot/SCsub index 40165c6f..c9885e14 100644 --- a/modules/godot/SCsub +++ b/modules/godot/SCsub @@ -8,7 +8,9 @@ env_godot_module = env_modules.Clone() env_godot_module.add_source_files(env.modules_sources, "*.cpp") env_godot_module.add_source_files(env.modules_sources, "components/*.cpp") env_godot_module.add_source_files(env.modules_sources, "components/physics/*.cpp") -env_godot_module.add_source_files(env.modules_sources, "editor_plugins/*.cpp") env_godot_module.add_source_files(env.modules_sources, "nodes/*.cpp") env_godot_module.add_source_files(env.modules_sources, "databags/*.cpp") env_godot_module.add_source_files(env.modules_sources, "systems/*.cpp") + +if env_godot_module.editor_build: + env_godot_module.add_source_files(env.modules_sources, "editor_plugins/*.cpp") diff --git a/modules/godot/nodes/ecs_utilities.cpp b/modules/godot/nodes/ecs_utilities.cpp index 52fb1e7c..62946ee4 100644 --- a/modules/godot/nodes/ecs_utilities.cpp +++ b/modules/godot/nodes/ecs_utilities.cpp @@ -7,9 +7,11 @@ #include "core/config/project_settings.h" #include "core/io/resource_loader.h" #include "core/object/script_language.h" -#include "editor/editor_node.h" #include "entity.h" #include "shared_component_resource.h" +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#endif void System::_bind_methods() { ClassDB::bind_method(D_METHOD("execute_in", "phase", "dispatcher"), &System::execute_in, DEFVAL(godex::SYSTEM_NONE)); @@ -113,13 +115,13 @@ void System::prepare(godex::DynamicSystemExecutionData *p_info) { String System::validate_script(Ref