Skip to content

Commit 39e8f43

Browse files
committed
Fix building export templates
1 parent 76b6755 commit 39e8f43

File tree

13 files changed

+146
-55
lines changed

13 files changed

+146
-55
lines changed

modules/bullet_physics/SCsub

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,6 @@ if env["builtin_bullet"]:
223223

224224
# Bullet Physics ECS
225225
env_bullet.add_source_files(env.modules_sources, "*.cpp")
226+
227+
if env_bullet.editor_build:
228+
env_bullet.add_source_files(env.modules_sources, "editor/*.cpp")

modules/bullet_physics/components_gizmos.cpp renamed to modules/bullet_physics/editor/components_gizmos.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "components_gizmos.h"
22

3-
#include "debug_utilities.h"
43
#include "editor/editor_node.h"
54
#include "editor/editor_settings.h"
65
#include "editor/editor_undo_redo_manager.h"
76
#include "editor/plugins/node_3d_editor_plugin.h"
7+
#include "modules/bullet_physics/debug_utilities.h"
88

99
void BtBoxGizmo::init() {
1010
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() {
752752
}
753753

754754
void BtConvexGizmo::redraw(EditorNode3DGizmo *p_gizmo) {
755+
#ifdef TOOLS_ENABLED
755756
Entity3D *entity = static_cast<Entity3D *>(p_gizmo->get_node_3d());
756757
ERR_FAIL_COND(entity == nullptr);
757758

@@ -767,7 +768,6 @@ void BtConvexGizmo::redraw(EditorNode3DGizmo *p_gizmo) {
767768
mesh = td->mesh;
768769
}
769770
}
770-
771771
if (mesh.is_null()) {
772772
const Vector<Vector3> points = entity->get_component_value(convex_component_name, points_name);
773773
mesh = generate_mesh_from_points(points);
@@ -778,6 +778,7 @@ void BtConvexGizmo::redraw(EditorNode3DGizmo *p_gizmo) {
778778

779779
p_gizmo->add_mesh(mesh, material);
780780
}
781+
#endif
781782
}
782783

783784
int BtConvexGizmo::get_handle_count(const EditorNode3DGizmo *p_gizmo) const {
@@ -804,6 +805,7 @@ void BtTrimeshGizmo::init() {
804805
}
805806

806807
void BtTrimeshGizmo::redraw(EditorNode3DGizmo *p_gizmo) {
808+
#ifdef TOOLS_ENABLED
807809
Entity3D *entity = static_cast<Entity3D *>(p_gizmo->get_node_3d());
808810
ERR_FAIL_COND(entity == nullptr);
809811

@@ -819,7 +821,6 @@ void BtTrimeshGizmo::redraw(EditorNode3DGizmo *p_gizmo) {
819821
mesh = td->mesh;
820822
}
821823
}
822-
823824
if (mesh.is_null()) {
824825
const Vector<Vector3> faces = entity->get_component_value(trimesh_component_name, faces_name);
825826
mesh = generate_mesh_from_faces(faces);
@@ -830,6 +831,7 @@ void BtTrimeshGizmo::redraw(EditorNode3DGizmo *p_gizmo) {
830831

831832
p_gizmo->add_mesh(mesh, material);
832833
}
834+
#endif
833835
}
834836

835837
int BtTrimeshGizmo::get_handle_count(const EditorNode3DGizmo *p_gizmo) const {

modules/bullet_physics/components_gizmos.h renamed to modules/bullet_physics/editor/components_gizmos.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "../godot/editor_plugins/components_gizmo_3d.h"
3+
#include "../../godot/editor_plugins/components_gizmo_3d.h"
44

55
class BtBoxGizmo : public ComponentGizmo {
66
StringName box_component_name = "BtBox";

modules/bullet_physics/register_types.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#include "../godot/editor_plugins/components_gizmo_3d.h"
55
#include "components_area.h"
66
#include "components_generic.h"
7-
#include "components_gizmos.h"
7+
#ifdef TOOLS_ENABLED
8+
#include "editor/components_gizmos.h"
9+
#endif
810
#include "components_pawn.h"
911
#include "components_rigid_body.h"
1012
#include "databag_space.h"
@@ -153,6 +155,7 @@ void initialize_bullet_physics_module(ModuleInitializationLevel p_level) {
153155
.add("BtOverlapCheck");
154156

155157
} else if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
158+
#ifdef TOOLS_ENABLED
156159
// Register gizmos
157160
Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtBoxGizmo));
158161
Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtSphereGizmo));
@@ -162,6 +165,7 @@ void initialize_bullet_physics_module(ModuleInitializationLevel p_level) {
162165
Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtConvexGizmo));
163166
Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtTrimeshGizmo));
164167
Components3DGizmoPlugin::get_singleton()->add_component_gizmo(memnew(BtPawnGizmo));
168+
#endif
165169
}
166170
}
167171

