summaryrefslogtreecommitdiffstats
path: root/scene/2d/tile_map.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-10-26 16:02:32 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-10-26 16:02:32 +0200
commit09946f79bd8215b2c6332de8821737580909a91c (patch)
treeab8bbf8f0b50f3ca4e891e11829c95d86ba50ce4 /scene/2d/tile_map.cpp
parentc5c90fd7b71adb17308144681c686ec5b5e12f63 (diff)
parent3b5a288bc8e2bfc759e9fc3cd369619e4638dfce (diff)
downloadredot-engine-09946f79bd8215b2c6332de8821737580909a91c.tar.gz
Merge pull request #84004 from groud/support_y_sort_with_runtime_data
Fix Y-sort origin not working when set in TileMap runtime updates
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r--scene/2d/tile_map.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 6eca32fbb6..f015cdb586 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -472,7 +472,13 @@ void TileMapLayer::_rendering_quadrants_update_cell(CellData &r_cell_data, SelfL
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
if (atlas_source && atlas_source->has_tile(r_cell_data.cell.get_atlas_coords()) && atlas_source->has_alternative_tile(r_cell_data.cell.get_atlas_coords(), r_cell_data.cell.alternative_tile)) {
is_valid = true;
- tile_y_sort_origin = atlas_source->get_tile_data(r_cell_data.cell.get_atlas_coords(), r_cell_data.cell.alternative_tile)->get_y_sort_origin();
+ const TileData *tile_data;
+ if (r_cell_data.runtime_tile_data_cache) {
+ tile_data = r_cell_data.runtime_tile_data_cache;
+ } else {
+ tile_data = atlas_source->get_tile_data(r_cell_data.cell.get_atlas_coords(), r_cell_data.cell.alternative_tile);
+ }
+ tile_y_sort_origin = tile_data->get_y_sort_origin();
}
}