diff --git a/modules/navigation_geometry_parsers/config.py b/modules/navigation_geometry_parsers/config.py index e48766d83..2608fda4d 100644 --- a/modules/navigation_geometry_parsers/config.py +++ b/modules/navigation_geometry_parsers/config.py @@ -1,6 +1,6 @@ def can_build(env, platform): - env.module_add_dependencies("navigation_geometry_parsers", ["navigation_mesh_generator"], False) + #env.module_add_dependencies("navigation_geometry_parsers", ["navigation_mesh_generator"], False) return True diff --git a/modules/navigation_geometry_parsers/geometry_parser_2d/tilemap_navigation_geometry_parser_2d.cpp b/modules/navigation_geometry_parsers/geometry_parser_2d/tilemap_navigation_geometry_parser_2d.cpp deleted file mode 100644 index b41d5e83b..000000000 --- a/modules/navigation_geometry_parsers/geometry_parser_2d/tilemap_navigation_geometry_parser_2d.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************/ -/* tilemap_navigation_geometry_parser_2d.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#include "tilemap_navigation_geometry_parser_2d.h" - -//#include "scene/2d/tile_map.h" - -#include "modules/tile_map/tile_map.h" -#include "modules/tile_map/tile_set.h" -#include "scene/resources/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/navigation_polygon.h" - -#include "modules/modules_enabled.gen.h" - -bool TileMap2DNavigationGeometryParser2D::parses_node(Node *p_node) { - return (Object::cast_to(p_node) != nullptr); -} - -void TileMap2DNavigationGeometryParser2D::parse_geometry(Node *p_node, Ref p_navigation_polygon, Ref p_source_geometry) { - TileMap *tilemap = Object::cast_to(p_node); - //NavigationPolygon::ParsedGeometryType parsed_geometry_type = p_navigation_polygon->get_parsed_geometry_type(); - //uint32_t navigation_polygon_collision_mask = p_navigation_polygon->get_collision_mask(); - - if (tilemap) { - Ref tile_set = tilemap->get_tileset(); - if (!tile_set.is_valid()) { - return; - } - - const Transform2D tilemap_xform = tilemap->get_transform(); - Array used_cells = tilemap->get_used_cells(); - - for (int used_cell_index = 0; used_cell_index < used_cells.size(); used_cell_index++) { - Vector2 cell = used_cells[used_cell_index]; - - int cell_id = tilemap->get_cell(cell.x, cell.y); - - Transform2D tile_transform; - tile_transform.set_origin(tilemap->to_local(cell)); - - const Transform2D tile_transform_offset = tilemap_xform * tile_transform; - - Ref navigation_polygon = tile_set->tile_get_navigation_polygon(cell_id); - if (navigation_polygon.is_valid()) { - for (int outline_index = 0; outline_index < navigation_polygon->get_outline_count(); outline_index++) { - PoolVector traversable_outline = navigation_polygon->get_outline(outline_index); - - Vector traversable_outline_new; - traversable_outline_new.resize(traversable_outline.size()); - - for (int traversable_outline_index = 0; traversable_outline_index < traversable_outline.size(); traversable_outline_index++) { - traversable_outline_new.write[traversable_outline_index] = tile_transform_offset.xform(traversable_outline[traversable_outline_index]); - } - - p_source_geometry->_add_traversable_outline(traversable_outline_new); - } - } - - /* - TODO - if (parsed_geometry_type != NavigationPolygon::PARSED_GEOMETRY_MESH_INSTANCES && (tilemap->get_collision_layer() & navigation_polygon_collision_mask)) { - for (int collision_polygon_index = 0; collision_polygon_index < tile_set->tile_get_shape_count(cell_id); collision_polygon_index++) { - Vector obstruction_outline = tile_set->get_collision_polygon_points(collision_polygon_index); - - for (int obstruction_outline_index = 0; obstruction_outline_index < obstruction_outline.size(); obstruction_outline_index++) { - obstruction_outline.write[obstruction_outline_index] = tile_transform_offset.xform(obstruction_outline[obstruction_outline_index]); - } - - p_source_geometry->_add_obstruction_outline(obstruction_outline); - } - } - */ - } - } -} diff --git a/modules/navigation_geometry_parsers/geometry_parser_2d/tilemap_navigation_geometry_parser_2d.h b/modules/navigation_geometry_parsers/geometry_parser_2d/tilemap_navigation_geometry_parser_2d.h deleted file mode 100644 index 3acb156f0..000000000 --- a/modules/navigation_geometry_parsers/geometry_parser_2d/tilemap_navigation_geometry_parser_2d.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************/ -/* tilemap_navigation_geometry_parser_2d.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#ifndef TILEMAP_NAVIGATION_GEOMETRY_PARSER_2D_H -#define TILEMAP_NAVIGATION_GEOMETRY_PARSER_2D_H - -#include "scene/2d/navigation_geometry_parser_2d.h" - -class TileMap2DNavigationGeometryParser2D : public NavigationGeometryParser2D { -public: - virtual bool parses_node(Node *p_node); - - virtual void parse_geometry(Node *p_node, Ref p_navigation_polygon, Ref p_source_geometry); -}; - -#endif // TILEMAP_NAVIGATION_GEOMETRY_PARSER_2D_H