1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

TileMapEditor::_bucket_fill Check autotile coordinates only if autotile is selected

(cherry picked from commit a1b903066e)
This commit is contained in:
kleonc
2021-05-03 14:49:52 +02:00
committed by Rémi Verschelde
parent a93f52ee7e
commit 839f602859

View File

@@ -662,11 +662,15 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
} }
// Check if the tile variation is the same // Check if the tile variation is the same
Vector2 prev_position = node->get_cell_autotile_coord(p_start.x, p_start.y);
if (ids.size() == 1 && ids[0] == prev_id) { if (ids.size() == 1 && ids[0] == prev_id) {
int current = manual_palette->get_current(); int current = manual_palette->get_current();
Vector2 position = manual_palette->get_item_metadata(current); if (current == -1) {
if (prev_position == position) { // Same ID, no variation selected, nothing to change
return PoolVector<Vector2>();
}
Vector2 prev_autotile_coord = node->get_cell_autotile_coord(p_start.x, p_start.y);
Vector2 autotile_coord = manual_palette->get_item_metadata(current);
if (autotile_coord == prev_autotile_coord) {
// Same ID and variation, nothing to change // Same ID and variation, nothing to change
return PoolVector<Vector2>(); return PoolVector<Vector2>();
} }