Pārlūkot izejas kodu

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

Fix transform for transposed tiles in compatibility mode (from 3.x)
Rémi Verschelde 2 gadi atpakaļ
vecāks
revīzija
2d90f66ac1
2 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 1 1
      scene/2d/tile_map.cpp
  2. 2 2
      scene/resources/tile_set.cpp

+ 1 - 1
scene/2d/tile_map.cpp

@@ -3086,7 +3086,7 @@ void TileMap::_build_runtime_update_tile_data(SelfList<TileMapQuadrant>::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);

+ 2 - 2
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)) {