Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn users when TileMap is set as Y-sorted but no layer is #83144

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion scene/2d/tile_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading