[TileMap] Fix alternative tile issues.

This commit is contained in:
Zae 2022-11-25 00:44:02 +08:00
parent cd3d6e63a6
commit f6424e68ea
2 changed files with 9 additions and 1 deletions

View File

@ -153,7 +153,14 @@ void GenericTilePolygonEditor::_base_control_draw() {
// Draw the background. // Draw the background.
if (background_texture.is_valid()) { 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. // Draw the polygons.

View File

@ -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] = memnew(TileData);
tiles[p_atlas_coords].alternatives[new_alternative_id]->set_tile_set(tile_set); 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]->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[new_alternative_id]->notify_property_list_changed();
tiles[p_atlas_coords].alternatives_ids.append(new_alternative_id); tiles[p_atlas_coords].alternatives_ids.append(new_alternative_id);
tiles[p_atlas_coords].alternatives_ids.sort(); tiles[p_atlas_coords].alternatives_ids.sort();