diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-01 12:51:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-01 12:51:28 +0200 |
commit | 0286495f594bd926c9183811271de17ba3452725 (patch) | |
tree | e0457ac6909e60d7cbb9513b50544c84465f822f /scene/resources/tile_set.cpp | |
parent | 4c1d555b9a07fa40d7e9237557d8762b3f22d5d5 (diff) | |
parent | 3b35733b4ce55567b9b9d0ff973ee893c93e1d0b (diff) |
Merge pull request #49024 from groud/restore_tilemap_show_debug
Restore TileMap's debug collision shapes and add navigation.
Diffstat (limited to 'scene/resources/tile_set.cpp')
-rw-r--r-- | scene/resources/tile_set.cpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 59c1a4e915..2c2c8ea0e8 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -4297,7 +4297,23 @@ void TileSetPluginAtlasPhysics::draw_quadrant_debug(TileMap *p_tile_map, TileMap Ref<TileSet> tile_set = p_tile_map->get_tileset(); ERR_FAIL_COND(!tile_set.is_valid()); - if (!p_tile_map->get_tree() || !(Engine::get_singleton()->is_editor_hint() || p_tile_map->get_tree()->is_debugging_collisions_hint())) { + if (!p_tile_map->get_tree()) { + return; + } + + bool show_collision = false; + switch (p_tile_map->get_collision_visibility_mode()) { + case TileMap::VISIBILITY_MODE_DEFAULT: + show_collision = !Engine::get_singleton()->is_editor_hint() && (p_tile_map->get_tree() && p_tile_map->get_tree()->is_debugging_navigation_hint()); + break; + case TileMap::VISIBILITY_MODE_FORCE_HIDE: + show_collision = false; + break; + case TileMap::VISIBILITY_MODE_FORCE_SHOW: + show_collision = true; + break; + } + if (!show_collision) { return; } @@ -4456,7 +4472,23 @@ void TileSetPluginAtlasNavigation::draw_quadrant_debug(TileMap *p_tile_map, Tile Ref<TileSet> tile_set = p_tile_map->get_tileset(); ERR_FAIL_COND(!tile_set.is_valid()); - if (!p_tile_map->get_tree() || !(Engine::get_singleton()->is_editor_hint() || p_tile_map->get_tree()->is_debugging_navigation_hint())) { + if (!p_tile_map->get_tree()) { + return; + } + + bool show_navigation = false; + switch (p_tile_map->get_navigation_visibility_mode()) { + case TileMap::VISIBILITY_MODE_DEFAULT: + show_navigation = !Engine::get_singleton()->is_editor_hint() && (p_tile_map->get_tree() && p_tile_map->get_tree()->is_debugging_navigation_hint()); + break; + case TileMap::VISIBILITY_MODE_FORCE_HIDE: + show_navigation = false; + break; + case TileMap::VISIBILITY_MODE_FORCE_SHOW: + show_navigation = true; + break; + } + if (!show_navigation) { return; } |