From 77e35cf781fbe6168d3ee0343dfc1d7ac06ba8b0 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Mon, 15 Apr 2024 13:17:44 -0700 Subject: [PATCH] Move NavigationMeshSourceGeometryData(2D/3D) to the 2D/3D subfolders --- modules/navigation/2d/nav_mesh_generator_2d.cpp | 4 ++-- modules/navigation/3d/nav_mesh_generator_3d.cpp | 2 +- modules/navigation/3d/navigation_mesh_generator.cpp | 2 +- .../navigation/editor/navigation_mesh_editor_plugin.cpp | 1 - scene/2d/navigation_region_2d.h | 2 +- scene/3d/navigation_region_3d.cpp | 2 +- scene/register_scene_types.cpp | 8 ++++---- .../{ => 2d}/navigation_mesh_source_geometry_data_2d.cpp | 0 .../{ => 2d}/navigation_mesh_source_geometry_data_2d.h | 2 +- scene/resources/{ => 2d}/navigation_polygon.cpp | 0 scene/resources/{ => 2d}/navigation_polygon.h | 0 scene/resources/2d/tile_set.h | 2 +- .../{ => 3d}/navigation_mesh_source_geometry_data_3d.cpp | 0 .../{ => 3d}/navigation_mesh_source_geometry_data_3d.h | 0 servers/navigation_server_2d.h | 4 ++-- servers/navigation_server_3d.cpp | 2 ++ servers/navigation_server_3d.h | 4 +++- servers/navigation_server_3d_dummy.h | 2 ++ 18 files changed, 21 insertions(+), 16 deletions(-) rename scene/resources/{ => 2d}/navigation_mesh_source_geometry_data_2d.cpp (100%) rename scene/resources/{ => 2d}/navigation_mesh_source_geometry_data_2d.h (98%) rename scene/resources/{ => 2d}/navigation_polygon.cpp (100%) rename scene/resources/{ => 2d}/navigation_polygon.h (100%) rename scene/resources/{ => 3d}/navigation_mesh_source_geometry_data_3d.cpp (100%) rename scene/resources/{ => 3d}/navigation_mesh_source_geometry_data_3d.h (100%) diff --git a/modules/navigation/2d/nav_mesh_generator_2d.cpp b/modules/navigation/2d/nav_mesh_generator_2d.cpp index d8f1170f6a1..90002595246 100644 --- a/modules/navigation/2d/nav_mesh_generator_2d.cpp +++ b/modules/navigation/2d/nav_mesh_generator_2d.cpp @@ -43,9 +43,9 @@ #include "scene/resources/2d/circle_shape_2d.h" #include "scene/resources/2d/concave_polygon_shape_2d.h" #include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation_polygon.h" #include "scene/resources/2d/rectangle_shape_2d.h" -#include "scene/resources/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/navigation_polygon.h" #include "thirdparty/clipper2/include/clipper2/clipper.h" #include "thirdparty/misc/polypartition.h" diff --git a/modules/navigation/3d/nav_mesh_generator_3d.cpp b/modules/navigation/3d/nav_mesh_generator_3d.cpp index 3d3f4b46790..b1b3cbed5de 100644 --- a/modules/navigation/3d/nav_mesh_generator_3d.cpp +++ b/modules/navigation/3d/nav_mesh_generator_3d.cpp @@ -45,12 +45,12 @@ #include "scene/resources/3d/convex_polygon_shape_3d.h" #include "scene/resources/3d/cylinder_shape_3d.h" #include "scene/resources/3d/height_map_shape_3d.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "scene/resources/3d/primitive_meshes.h" #include "scene/resources/3d/shape_3d.h" #include "scene/resources/3d/sphere_shape_3d.h" #include "scene/resources/3d/world_boundary_shape_3d.h" #include "scene/resources/navigation_mesh.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" #include "modules/modules_enabled.gen.h" // For csg, gridmap. diff --git a/modules/navigation/3d/navigation_mesh_generator.cpp b/modules/navigation/3d/navigation_mesh_generator.cpp index 8393896db16..54df42e2661 100644 --- a/modules/navigation/3d/navigation_mesh_generator.cpp +++ b/modules/navigation/3d/navigation_mesh_generator.cpp @@ -32,7 +32,7 @@ #include "navigation_mesh_generator.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation_server_3d.h" NavigationMeshGenerator *NavigationMeshGenerator::singleton = nullptr; diff --git a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp index 352203f5aaf..d7bf1cdd389 100644 --- a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp +++ b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp @@ -42,7 +42,6 @@ #include "scene/gui/button.h" #include "scene/gui/dialogs.h" #include "scene/gui/label.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" void NavigationMeshEditor::_node_removed(Node *p_node) { if (p_node == node) { diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h index 87c2365b154..1482617a64c 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation_region_2d.h @@ -31,7 +31,7 @@ #ifndef NAVIGATION_REGION_2D_H #define NAVIGATION_REGION_2D_H -#include "scene/resources/navigation_polygon.h" +#include "scene/resources/2d/navigation_polygon.h" class NavigationRegion2D : public Node2D { GDCLASS(NavigationRegion2D, Node2D); diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index d8a63c60a22..856c52b5d5b 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -30,7 +30,7 @@ #include "navigation_region_3d.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation_server_3d.h" RID NavigationRegion3D::get_rid() const { diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 0e3f309ca2b..1c8833494d9 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -128,9 +128,6 @@ #include "scene/resources/mesh_texture.h" #include "scene/resources/multimesh.h" #include "scene/resources/navigation_mesh.h" -#include "scene/resources/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" -#include "scene/resources/navigation_polygon.h" #include "scene/resources/packed_scene.h" #include "scene/resources/particle_process_material.h" #include "scene/resources/physics_material.h" @@ -213,6 +210,8 @@ #include "scene/resources/2d/circle_shape_2d.h" #include "scene/resources/2d/concave_polygon_shape_2d.h" #include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation_polygon.h" #include "scene/resources/2d/polygon_path_finder.h" #include "scene/resources/2d/rectangle_shape_2d.h" #include "scene/resources/2d/segment_shape_2d.h" @@ -299,6 +298,7 @@ #include "scene/resources/3d/height_map_shape_3d.h" #include "scene/resources/3d/importer_mesh.h" #include "scene/resources/3d/mesh_library.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "scene/resources/3d/primitive_meshes.h" #include "scene/resources/3d/separation_ray_shape_3d.h" #include "scene/resources/3d/sky_material.h" @@ -883,6 +883,7 @@ void register_scene_types() { BaseMaterial3D::init_shaders(); GDREGISTER_CLASS(MeshLibrary); + GDREGISTER_CLASS(NavigationMeshSourceGeometryData3D); OS::get_singleton()->yield(); // may take time to init @@ -1004,7 +1005,6 @@ void register_scene_types() { GDREGISTER_CLASS(NavigationMesh); GDREGISTER_CLASS(NavigationMeshSourceGeometryData2D); - GDREGISTER_CLASS(NavigationMeshSourceGeometryData3D); GDREGISTER_CLASS(NavigationPolygon); GDREGISTER_CLASS(NavigationRegion2D); GDREGISTER_CLASS(NavigationAgent2D); diff --git a/scene/resources/navigation_mesh_source_geometry_data_2d.cpp b/scene/resources/2d/navigation_mesh_source_geometry_data_2d.cpp similarity index 100% rename from scene/resources/navigation_mesh_source_geometry_data_2d.cpp rename to scene/resources/2d/navigation_mesh_source_geometry_data_2d.cpp diff --git a/scene/resources/navigation_mesh_source_geometry_data_2d.h b/scene/resources/2d/navigation_mesh_source_geometry_data_2d.h similarity index 98% rename from scene/resources/navigation_mesh_source_geometry_data_2d.h rename to scene/resources/2d/navigation_mesh_source_geometry_data_2d.h index 0e321fbeb90..11fc5d38505 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_2d.h +++ b/scene/resources/2d/navigation_mesh_source_geometry_data_2d.h @@ -33,7 +33,7 @@ #include "core/os/rw_lock.h" #include "scene/2d/node_2d.h" -#include "scene/resources/navigation_polygon.h" +#include "scene/resources/2d/navigation_polygon.h" class NavigationMeshSourceGeometryData2D : public Resource { GDCLASS(NavigationMeshSourceGeometryData2D, Resource); diff --git a/scene/resources/navigation_polygon.cpp b/scene/resources/2d/navigation_polygon.cpp similarity index 100% rename from scene/resources/navigation_polygon.cpp rename to scene/resources/2d/navigation_polygon.cpp diff --git a/scene/resources/navigation_polygon.h b/scene/resources/2d/navigation_polygon.h similarity index 100% rename from scene/resources/navigation_polygon.h rename to scene/resources/2d/navigation_polygon.h diff --git a/scene/resources/2d/tile_set.h b/scene/resources/2d/tile_set.h index dceda1a791c..e6d3f7e15db 100644 --- a/scene/resources/2d/tile_set.h +++ b/scene/resources/2d/tile_set.h @@ -38,8 +38,8 @@ #include "scene/2d/light_occluder_2d.h" #include "scene/main/canvas_item.h" #include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/navigation_polygon.h" #include "scene/resources/image_texture.h" -#include "scene/resources/navigation_polygon.h" #include "scene/resources/packed_scene.h" #include "scene/resources/physics_material.h" diff --git a/scene/resources/navigation_mesh_source_geometry_data_3d.cpp b/scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp similarity index 100% rename from scene/resources/navigation_mesh_source_geometry_data_3d.cpp rename to scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp diff --git a/scene/resources/navigation_mesh_source_geometry_data_3d.h b/scene/resources/3d/navigation_mesh_source_geometry_data_3d.h similarity index 100% rename from scene/resources/navigation_mesh_source_geometry_data_3d.h rename to scene/resources/3d/navigation_mesh_source_geometry_data_3d.h diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h index 876b09d5498..39d4c19064e 100644 --- a/servers/navigation_server_2d.h +++ b/servers/navigation_server_2d.h @@ -34,8 +34,8 @@ #include "core/object/class_db.h" #include "core/templates/rid.h" -#include "scene/resources/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/navigation_polygon.h" +#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation_polygon.h" #include "servers/navigation/navigation_path_query_parameters_2d.h" #include "servers/navigation/navigation_path_query_result_2d.h" diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp index 7b54a24b599..fda26aacc1a 100644 --- a/servers/navigation_server_3d.cpp +++ b/servers/navigation_server_3d.cpp @@ -181,10 +181,12 @@ void NavigationServer3D::_bind_methods() { ClassDB::bind_method(D_METHOD("obstacle_set_avoidance_layers", "obstacle", "layers"), &NavigationServer3D::obstacle_set_avoidance_layers); ClassDB::bind_method(D_METHOD("obstacle_get_avoidance_layers", "obstacle"), &NavigationServer3D::obstacle_get_avoidance_layers); +#ifndef _3D_DISABLED ClassDB::bind_method(D_METHOD("parse_source_geometry_data", "navigation_mesh", "source_geometry_data", "root_node", "callback"), &NavigationServer3D::parse_source_geometry_data, DEFVAL(Callable())); ClassDB::bind_method(D_METHOD("bake_from_source_geometry_data", "navigation_mesh", "source_geometry_data", "callback"), &NavigationServer3D::bake_from_source_geometry_data, DEFVAL(Callable())); ClassDB::bind_method(D_METHOD("bake_from_source_geometry_data_async", "navigation_mesh", "source_geometry_data", "callback"), &NavigationServer3D::bake_from_source_geometry_data_async, DEFVAL(Callable())); ClassDB::bind_method(D_METHOD("is_baking_navigation_mesh", "navigation_mesh"), &NavigationServer3D::is_baking_navigation_mesh); +#endif // _3D_DISABLED ClassDB::bind_method(D_METHOD("simplify_path", "path", "epsilon"), &NavigationServer3D::simplify_path); diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h index c23da782995..5a93c662b2d 100644 --- a/servers/navigation_server_3d.h +++ b/servers/navigation_server_3d.h @@ -34,8 +34,8 @@ #include "core/object/class_db.h" #include "core/templates/rid.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "scene/resources/navigation_mesh.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation/navigation_path_query_parameters_3d.h" #include "servers/navigation/navigation_path_query_result_3d.h" @@ -344,10 +344,12 @@ public: virtual NavigationUtilities::PathQueryResult _query_path(const NavigationUtilities::PathQueryParameters &p_parameters) const = 0; +#ifndef _3D_DISABLED virtual void parse_source_geometry_data(const Ref &p_navigation_mesh, const Ref &p_source_geometry_data, Node *p_root_node, const Callable &p_callback = Callable()) = 0; virtual void bake_from_source_geometry_data(const Ref &p_navigation_mesh, const Ref &p_source_geometry_data, const Callable &p_callback = Callable()) = 0; virtual void bake_from_source_geometry_data_async(const Ref &p_navigation_mesh, const Ref &p_source_geometry_data, const Callable &p_callback = Callable()) = 0; virtual bool is_baking_navigation_mesh(Ref p_navigation_mesh) const = 0; +#endif // _3D_DISABLED virtual Vector simplify_path(const Vector &p_path, real_t p_epsilon) = 0; diff --git a/servers/navigation_server_3d_dummy.h b/servers/navigation_server_3d_dummy.h index d98a0edb010..7079aa66beb 100644 --- a/servers/navigation_server_3d_dummy.h +++ b/servers/navigation_server_3d_dummy.h @@ -175,10 +175,12 @@ public: void obstacle_set_avoidance_layers(RID p_obstacle, uint32_t p_layers) override {} uint32_t obstacle_get_avoidance_layers(RID p_obstacle) const override { return 0; } +#ifndef _3D_DISABLED void parse_source_geometry_data(const Ref &p_navigation_mesh, const Ref &p_source_geometry_data, Node *p_root_node, const Callable &p_callback = Callable()) override {} void bake_from_source_geometry_data(const Ref &p_navigation_mesh, const Ref &p_source_geometry_data, const Callable &p_callback = Callable()) override {} void bake_from_source_geometry_data_async(const Ref &p_navigation_mesh, const Ref &p_source_geometry_data, const Callable &p_callback = Callable()) override {} bool is_baking_navigation_mesh(Ref p_navigation_mesh) const override { return false; } +#endif // _3D_DISABLED Vector simplify_path(const Vector &p_path, real_t p_epsilon) override { return Vector(); }