Skip to content

Commit 3f600da

Browse files
committed
Allow Building Editor with Navigation 3D disabled.
1 parent 2d3bdca commit 3f600da

16 files changed

+78
-1
lines changed

SConstruct

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,6 @@ if env.editor_build:
968968
"disable_physics_2d",
969969
"disable_physics_3d",
970970
"disable_navigation_2d",
971-
"disable_navigation_3d",
972971
]:
973972
if env[disable_opt]:
974973
unsupported_opts.append(disable_opt)

editor/editor_node.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@
6969
#include "scene/theme/theme_db.h"
7070
#include "servers/display_server.h"
7171
#include "servers/navigation_server_2d.h"
72+
#ifndef NAVIGATION_3D_DISABLED
7273
#include "servers/navigation_server_3d.h"
74+
#endif // NAVIGATION_3D_DISABLED
7375
#include "servers/rendering_server.h"
7476

7577
#include "editor/audio_stream_preview.h"
@@ -507,6 +509,7 @@ void EditorNode::_update_from_settings() {
507509
NavigationServer2D::get_singleton()->set_debug_navigation_enable_edge_lines(GLOBAL_GET("debug/shapes/navigation/2d/enable_edge_lines"));
508510
NavigationServer2D::get_singleton()->set_debug_navigation_enable_geometry_face_random_color(GLOBAL_GET("debug/shapes/navigation/2d/enable_geometry_face_random_color"));
509511

512+
#ifndef NAVIGATION_3D_DISABLED
510513
NavigationServer3D::get_singleton()->set_debug_navigation_edge_connection_color(GLOBAL_GET("debug/shapes/navigation/3d/edge_connection_color"));
511514
NavigationServer3D::get_singleton()->set_debug_navigation_geometry_edge_color(GLOBAL_GET("debug/shapes/navigation/3d/geometry_edge_color"));
512515
NavigationServer3D::get_singleton()->set_debug_navigation_geometry_face_color(GLOBAL_GET("debug/shapes/navigation/3d/geometry_face_color"));
@@ -517,6 +520,7 @@ void EditorNode::_update_from_settings() {
517520
NavigationServer3D::get_singleton()->set_debug_navigation_enable_edge_lines(GLOBAL_GET("debug/shapes/navigation/3d/enable_edge_lines"));
518521
NavigationServer3D::get_singleton()->set_debug_navigation_enable_edge_lines_xray(GLOBAL_GET("debug/shapes/navigation/3d/enable_edge_lines_xray"));
519522
NavigationServer3D::get_singleton()->set_debug_navigation_enable_geometry_face_random_color(GLOBAL_GET("debug/shapes/navigation/3d/enable_geometry_face_random_color"));
523+
#endif // NAVIGATION_3D_DISABLED
520524
#endif // DEBUG_ENABLED
521525
}
522526

@@ -7080,12 +7084,14 @@ EditorNode::EditorNode() {
70807084

70817085
AudioServer::get_singleton()->set_enable_tagging_used_audio_streams(true);
70827086

7087+
#ifndef NAVIGATION_3D_DISABLED
70837088
// No navigation by default if in editor.
70847089
if (NavigationServer3D::get_singleton()->get_debug_enabled()) {
70857090
NavigationServer3D::get_singleton()->set_active(true);
70867091
} else {
70877092
NavigationServer3D::get_singleton()->set_active(false);
70887093
}
7094+
#endif // NAVIGATION_3D_DISABLED
70897095

70907096
// No physics by default if in editor.
70917097
#ifndef PHYSICS_3D_DISABLED

editor/import/3d/resource_importer_scene.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
#include "editor/import/3d/scene_import_settings.h"
4141
#include "scene/3d/importer_mesh_instance_3d.h"
4242
#include "scene/3d/mesh_instance_3d.h"
43+
#ifndef NAVIGATION_3D_DISABLED
4344
#include "scene/3d/navigation/navigation_region_3d.h"
45+
#endif // NAVIGATION_3D_DISABLED
4446
#include "scene/3d/occluder_instance_3d.h"
4547
#include "scene/3d/physics/area_3d.h"
4648
#include "scene/3d/physics/collision_shape_3d.h"
@@ -907,6 +909,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R
907909
}
908910
}
909911

