navigation_server_2d.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. /**************************************************************************/
  2. /* navigation_server_2d.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "navigation_server_2d.h"
  31. #include "servers/navigation_server_3d.h"
  32. NavigationServer2D *NavigationServer2D::singleton = nullptr;
  33. void NavigationServer2D::_bind_methods() {
  34. ClassDB::bind_method(D_METHOD("get_maps"), &NavigationServer2D::get_maps);
  35. ClassDB::bind_method(D_METHOD("map_create"), &NavigationServer2D::map_create);
  36. ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &NavigationServer2D::map_set_active);
  37. ClassDB::bind_method(D_METHOD("map_is_active", "map"), &NavigationServer2D::map_is_active);
  38. ClassDB::bind_method(D_METHOD("map_set_cell_size", "map", "cell_size"), &NavigationServer2D::map_set_cell_size);
  39. ClassDB::bind_method(D_METHOD("map_get_cell_size", "map"), &NavigationServer2D::map_get_cell_size);
  40. ClassDB::bind_method(D_METHOD("map_set_use_edge_connections", "map", "enabled"), &NavigationServer2D::map_set_use_edge_connections);
  41. ClassDB::bind_method(D_METHOD("map_get_use_edge_connections", "map"), &NavigationServer2D::map_get_use_edge_connections);
  42. ClassDB::bind_method(D_METHOD("map_set_edge_connection_margin", "map", "margin"), &NavigationServer2D::map_set_edge_connection_margin);
  43. ClassDB::bind_method(D_METHOD("map_get_edge_connection_margin", "map"), &NavigationServer2D::map_get_edge_connection_margin);
  44. ClassDB::bind_method(D_METHOD("map_set_link_connection_radius", "map", "radius"), &NavigationServer2D::map_set_link_connection_radius);
  45. ClassDB::bind_method(D_METHOD("map_get_link_connection_radius", "map"), &NavigationServer2D::map_get_link_connection_radius);
  46. ClassDB::bind_method(D_METHOD("map_get_path", "map", "origin", "destination", "optimize", "navigation_layers"), &NavigationServer2D::map_get_path, DEFVAL(1));
  47. ClassDB::bind_method(D_METHOD("map_get_closest_point", "map", "to_point"), &NavigationServer2D::map_get_closest_point);
  48. ClassDB::bind_method(D_METHOD("map_get_closest_point_owner", "map", "to_point"), &NavigationServer2D::map_get_closest_point_owner);
  49. ClassDB::bind_method(D_METHOD("map_get_links", "map"), &NavigationServer2D::map_get_links);
  50. ClassDB::bind_method(D_METHOD("map_get_regions", "map"), &NavigationServer2D::map_get_regions);
  51. ClassDB::bind_method(D_METHOD("map_get_agents", "map"), &NavigationServer2D::map_get_agents);
  52. ClassDB::bind_method(D_METHOD("map_get_obstacles", "map"), &NavigationServer2D::map_get_obstacles);
  53. ClassDB::bind_method(D_METHOD("map_force_update", "map"), &NavigationServer2D::map_force_update);
  54. ClassDB::bind_method(D_METHOD("query_path", "parameters", "result"), &NavigationServer2D::query_path);
  55. ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer2D::region_create);
  56. ClassDB::bind_method(D_METHOD("region_set_enabled", "region", "enabled"), &NavigationServer2D::region_set_enabled);
  57. ClassDB::bind_method(D_METHOD("region_get_enabled", "region"), &NavigationServer2D::region_get_enabled);
  58. ClassDB::bind_method(D_METHOD("region_set_use_edge_connections", "region", "enabled"), &NavigationServer2D::region_set_use_edge_connections);
  59. ClassDB::bind_method(D_METHOD("region_get_use_edge_connections", "region"), &NavigationServer2D::region_get_use_edge_connections);
  60. ClassDB::bind_method(D_METHOD("region_set_enter_cost", "region", "enter_cost"), &NavigationServer2D::region_set_enter_cost);
  61. ClassDB::bind_method(D_METHOD("region_get_enter_cost", "region"), &NavigationServer2D::region_get_enter_cost);
  62. ClassDB::bind_method(D_METHOD("region_set_travel_cost", "region", "travel_cost"), &NavigationServer2D::region_set_travel_cost);
  63. ClassDB::bind_method(D_METHOD("region_get_travel_cost", "region"), &NavigationServer2D::region_get_travel_cost);
  64. ClassDB::bind_method(D_METHOD("region_set_owner_id", "region", "owner_id"), &NavigationServer2D::region_set_owner_id);
  65. ClassDB::bind_method(D_METHOD("region_get_owner_id", "region"), &NavigationServer2D::region_get_owner_id);
  66. ClassDB::bind_method(D_METHOD("region_owns_point", "region", "point"), &NavigationServer2D::region_owns_point);
  67. ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &NavigationServer2D::region_set_map);
  68. ClassDB::bind_method(D_METHOD("region_get_map", "region"), &NavigationServer2D::region_get_map);
  69. ClassDB::bind_method(D_METHOD("region_set_navigation_layers", "region", "navigation_layers"), &NavigationServer2D::region_set_navigation_layers);
  70. ClassDB::bind_method(D_METHOD("region_get_navigation_layers", "region"), &NavigationServer2D::region_get_navigation_layers);
  71. ClassDB::bind_method(D_METHOD("region_set_transform", "region", "transform"), &NavigationServer2D::region_set_transform);
  72. ClassDB::bind_method(D_METHOD("region_set_navigation_polygon", "region", "navigation_polygon"), &NavigationServer2D::region_set_navigation_polygon);
  73. ClassDB::bind_method(D_METHOD("region_get_connections_count", "region"), &NavigationServer2D::region_get_connections_count);
  74. ClassDB::bind_method(D_METHOD("region_get_connection_pathway_start", "region", "connection"), &NavigationServer2D::region_get_connection_pathway_start);
  75. ClassDB::bind_method(D_METHOD("region_get_connection_pathway_end", "region", "connection"), &NavigationServer2D::region_get_connection_pathway_end);
  76. ClassDB::bind_method(D_METHOD("link_create"), &NavigationServer2D::link_create);
  77. ClassDB::bind_method(D_METHOD("link_set_map", "link", "map"), &NavigationServer2D::link_set_map);
  78. ClassDB::bind_method(D_METHOD("link_get_map", "link"), &NavigationServer2D::link_get_map);
  79. ClassDB::bind_method(D_METHOD("link_set_enabled", "link", "enabled"), &NavigationServer2D::link_set_enabled);
  80. ClassDB::bind_method(D_METHOD("link_get_enabled", "link"), &NavigationServer2D::link_get_enabled);
  81. ClassDB::bind_method(D_METHOD("link_set_bidirectional", "link", "bidirectional"), &NavigationServer2D::link_set_bidirectional);
  82. ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &NavigationServer2D::link_is_bidirectional);
  83. ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &NavigationServer2D::link_set_navigation_layers);
  84. ClassDB::bind_method(D_METHOD("link_get_navigation_layers", "link"), &NavigationServer2D::link_get_navigation_layers);
  85. ClassDB::bind_method(D_METHOD("link_set_start_position", "link", "position"), &NavigationServer2D::link_set_start_position);
  86. ClassDB::bind_method(D_METHOD("link_get_start_position", "link"), &NavigationServer2D::link_get_start_position);
  87. ClassDB::bind_method(D_METHOD("link_set_end_position", "link", "position"), &NavigationServer2D::link_set_end_position);
  88. ClassDB::bind_method(D_METHOD("link_get_end_position", "link"), &NavigationServer2D::link_get_end_position);
  89. ClassDB::bind_method(D_METHOD("link_set_enter_cost", "link", "enter_cost"), &NavigationServer2D::link_set_enter_cost);
  90. ClassDB::bind_method(D_METHOD("link_get_enter_cost", "link"), &NavigationServer2D::link_get_enter_cost);
  91. ClassDB::bind_method(D_METHOD("link_set_travel_cost", "link", "travel_cost"), &NavigationServer2D::link_set_travel_cost);
  92. ClassDB::bind_method(D_METHOD("link_get_travel_cost", "link"), &NavigationServer2D::link_get_travel_cost);
  93. ClassDB::bind_method(D_METHOD("link_set_owner_id", "link", "owner_id"), &NavigationServer2D::link_set_owner_id);
  94. ClassDB::bind_method(D_METHOD("link_get_owner_id", "link"), &NavigationServer2D::link_get_owner_id);
  95. ClassDB::bind_method(D_METHOD("agent_create"), &NavigationServer2D::agent_create);
  96. ClassDB::bind_method(D_METHOD("agent_set_avoidance_enabled", "agent", "enabled"), &NavigationServer2D::agent_set_avoidance_enabled);
  97. ClassDB::bind_method(D_METHOD("agent_get_avoidance_enabled", "agent"), &NavigationServer2D::agent_get_avoidance_enabled);
  98. ClassDB::bind_method(D_METHOD("agent_set_map", "agent", "map"), &NavigationServer2D::agent_set_map);
  99. ClassDB::bind_method(D_METHOD("agent_get_map", "agent"), &NavigationServer2D::agent_get_map);
  100. ClassDB::bind_method(D_METHOD("agent_set_paused", "agent", "paused"), &NavigationServer2D::agent_set_paused);
  101. ClassDB::bind_method(D_METHOD("agent_get_paused", "agent"), &NavigationServer2D::agent_get_paused);
  102. ClassDB::bind_method(D_METHOD("agent_set_neighbor_distance", "agent", "distance"), &NavigationServer2D::agent_set_neighbor_distance);
  103. ClassDB::bind_method(D_METHOD("agent_set_max_neighbors", "agent", "count"), &NavigationServer2D::agent_set_max_neighbors);
  104. ClassDB::bind_method(D_METHOD("agent_set_time_horizon_agents", "agent", "time_horizon"), &NavigationServer2D::agent_set_time_horizon_agents);
  105. ClassDB::bind_method(D_METHOD("agent_set_time_horizon_obstacles", "agent", "time_horizon"), &NavigationServer2D::agent_set_time_horizon_obstacles);
  106. ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &NavigationServer2D::agent_set_radius);
  107. ClassDB::bind_method(D_METHOD("agent_set_max_speed", "agent", "max_speed"), &NavigationServer2D::agent_set_max_speed);
  108. ClassDB::bind_method(D_METHOD("agent_set_velocity_forced", "agent", "velocity"), &NavigationServer2D::agent_set_velocity_forced);
  109. ClassDB::bind_method(D_METHOD("agent_set_velocity", "agent", "velocity"), &NavigationServer2D::agent_set_velocity);
  110. ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &NavigationServer2D::agent_set_position);
  111. ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &NavigationServer2D::agent_is_map_changed);
  112. ClassDB::bind_method(D_METHOD("agent_set_avoidance_callback", "agent", "callback"), &NavigationServer2D::agent_set_avoidance_callback);
  113. ClassDB::bind_method(D_METHOD("agent_set_avoidance_layers", "agent", "layers"), &NavigationServer2D::agent_set_avoidance_layers);
  114. ClassDB::bind_method(D_METHOD("agent_set_avoidance_mask", "agent", "mask"), &NavigationServer2D::agent_set_avoidance_mask);
  115. ClassDB::bind_method(D_METHOD("agent_set_avoidance_priority", "agent", "priority"), &NavigationServer2D::agent_set_avoidance_priority);
  116. ClassDB::bind_method(D_METHOD("obstacle_create"), &NavigationServer2D::obstacle_create);
  117. ClassDB::bind_method(D_METHOD("obstacle_set_avoidance_enabled", "obstacle", "enabled"), &NavigationServer2D::obstacle_set_avoidance_enabled);
  118. ClassDB::bind_method(D_METHOD("obstacle_get_avoidance_enabled", "obstacle"), &NavigationServer2D::obstacle_get_avoidance_enabled);
  119. ClassDB::bind_method(D_METHOD("obstacle_set_map", "obstacle", "map"), &NavigationServer2D::obstacle_set_map);
  120. ClassDB::bind_method(D_METHOD("obstacle_get_map", "obstacle"), &NavigationServer2D::obstacle_get_map);
  121. ClassDB::bind_method(D_METHOD("obstacle_set_paused", "obstacle", "paused"), &NavigationServer2D::obstacle_set_paused);
  122. ClassDB::bind_method(D_METHOD("obstacle_get_paused", "obstacle"), &NavigationServer2D::obstacle_get_paused);
  123. ClassDB::bind_method(D_METHOD("obstacle_set_radius", "obstacle", "radius"), &NavigationServer2D::obstacle_set_radius);
  124. ClassDB::bind_method(D_METHOD("obstacle_set_velocity", "obstacle", "velocity"), &NavigationServer2D::obstacle_set_velocity);
  125. ClassDB::bind_method(D_METHOD("obstacle_set_position", "obstacle", "position"), &NavigationServer2D::obstacle_set_position);
  126. ClassDB::bind_method(D_METHOD("obstacle_set_vertices", "obstacle", "vertices"), &NavigationServer2D::obstacle_set_vertices);
  127. ClassDB::bind_method(D_METHOD("obstacle_set_avoidance_layers", "obstacle", "layers"), &NavigationServer2D::obstacle_set_avoidance_layers);
  128. ClassDB::bind_method(D_METHOD("parse_source_geometry_data", "navigation_polygon", "source_geometry_data", "root_node", "callback"), &NavigationServer2D::parse_source_geometry_data, DEFVAL(Callable()));
  129. ClassDB::bind_method(D_METHOD("bake_from_source_geometry_data", "navigation_polygon", "source_geometry_data", "callback"), &NavigationServer2D::bake_from_source_geometry_data, DEFVAL(Callable()));
  130. ClassDB::bind_method(D_METHOD("bake_from_source_geometry_data_async", "navigation_polygon", "source_geometry_data", "callback"), &NavigationServer2D::bake_from_source_geometry_data_async, DEFVAL(Callable()));
  131. ClassDB::bind_method(D_METHOD("free_rid", "rid"), &NavigationServer2D::free);
  132. ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationServer2D::set_debug_enabled);
  133. ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationServer2D::get_debug_enabled);
  134. ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map")));
  135. ADD_SIGNAL(MethodInfo("navigation_debug_changed"));
  136. }
  137. NavigationServer2D *NavigationServer2D::get_singleton() {
  138. return singleton;
  139. }
  140. NavigationServer2D::NavigationServer2D() {
  141. ERR_FAIL_COND(singleton != nullptr);
  142. singleton = this;
  143. ERR_FAIL_NULL_MSG(NavigationServer3D::get_singleton(), "The Navigation3D singleton should be initialized before the 2D one.");
  144. NavigationServer3D::get_singleton()->connect("map_changed", callable_mp(this, &NavigationServer2D::_emit_map_changed));
  145. #ifdef DEBUG_ENABLED
  146. NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationServer2D::_emit_navigation_debug_changed_signal));
  147. #endif // DEBUG_ENABLED
  148. }
  149. #ifdef DEBUG_ENABLED
  150. void NavigationServer2D::_emit_navigation_debug_changed_signal() {
  151. emit_signal(SNAME("navigation_debug_changed"));
  152. }
  153. #endif // DEBUG_ENABLED
  154. NavigationServer2D::~NavigationServer2D() {
  155. singleton = nullptr;
  156. }
  157. void NavigationServer2D::_emit_map_changed(RID p_map) {
  158. emit_signal(SNAME("map_changed"), p_map);
  159. }
  160. void NavigationServer2D::set_debug_enabled(bool p_enabled) {
  161. NavigationServer3D::get_singleton()->set_debug_enabled(p_enabled);
  162. }
  163. bool NavigationServer2D::get_debug_enabled() const {
  164. return NavigationServer3D::get_singleton()->get_debug_enabled();
  165. }
  166. #ifdef DEBUG_ENABLED
  167. void NavigationServer2D::set_debug_navigation_enabled(bool p_enabled) {
  168. NavigationServer3D::get_singleton()->set_debug_navigation_enabled(p_enabled);
  169. }
  170. bool NavigationServer2D::get_debug_navigation_enabled() const {
  171. return NavigationServer3D::get_singleton()->get_debug_navigation_enabled();
  172. }
  173. void NavigationServer2D::set_debug_avoidance_enabled(bool p_enabled) {
  174. NavigationServer3D::get_singleton()->set_debug_avoidance_enabled(p_enabled);
  175. }
  176. bool NavigationServer2D::get_debug_avoidance_enabled() const {
  177. return NavigationServer3D::get_singleton()->get_debug_avoidance_enabled();
  178. }
  179. void NavigationServer2D::set_debug_navigation_edge_connection_color(const Color &p_color) {
  180. NavigationServer3D::get_singleton()->set_debug_navigation_edge_connection_color(p_color);
  181. }
  182. Color NavigationServer2D::get_debug_navigation_edge_connection_color() const {
  183. return NavigationServer3D::get_singleton()->get_debug_navigation_edge_connection_color();
  184. }
  185. void NavigationServer2D::set_debug_navigation_geometry_face_color(const Color &p_color) {
  186. NavigationServer3D::get_singleton()->set_debug_navigation_geometry_face_color(p_color);
  187. }
  188. Color NavigationServer2D::get_debug_navigation_geometry_face_color() const {
  189. return NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_color();
  190. }
  191. void NavigationServer2D::set_debug_navigation_geometry_face_disabled_color(const Color &p_color) {
  192. NavigationServer3D::get_singleton()->set_debug_navigation_geometry_face_disabled_color(p_color);
  193. }
  194. Color NavigationServer2D::get_debug_navigation_geometry_face_disabled_color() const {
  195. return NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_disabled_color();
  196. }
  197. void NavigationServer2D::set_debug_navigation_link_connection_color(const Color &p_color) {
  198. NavigationServer3D::get_singleton()->set_debug_navigation_link_connection_color(p_color);
  199. }
  200. Color NavigationServer2D::get_debug_navigation_link_connection_color() const {
  201. return NavigationServer3D::get_singleton()->get_debug_navigation_link_connection_color();
  202. }
  203. void NavigationServer2D::set_debug_navigation_link_connection_disabled_color(const Color &p_color) {
  204. NavigationServer3D::get_singleton()->set_debug_navigation_link_connection_disabled_color(p_color);
  205. }
  206. Color NavigationServer2D::get_debug_navigation_link_connection_disabled_color() const {
  207. return NavigationServer3D::get_singleton()->get_debug_navigation_link_connection_disabled_color();
  208. }
  209. void NavigationServer2D::set_debug_navigation_geometry_edge_color(const Color &p_color) {
  210. NavigationServer3D::get_singleton()->set_debug_navigation_geometry_edge_color(p_color);
  211. }
  212. Color NavigationServer2D::get_debug_navigation_geometry_edge_color() const {
  213. return NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_color();
  214. }
  215. void NavigationServer2D::set_debug_navigation_geometry_edge_disabled_color(const Color &p_color) {
  216. NavigationServer3D::get_singleton()->set_debug_navigation_geometry_edge_disabled_color(p_color);
  217. }
  218. Color NavigationServer2D::get_debug_navigation_geometry_edge_disabled_color() const {
  219. return NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_disabled_color();
  220. }
  221. void NavigationServer2D::set_debug_navigation_enable_edge_connections(const bool p_value) {
  222. NavigationServer3D::get_singleton()->set_debug_navigation_enable_edge_connections(p_value);
  223. }
  224. bool NavigationServer2D::get_debug_navigation_enable_edge_connections() const {
  225. return NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_connections();
  226. }
  227. void NavigationServer2D::set_debug_navigation_enable_geometry_face_random_color(const bool p_value) {
  228. NavigationServer3D::get_singleton()->set_debug_navigation_enable_geometry_face_random_color(p_value);
  229. }
  230. bool NavigationServer2D::get_debug_navigation_enable_geometry_face_random_color() const {
  231. return NavigationServer3D::get_singleton()->get_debug_navigation_enable_geometry_face_random_color();
  232. }
  233. void NavigationServer2D::set_debug_navigation_enable_edge_lines(const bool p_value) {
  234. NavigationServer3D::get_singleton()->set_debug_navigation_enable_edge_lines(p_value);
  235. }
  236. bool NavigationServer2D::get_debug_navigation_enable_edge_lines() const {
  237. return NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_lines();
  238. }
  239. void NavigationServer2D::set_debug_navigation_agent_path_color(const Color &p_color) {
  240. NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_color(p_color);
  241. }
  242. Color NavigationServer2D::get_debug_navigation_agent_path_color() const {
  243. return NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_color();
  244. }
  245. void NavigationServer2D::set_debug_navigation_enable_agent_paths(const bool p_value) {
  246. NavigationServer3D::get_singleton()->set_debug_navigation_enable_agent_paths(p_value);
  247. }
  248. bool NavigationServer2D::get_debug_navigation_enable_agent_paths() const {
  249. return NavigationServer3D::get_singleton()->get_debug_navigation_enable_agent_paths();
  250. }
  251. void NavigationServer2D::set_debug_navigation_agent_path_point_size(real_t p_point_size) {
  252. NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_point_size(p_point_size);
  253. }
  254. real_t NavigationServer2D::get_debug_navigation_agent_path_point_size() const {
  255. return NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_point_size();
  256. }
  257. void NavigationServer2D::set_debug_navigation_avoidance_enable_agents_radius(const bool p_value) {
  258. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_enable_agents_radius(p_value);
  259. }
  260. bool NavigationServer2D::get_debug_navigation_avoidance_enable_agents_radius() const {
  261. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_enable_agents_radius();
  262. }
  263. void NavigationServer2D::set_debug_navigation_avoidance_enable_obstacles_radius(const bool p_value) {
  264. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_enable_obstacles_radius(p_value);
  265. }
  266. bool NavigationServer2D::get_debug_navigation_avoidance_enable_obstacles_radius() const {
  267. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_enable_obstacles_radius();
  268. }
  269. void NavigationServer2D::set_debug_navigation_avoidance_agents_radius_color(const Color &p_color) {
  270. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_agents_radius_color(p_color);
  271. }
  272. Color NavigationServer2D::get_debug_navigation_avoidance_agents_radius_color() const {
  273. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_agents_radius_color();
  274. }
  275. void NavigationServer2D::set_debug_navigation_avoidance_obstacles_radius_color(const Color &p_color) {
  276. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_obstacles_radius_color(p_color);
  277. }
  278. Color NavigationServer2D::get_debug_navigation_avoidance_obstacles_radius_color() const {
  279. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_obstacles_radius_color();
  280. }
  281. void NavigationServer2D::set_debug_navigation_avoidance_static_obstacle_pushin_face_color(const Color &p_color) {
  282. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_static_obstacle_pushin_face_color(p_color);
  283. }
  284. Color NavigationServer2D::get_debug_navigation_avoidance_static_obstacle_pushin_face_color() const {
  285. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_static_obstacle_pushin_face_color();
  286. }
  287. void NavigationServer2D::set_debug_navigation_avoidance_static_obstacle_pushout_face_color(const Color &p_color) {
  288. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_static_obstacle_pushout_face_color(p_color);
  289. }
  290. Color NavigationServer2D::get_debug_navigation_avoidance_static_obstacle_pushout_face_color() const {
  291. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_static_obstacle_pushout_face_color();
  292. }
  293. void NavigationServer2D::set_debug_navigation_avoidance_static_obstacle_pushin_edge_color(const Color &p_color) {
  294. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_static_obstacle_pushin_edge_color(p_color);
  295. }
  296. Color NavigationServer2D::get_debug_navigation_avoidance_static_obstacle_pushin_edge_color() const {
  297. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_static_obstacle_pushin_edge_color();
  298. }
  299. void NavigationServer2D::set_debug_navigation_avoidance_static_obstacle_pushout_edge_color(const Color &p_color) {
  300. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_static_obstacle_pushout_edge_color(p_color);
  301. }
  302. Color NavigationServer2D::get_debug_navigation_avoidance_static_obstacle_pushout_edge_color() const {
  303. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_static_obstacle_pushout_edge_color();
  304. }
  305. void NavigationServer2D::set_debug_navigation_avoidance_enable_obstacles_static(const bool p_value) {
  306. NavigationServer3D::get_singleton()->set_debug_navigation_avoidance_enable_obstacles_static(p_value);
  307. }
  308. bool NavigationServer2D::get_debug_navigation_avoidance_enable_obstacles_static() const {
  309. return NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_enable_obstacles_static();
  310. }
  311. #endif // DEBUG_ENABLED
  312. ///////////////////////////////////////////////////////
  313. NavigationServer2DCallback NavigationServer2DManager::create_callback = nullptr;
  314. void NavigationServer2DManager::set_default_server(NavigationServer2DCallback p_callback) {
  315. create_callback = p_callback;
  316. }
  317. NavigationServer2D *NavigationServer2DManager::new_default_server() {
  318. if (create_callback == nullptr) {
  319. return nullptr;
  320. }
  321. return create_callback();
  322. }