From 735e7d67ca96c234c576a4e13b266b1574561e34 Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Fri, 16 Jun 2023 12:59:50 +0200 Subject: [PATCH] Fix transform for transposed tiles in compatibility mode (from 3.x) --- scene/2d/tile_map.cpp | 2 +- scene/resources/tile_set.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 63fa8cdd353..5ea751f089a 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -3086,7 +3086,7 @@ void TileMap::_build_runtime_update_tile_data(SelfList::List &r // Create the runtime TileData. 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; GDVIRTUAL_CALL(_tile_data_runtime_update, q.layer, E_cell.value, tile_data_runtime_use); diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index ec9f4806a07..08853679e12 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -2563,7 +2563,7 @@ void TileSet::_compatibility_conversion() { Transform2D xform; xform = flip_h ? 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; if (!atlas_source->has_tile(coords)) { @@ -2677,7 +2677,7 @@ void TileSet::_compatibility_conversion() { Transform2D xform; xform = flip_h ? 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; if (!atlas_source->has_tile(coords)) {