912+
#ifndef NAVIGATION_3D_DISABLED
910913
} else if (_teststr(name, "navmesh") && Object::cast_to<ImporterMeshInstance3D>(p_node)) {
911914
if (isroot) {
912915
return p_node;
@@ -927,6 +930,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R
927930
p_node->set_owner(nullptr);
928931
memdelete(p_node);
929932
p_node = nmi;
933+
#endif // NAVIGATION_3D_DISABLED
930934
} else if (_teststr(name, "occ") || _teststr(name, "occonly")) {
931935
if (isroot) {
932936
return p_node;
@@ -1672,6 +1676,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
16721676
}
16731677
}
16741678

1679+
#ifndef NAVIGATION_3D_DISABLED
16751680
//navmesh (node may have changed type above)
16761681
if (Object::cast_to<ImporterMeshInstance3D>(p_node)) {
16771682
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(p_node);
@@ -1703,6 +1708,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
17031708
}
17041709
}
17051710
}
1711+
#endif // NAVIGATION_3D_DISABLED
17061712

17071713
if (Object::cast_to<ImporterMeshInstance3D>(p_node)) {
17081714
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(p_node);

editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31+
#ifndef NAVIGATION_3D_DISABLED
32+
3133
#include "navigation_link_3d_gizmo_plugin.h"
3234

3335
#include "editor/editor_undo_redo_manager.h"
@@ -270,3 +272,5 @@ void NavigationLink3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo
270272

271273
ur->commit_action();
272274
}
275+
276+
#endif // NAVIGATION_3D_DISABLED

editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#pragma once
3232

33+
#ifndef NAVIGATION_3D_DISABLED
34+
3335
#include "editor/plugins/node_3d_editor_gizmos.h"
3436

3537
class NavigationLink3DGizmoPlugin : public EditorNode3DGizmoPlugin {
@@ -48,3 +50,5 @@ class NavigationLink3DGizmoPlugin : public EditorNode3DGizmoPlugin {
4850

4951
NavigationLink3DGizmoPlugin();
5052
};
53+
54+
#endif // NAVIGATION_3D_DISABLED

editor/plugins/gizmos/navigation_region_3d_gizmo_plugin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31+
#ifndef NAVIGATION_3D_DISABLED
32+
3133
#include "navigation_region_3d_gizmo_plugin.h"
3234

3335
#include "core/math/random_pcg.h"
@@ -206,3 +208,5 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
206208
p_gizmo->add_lines(line_vertex_array, navigationregion->is_enabled() ? get_material("edge_material", p_gizmo) : get_material("edge_material_disabled", p_gizmo));
207209
}
208210
}
211+
212+
#endif // NAVIGATION_3D_DISABLED

editor/plugins/gizmos/navigation_region_3d_gizmo_plugin.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#pragma once
3232

33+
#ifndef NAVIGATION_3D_DISABLED
34+
3335
#include "editor/plugins/node_3d_editor_gizmos.h"
3436

