summaryrefslogtreecommitdiffstats
path: root/scene/2d/tile_map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r--scene/2d/tile_map.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 7b0bd7e26c..b1c5677726 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -197,10 +197,10 @@ void TileMapLayer::_rendering_update() {
if (!canvas_item.is_valid()) {
RID ci = rs->canvas_item_create();
rs->canvas_item_set_parent(ci, tile_map_node->get_canvas_item());
- rs->canvas_item_set_draw_index(ci, layer_index_in_tile_map_node - (int64_t)0x80000000);
canvas_item = ci;
}
RID &ci = canvas_item;
+ rs->canvas_item_set_draw_index(ci, layer_index_in_tile_map_node - (int64_t)0x80000000);
rs->canvas_item_set_sort_children_by_y(ci, y_sort_enabled);
rs->canvas_item_set_use_parent_material(ci, tile_map_node->get_use_parent_material() || tile_map_node->get_material().is_valid());
rs->canvas_item_set_z_index(ci, z_index);
@@ -4518,14 +4518,26 @@ PackedStringArray TileMap::get_configuration_warnings() const {
}
}
- // Check if Y-sort is enabled on a layer but not on the node.
if (!is_y_sort_enabled()) {
+ // Check if Y-sort is enabled on a layer but not on the node.
for (const Ref<TileMapLayer> &layer : layers) {
if (layer->is_y_sort_enabled()) {
warnings.push_back(RTR("A TileMap layer is set as Y-sorted, but Y-sort is not enabled on the TileMap node itself."));
break;
}
}
+ } else {
+ // Check if Y-sort is enabled on the node, but not on any of the layers.
+ bool need_warning = true;
+ for (const Ref<TileMapLayer> &layer : layers) {
+ if (layer->is_y_sort_enabled()) {
+ need_warning = false;
+ break;
+ }
+ }
+ if (need_warning) {
+ warnings.push_back(RTR("The TileMap node is set as Y-sorted, but Y-sort is not enabled on any of the TileMap's layers.\nThis may lead to unwanted behaviors, as a layer that is not Y-sorted will be Y-sorted as a whole."));
+ }
}
// Check if we are in isometric mode without Y-sort enabled.