Skip to content

Commit

Permalink
[Navigation] Restore 2D only navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
AThousandShips committed Feb 26, 2024
1 parent bb6b06c commit ee9fcdd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
3 changes: 1 addition & 2 deletions modules/navigation/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ module_obj = []

env_navigation.add_source_files(module_obj, "*.cpp")
env_navigation.add_source_files(module_obj, "2d/*.cpp")
if not env["disable_3d"]:
env_navigation.add_source_files(module_obj, "3d/*.cpp")
env_navigation.add_source_files(module_obj, "3d/*.cpp")
if env.editor_build:
env_navigation.add_source_files(module_obj, "editor/*.cpp")
env.modules_sources += module_obj
Expand Down
2 changes: 1 addition & 1 deletion modules/navigation/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def can_build(env, platform):
return not env["disable_3d"]
return True


def configure(env):
Expand Down
18 changes: 5 additions & 13 deletions tests/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
#include "tests/scene/test_curve_3d.h"
#include "tests/scene/test_gradient.h"
#include "tests/scene/test_image_texture.h"
#include "tests/scene/test_navigation_agent_2d.h"
#include "tests/scene/test_navigation_obstacle_2d.h"
#include "tests/scene/test_navigation_region_2d.h"
#include "tests/scene/test_node.h"
#include "tests/scene/test_node_2d.h"
#include "tests/scene/test_packed_scene.h"
Expand All @@ -118,20 +121,17 @@
#include "tests/scene/test_visual_shader.h"
#include "tests/scene/test_window.h"
#include "tests/servers/rendering/test_shader_preprocessor.h"
#include "tests/servers/test_navigation_server_2d.h"
#include "tests/servers/test_text_server.h"
#include "tests/test_validate_testing.h"

#ifndef _3D_DISABLED
#include "tests/scene/test_camera_3d.h"
#include "tests/scene/test_navigation_agent_2d.h"
#include "tests/scene/test_navigation_agent_3d.h"
#include "tests/scene/test_navigation_obstacle_2d.h"
#include "tests/scene/test_navigation_obstacle_3d.h"
#include "tests/scene/test_navigation_region_2d.h"
#include "tests/scene/test_navigation_region_3d.h"
#include "tests/scene/test_path_3d.h"
#include "tests/scene/test_primitives.h"
#include "tests/servers/test_navigation_server_2d.h"
#include "tests/servers/test_navigation_server_3d.h"
#endif // _3D_DISABLED

Expand All @@ -141,10 +141,8 @@
#include "tests/test_macros.h"

#include "scene/theme/theme_db.h"
#ifndef _3D_DISABLED
#include "servers/navigation_server_2d.h"
#include "servers/navigation_server_3d.h"
#endif // _3D_DISABLED
#include "servers/physics_server_2d.h"
#ifndef _3D_DISABLED
#include "servers/physics_server_3d.h"
Expand Down Expand Up @@ -226,9 +224,9 @@ struct GodotTestCaseListener : public doctest::IReporter {
PhysicsServer2D *physics_server_2d = nullptr;
#ifndef _3D_DISABLED
PhysicsServer3D *physics_server_3d = nullptr;
#endif // _3D_DISABLED
NavigationServer3D *navigation_server_3d = nullptr;
NavigationServer2D *navigation_server_2d = nullptr;
#endif // _3D_DISABLED

void test_case_start(const doctest::TestCaseData &p_in) override {
reinitialize();
Expand Down Expand Up @@ -268,12 +266,10 @@ struct GodotTestCaseListener : public doctest::IReporter {
physics_server_2d = PhysicsServer2DManager::get_singleton()->new_default_server();
physics_server_2d->init();

#ifndef _3D_DISABLED
ERR_PRINT_OFF;
navigation_server_3d = NavigationServer3DManager::new_default_server();
navigation_server_2d = NavigationServer2DManager::new_default_server();
ERR_PRINT_ON;
#endif // _3D_DISABLED

memnew(InputMap);
InputMap::get_singleton()->load_default();
Expand Down Expand Up @@ -304,15 +300,13 @@ struct GodotTestCaseListener : public doctest::IReporter {
return;
}

#ifndef _3D_DISABLED
if (suite_name.find("[Navigation]") != -1 && navigation_server_2d == nullptr && navigation_server_3d == nullptr) {
ERR_PRINT_OFF;
navigation_server_3d = NavigationServer3DManager::new_default_server();
navigation_server_2d = NavigationServer2DManager::new_default_server();
ERR_PRINT_ON;
return;
}
#endif // _3D_DISABLED
}

void test_case_end(const doctest::CurrentTestCaseStats &) override {
Expand All @@ -336,7 +330,6 @@ struct GodotTestCaseListener : public doctest::IReporter {
memdelete(SceneTree::get_singleton());
}

#ifndef _3D_DISABLED
if (navigation_server_3d) {
memdelete(navigation_server_3d);
navigation_server_3d = nullptr;
Expand All @@ -346,7 +339,6 @@ struct GodotTestCaseListener : public doctest::IReporter {
memdelete(navigation_server_2d);
navigation_server_2d = nullptr;
}
#endif // _3D_DISABLED

#ifndef _3D_DISABLED
if (physics_server_3d) {
Expand Down

0 comments on commit ee9fcdd

Please sign in to comment.