summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-25 19:27:37 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-25 19:27:37 +0100
commit6e693368e1bbf7a8d03a137057824b43acedb183 (patch)
tree048532ef70920779a6f4047c779ddfed15b35c95
parentfcdded2e3d6c91c59726e50af918533096bf6d27 (diff)
parentf6424e68ea0c68d7538b9d2b20f0448070956dba (diff)
Merge pull request #69124 from zaevi/tilemap_fix_alternative_tile
[TileMap] Fix alternative tile issues.
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp9
-rw-r--r--scene/resources/tile_set.cpp1
2 files changed, 9 insertions, 1 deletions
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index c0f6ccb95a..44b8ff05d1 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -153,7 +153,14 @@ void GenericTilePolygonEditor::_base_control_draw() {
// Draw the background.
if (background_texture.is_valid()) {
- base_control->draw_texture_rect_region(background_texture, Rect2(-background_region.size / 2 - background_offset, background_region.size), background_region, background_modulate, background_transpose);
+ Size2 region_size = background_region.size;
+ if (background_h_flip) {
+ region_size.x = -region_size.x;
+ }
+ if (background_v_flip) {
+ region_size.y = -region_size.y;
+ }
+ base_control->draw_texture_rect_region(background_texture, Rect2(-background_region.size / 2 - background_offset, region_size), background_region, background_modulate, background_transpose);
}
// Draw the polygons.
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index d4ad81614d..9d2537bb4d 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -4363,6 +4363,7 @@ int TileSetAtlasSource::create_alternative_tile(const Vector2i p_atlas_coords, i
tiles[p_atlas_coords].alternatives[new_alternative_id] = memnew(TileData);
tiles[p_atlas_coords].alternatives[new_alternative_id]->set_tile_set(tile_set);
tiles[p_atlas_coords].alternatives[new_alternative_id]->set_allow_transform(true);
+ tiles[p_atlas_coords].alternatives[new_alternative_id]->connect("changed", callable_mp((Resource *)this, &TileSetAtlasSource::emit_changed));
tiles[p_atlas_coords].alternatives[new_alternative_id]->notify_property_list_changed();
tiles[p_atlas_coords].alternatives_ids.append(new_alternative_id);
tiles[p_atlas_coords].alternatives_ids.sort();