modules/godot/SCsub

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ env_godot_module = env_modules.Clone()
88
env_godot_module.add_source_files(env.modules_sources, "*.cpp")
99
env_godot_module.add_source_files(env.modules_sources, "components/*.cpp")
1010
env_godot_module.add_source_files(env.modules_sources, "components/physics/*.cpp")
11-
env_godot_module.add_source_files(env.modules_sources, "editor_plugins/*.cpp")
1211
env_godot_module.add_source_files(env.modules_sources, "nodes/*.cpp")
1312
env_godot_module.add_source_files(env.modules_sources, "databags/*.cpp")
1413
env_godot_module.add_source_files(env.modules_sources, "systems/*.cpp")
14+
15+
if env_godot_module.editor_build:
16+
env_godot_module.add_source_files(env.modules_sources, "editor_plugins/*.cpp")

modules/godot/nodes/ecs_utilities.cpp

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
#include "core/config/project_settings.h"
88
#include "core/io/resource_loader.h"
99
#include "core/object/script_language.h"
10-
#include "editor/editor_node.h"
1110
#include "entity.h"
1211
#include "shared_component_resource.h"
12+
#ifdef TOOLS_ENABLED
13+
#include "editor/editor_node.h"
14+
#endif
1315

1416
void System::_bind_methods() {
1517
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) {
113115

114116
String System::validate_script(Ref<Script> p_script) {
115117
if (p_script.is_null()) {
116-
return TTR("Script is null.");
118+
return RTR("Script is null.");
117119
}
118120
if (p_script->is_valid() == false) {
119-
return TTR("Script has some errors.");
121+
return RTR("Script has some errors.");
120122
}
121123
if ("System" != p_script->get_instance_base_type()) {
122-
return TTR("This script is not extending `System`.");
124+
return RTR("This script is not extending `System`.");
123125
}
124126
List<MethodInfo> methods;
125127
p_script->get_script_method_list(&methods);
@@ -135,22 +137,25 @@ String System::validate_script(Ref<Script> p_script) {
135137
}
136138
}
137139
if (has_prepare == false) {
138-
return TTR("This script is not overriding the function `_prepare()`.");
140+
return RTR("This script is not overriding the function `_prepare()`.");
139141
}
140142
if (has_execute == false) {
141-
return TTR("This script is not overriding the function `_execute(...)`.");
143+
return RTR("This script is not overriding the function `_execute(...)`.");
142144
}
143145

144146
List<PropertyInfo> properties;
147+
148+
#ifdef TOOLS_ENABLED
145149
p_script->get_script_property_list(&properties);
146150
for (List<PropertyInfo>::Element *e = properties.front(); e; e = e->next()) {
147151
if (e->get().name == p_script->get_class_category().name) {
148152
properties.erase(e);
149153
}
150154
}
155+
#endif
151156

152157
if (properties.size()) {
153-
return TTR("The System script can't have any property in it. It possible to only access `Component`s and `Databag`s.");
158+
return RTR("The System script can't have any property in it. It possible to only access `Component`s and `Databag`s.");
154159
}
155160

156161
// This script is safe to use.
@@ -247,13 +252,13 @@ void SystemBundle::execute_after(uint32_t p_system_id) {
247252

248253
String SystemBundle::validate_script(Ref<Script> p_script) {
249254
if (p_script.is_null()) {
250-
return TTR("Script is null.");
255+
return RTR("Script is null.");
251256
}
252257
if (p_script->is_valid() == false) {
253-
return TTR("Script has some errors.");
258+
return RTR("Script has some errors.");
254259
}
255260
if ("SystemBundle" != p_script->get_instance_base_type()) {
256-
return TTR("This script is not extending `SystemBundle`.");
261+
return RTR("This script is not extending `SystemBundle`.");
257262
}
258263
List<MethodInfo> methods;
259264
p_script->get_script_method_list(&methods);
@@ -265,7 +270,7 @@ String SystemBundle::validate_script(Ref<Script> p_script) {
265270
}
266271
}
267272
if (has_prepare == false) {
268-
return TTR("This script is not overriding the function `_prepare()`.");
273+
return RTR("This script is not overriding the function `_prepare()`.");
269274
}
270275
// This script is safe to use.
271276
return "";
@@ -314,13 +319,13 @@ Vector<StringName> Component::get_spawners() {
314319

315320
String Component::validate_script(Ref<Script> p_script) {
316321
if (p_script.is_null()) {
317-
return TTR("Script is null.");
322+
return RTR("Script is null.");
318323
}
319324
if (p_script->is_valid() == false) {
320-
return TTR("Script has some errors.");
325+
return RTR("Script has some errors.");
321326
}
322327
if ("Component" != p_script->get_instance_base_type()) {
323-
return TTR("This script is not extending `Component`.");
328+
return RTR("This script is not extending `Component`.");
324329
}
325330

326331
// Make sure doesn't have any function in it.
@@ -331,29 +336,31 @@ String Component::validate_script(Ref<Script> p_script) {
331336
for (int i = 0; i < methods.size(); i += 1) {
332337
// Only this method is allowed.
333338
if (methods[i].name != "@implicit_new" && methods[i].name != "get_spawners") {
334-
return TTR("The only method the Component can have is the `get_spawners()`.");
339+
return RTR("The only method the Component can have is the `get_spawners()`.");
335340
}
336341
}
337342

338343
List<PropertyInfo> properties;
339344
p_script->get_script_property_list(&properties);
340345
for (List<PropertyInfo>::Element *e = properties.front(); e; e = e->next()) {
346+
#ifdef TOOLS_ENABLED
341347
if (
342348
// Filter GDScript file name
343349
e->get().name == p_script->get_class_category().name
344350
// Filter C# file name. It uses only the class name
345351
|| p_script->get_path().ends_with(e->get().name + ".cs")) {
346352
continue;
347353
}
354+
#endif
348355
switch (e->get().type) {
349356
case Variant::NIL:
350-
return "(" + e->get().name + ") " + TTR("Please make sure all variables are typed.");
357+
return "(" + e->get().name + ") " + RTR("Please make sure all variables are typed.");
351358
case Variant::RID:
352359
case Variant::OBJECT:
353-
return "(" + e->get().name + ") " + TTR("The Component can't hold unsafe references. The same reference could be holded by multiple things into the engine, this invalidates the thread safety of the ECS model. Please use a Databag or report your use case so a safe native type will be provided instead.");
360+
return "(" + e->get().name + ") " + RTR("The Component can't hold unsafe references. The same reference could be holded by multiple things into the engine, this invalidates the thread safety of the ECS model. Please use a Databag or report your use case so a safe native type will be provided instead.");
354361
case Variant::SIGNAL:
355362
case Variant::CALLABLE:
356-
return "(" + e->get().name + ") " + TTR("The Component can't hold signals or callables. Please report your use case.");
363+
return "(" + e->get().name + ") " + RTR("The Component can't hold signals or callables. Please report your use case.");
357364
default:
358365
// Nothing to worry about.
359366
break;

modules/godot/nodes/ecs_world.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ World *WorldECS::get_world() const {
418418
return world;
419419
}
420420

421+
#ifdef TOOLS_ENABLED
421422
PackedStringArray WorldECS::get_configuration_warnings() const {
422423
Vector<String> warnings = Node::get_configuration_warnings();
423424

@@ -447,9 +448,9 @@ PackedStringArray WorldECS::get_configuration_warnings() const {
447448
}
448449
}
449450
}
450-
451451
return warnings;
452452
}
453+
#endif
453454

454455
void WorldECS::set_pipelines(Vector<Ref<PipelineECS>> p_pipelines) {
455456
pipelines = p_pipelines;

modules/godot/nodes/ecs_world.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ class WorldECS : public Node {
121121
/// possible to do it via the commands object that you can take using:
122122
/// `ECS::get_singleton()->get_commands()`
123123
World *get_world() const;
124-
124+
#ifdef TOOLS_ENABLED
125125
virtual PackedStringArray get_configuration_warnings() const override;
126-
126+
#endif
127127
void set_pipelines(Vector<Ref<PipelineECS>> p_pipelines);
128128
const Vector<Ref<PipelineECS>> &get_pipelines() const;
129129
Vector<Ref<PipelineECS>> &get_pipelines();

0 commit comments

Comments
 (0)