3537
class NavigationRegion3DGizmoPlugin : public EditorNode3DGizmoPlugin {
@@ -56,3 +58,5 @@ class NavigationRegion3DGizmoPlugin : public EditorNode3DGizmoPlugin {
5658

5759
NavigationRegion3DGizmoPlugin();
5860
};
61+
62+
#endif // NAVIGATION_3D_DISABLED

editor/plugins/mesh_instance_3d_editor_plugin.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
#include "editor/multi_node_edit.h"
3737
#include "editor/plugins/node_3d_editor_plugin.h"
3838
#include "editor/themes/editor_scale.h"
39+
#ifndef NAVIGATION_3D_DISABLED
3940
#include "scene/3d/navigation/navigation_region_3d.h"
41+
#endif // NAVIGATION_3D_DISABLED
4042
#include "scene/3d/physics/collision_shape_3d.h"
4143
#include "scene/3d/physics/static_body_3d.h"
4244
#include "scene/gui/aspect_ratio_container.h"
@@ -214,7 +216,9 @@ void MeshInstance3DEditor::_menu_option(int p_option) {
214216
} break;
215217

216218
case MENU_OPTION_CREATE_NAVMESH: {
219+
#ifndef NAVIGATION_3D_DISABLED
217220
navigation_mesh_dialog->popup_centered(Vector2(200, 90));
221+
#endif // NAVIGATION_3D_DISABLED
218222
} break;
219223

220224
case MENU_OPTION_CREATE_OUTLINE_MESH: {
@@ -485,6 +489,7 @@ void MeshInstance3DEditor::_debug_uv_draw() {
485489
}
486490

487491
void MeshInstance3DEditor::_create_navigation_mesh() {
492+
#ifndef NAVIGATION_3D_DISABLED
488493
Ref<Mesh> mesh = node->get_mesh();
489494
if (mesh.is_null()) {
490495
return;
@@ -512,6 +517,7 @@ void MeshInstance3DEditor::_create_navigation_mesh() {
512517
ur->add_do_reference(nmi);
513518
ur->add_undo_method(node, "remove_child", nmi);
514519
ur->commit_action();
520+
#endif // NAVIGATION_3D_DISABLED
515521
}
516522

517523
void MeshInstance3DEditor::_create_outline_mesh() {
@@ -574,7 +580,9 @@ MeshInstance3DEditor::MeshInstance3DEditor() {
574580
Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
575581

576582
options->get_popup()->add_item(TTR("Create Collision Shape..."), MENU_OPTION_CREATE_COLLISION_SHAPE);
583+
#ifndef NAVIGATION_3D_DISABLED
577584
options->get_popup()->add_item(TTR("Create Navigation Mesh"), MENU_OPTION_CREATE_NAVMESH);
585+
#endif // NAVIGATION_3D_DISABLED
578586
options->get_popup()->add_separator();
579587
options->get_popup()->add_item(TTR("Create Outline Mesh..."), MENU_OPTION_CREATE_OUTLINE_MESH);
580588
options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the StandardMaterial Grow property when using that property isn't possible."));
@@ -660,6 +668,7 @@ MeshInstance3DEditor::MeshInstance3DEditor() {
660668
debug_uv->connect(SceneStringName(draw), callable_mp(this, &MeshInstance3DEditor::_debug_uv_draw));
661669
debug_uv_arc->add_child(debug_uv);
662670

671+
#ifndef NAVIGATION_3D_DISABLED
663672
navigation_mesh_dialog = memnew(ConfirmationDialog);
664673
navigation_mesh_dialog->set_title(TTR("Create NavigationMesh"));
665674
navigation_mesh_dialog->set_ok_button_text(TTR("Create"));
@@ -673,6 +682,7 @@ MeshInstance3DEditor::MeshInstance3DEditor() {
673682

674683
add_child(navigation_mesh_dialog);
675684
navigation_mesh_dialog->connect(SceneStringName(confirmed), callable_mp(this, &MeshInstance3DEditor::_create_navigation_mesh));
685+
#endif // NAVIGATION_3D_DISABLED
676686
}
677687

678688
void MeshInstance3DEditorPlugin::edit(Object *p_object) {

editor/plugins/mesh_library_editor_plugin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
#include "editor/plugins/node_3d_editor_plugin.h"
4040
#include "main/main.h"
4141
#include "scene/3d/mesh_instance_3d.h"
42+
#ifndef NAVIGATION_3D_DISABLED
4243
#include "scene/3d/navigation/navigation_region_3d.h"
44+
#endif // NAVIGATION_3D_DISABLED
4345
#include "scene/3d/physics/static_body_3d.h"
4446
#include "scene/gui/menu_button.h"
4547
#include "scene/resources/packed_scene.h"
@@ -210,6 +212,7 @@ void MeshLibraryEditor::_import_scene_parse_node(Ref<MeshLibrary> p_library, Has
210212
}
211213
p_library->set_item_shapes(item_id, collisions);
212214

215+
#ifndef NAVIGATION_3D_DISABLED
213216
for (int i = 0; i < mesh_instance_node->get_child_count(); i++) {
214217
NavigationRegion3D *navigation_region_node = Object::cast_to<NavigationRegion3D>(mesh_instance_node->get_child(i));
215218
if (!navigation_region_node) {
@@ -223,6 +226,7 @@ void MeshLibraryEditor::_import_scene_parse_node(Ref<MeshLibrary> p_library, Has
223226
break;
224227
}
225228
}
229+
#endif // NAVIGATION_3D_DISABLED
226230
}
227231

228232
Error MeshLibraryEditor::update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml, bool p_merge, bool p_apply_xforms) {

editor/plugins/navigation_obstacle_3d_editor_plugin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31+
#ifndef NAVIGATION_3D_DISABLED
32+
3133
#include "navigation_obstacle_3d_editor_plugin.h"
3234

3335
#include "core/math/geometry_2d.h"
@@ -900,3 +902,5 @@ NavigationObstacle3DEditorPlugin::~NavigationObstacle3DEditorPlugin() {
900902
point_handle_mesh_rid = RID();
901903
}
902904
}
905+
906+
#endif // NAVIGATION_3D_DISABLED

0 commit comments

Comments
 (0)