summaryrefslogtreecommitdiff
path: root/scene/2d/tile_map.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-12 11:40:54 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-12 11:40:54 +0100
commitba3a2adb90985cff35788897f4cb84f801e52f2a (patch)
treeec12d76647ce14a28346584d341544c813e10878 /scene/2d/tile_map.cpp
parent97df6de4a77393069c639a57d22bebb2f6f54680 (diff)
parent64fc443e2416a9c27b15010e8e0bfeb424c5436c (diff)
Merge pull request #67050 from KoBeWi/syrt
Warn if isometric TileMap is not Y-sorted
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r--scene/2d/tile_map.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 8b27dbe3db..13474eb829 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -755,6 +755,7 @@ void TileMap::set_y_sort_enabled(bool p_enable) {
_clear_internals();
_recreate_internals();
emit_signal(SNAME("changed"));
+ update_configuration_warnings();
}
Vector2i TileMap::_coords_to_quadrant_coords(int p_layer, const Vector2i &p_coords) const {
@@ -3958,6 +3959,22 @@ PackedStringArray TileMap::get_configuration_warnings() const {
}
}
+ if (tile_set.is_valid() && tile_set->get_tile_shape() == TileSet::TILE_SHAPE_ISOMETRIC) {
+ bool warn = !is_y_sort_enabled();
+ if (!warn) {
+ for (int layer = 0; layer < (int)layers.size(); layer++) {
+ if (!layers[layer].y_sort_enabled) {
+ warn = true;
+ break;
+ }
+ }
+ }
+
+ if (warn) {
+ warnings.push_back(RTR("Isometric TileSet will likely not look as intended without Y-sort enabled for the TileMap and all of its layers."));
+ }
+ }
+
return warnings;
}
@@ -4054,6 +4071,7 @@ void TileMap::_tile_set_changed() {
_tile_set_changed_deferred_update_needed = true;
instantiated_scenes.clear();
call_deferred(SNAME("_tile_set_changed_deferred_update"));
+ update_configuration_warnings();
}
void TileMap::_tile_set_changed_deferred_update() {