You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Fix rotated/flipped tiles rendering origin
This commit is contained in:
@@ -988,19 +988,24 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p
|
||||
|
||||
bool transpose = tile_data->get_transpose() ^ bool(E.value.alternative_tile & TileSetAtlasSource::TRANSFORM_TRANSPOSE);
|
||||
if (transpose) {
|
||||
dest_rect.position = (tile_set->map_to_local(E.key) - Vector2(dest_rect.size.y, dest_rect.size.x) / 2 - tile_offset);
|
||||
dest_rect.position = (tile_set->map_to_local(E.key) - Vector2(dest_rect.size.y, dest_rect.size.x) / 2);
|
||||
SWAP(tile_offset.x, tile_offset.y);
|
||||
} else {
|
||||
dest_rect.position = (tile_set->map_to_local(E.key) - dest_rect.size / 2 - tile_offset);
|
||||
dest_rect.position = (tile_set->map_to_local(E.key) - dest_rect.size / 2);
|
||||
}
|
||||
|
||||
if (tile_data->get_flip_h() ^ bool(E.value.alternative_tile & TileSetAtlasSource::TRANSFORM_FLIP_H)) {
|
||||
dest_rect.size.x = -dest_rect.size.x;
|
||||
tile_offset.x = -tile_offset.x;
|
||||
}
|
||||
|
||||
if (tile_data->get_flip_v() ^ bool(E.value.alternative_tile & TileSetAtlasSource::TRANSFORM_FLIP_V)) {
|
||||
dest_rect.size.y = -dest_rect.size.y;
|
||||
tile_offset.y = -tile_offset.y;
|
||||
}
|
||||
|
||||
dest_rect.position -= tile_offset;
|
||||
|
||||
// Get the tile modulation.
|
||||
Color modulate = tile_data->get_modulate() * edited_layer->get_modulate_in_tree() * edited_layer->get_self_modulate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user