Merge pull request #78323 from kleonc/tile-compat-transposed-transform-fix

Fix transform for transposed tiles in compatibility mode (from 3.x)
This commit is contained in:
Rémi Verschelde 2023-06-16 16:52:51 +02:00
commit 2d90f66ac1
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 3 additions and 3 deletions

View File

@ -3086,7 +3086,7 @@ void TileMap::_build_runtime_update_tile_data(SelfList<TileMapQuadrant>::List &r
// Create the runtime TileData. // Create the runtime TileData.
TileData *tile_data_runtime_use = tile_data->duplicate(); TileData *tile_data_runtime_use = tile_data->duplicate();
tile_data->set_allow_transform(true); tile_data_runtime_use->set_allow_transform(true);
q.runtime_tile_data_cache[E_cell.value] = tile_data_runtime_use; q.runtime_tile_data_cache[E_cell.value] = tile_data_runtime_use;
GDVIRTUAL_CALL(_tile_data_runtime_update, q.layer, E_cell.value, tile_data_runtime_use); GDVIRTUAL_CALL(_tile_data_runtime_update, q.layer, E_cell.value, tile_data_runtime_use);

View File

@ -2563,7 +2563,7 @@ void TileSet::_compatibility_conversion() {
Transform2D xform; Transform2D xform;
xform = flip_h ? xform.scaled(Size2(-1, 1)) : xform; xform = flip_h ? xform.scaled(Size2(-1, 1)) : xform;
xform = flip_v ? xform.scaled(Size2(1, -1)) : xform; xform = flip_v ? xform.scaled(Size2(1, -1)) : xform;
xform = transpose ? xform.rotated(Math_PI).scaled(Size2(-1, -1)) : xform; xform = transpose ? Transform2D(xform[1], xform[0], Vector2()) : xform;
int alternative_tile = 0; int alternative_tile = 0;
if (!atlas_source->has_tile(coords)) { if (!atlas_source->has_tile(coords)) {
@ -2677,7 +2677,7 @@ void TileSet::_compatibility_conversion() {
Transform2D xform; Transform2D xform;
xform = flip_h ? xform.scaled(Size2(-1, 1)) : xform; xform = flip_h ? xform.scaled(Size2(-1, 1)) : xform;
xform = flip_v ? xform.scaled(Size2(1, -1)) : xform; xform = flip_v ? xform.scaled(Size2(1, -1)) : xform;
xform = transpose ? xform.rotated(Math_PI).scaled(Size2(-1, -1)) : xform; xform = transpose ? Transform2D(xform[1], xform[0], Vector2()) : xform;
int alternative_tile = 0; int alternative_tile = 0;
if (!atlas_source->has_tile(coords)) { if (!atlas_source->has_tile(coords)) {