Skip to content

Commit

Permalink
Merge pull request #42979 from Mallos/fix/tilemap-floodfill
Browse files Browse the repository at this point in the history
fix(editor): TileMap floodfill with same tile ID and different variation
  • Loading branch information
akien-mga authored Nov 2, 2020
2 parents e8794b2 + cefca25 commit be14d9d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions editor/plugins/tile_map_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,15 @@ Vector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase,
return Vector<Vector2>();
}

// 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) {
// Same ID, nothing to change
return Vector<Vector2>();
int current = manual_palette->get_current();
Vector2 position = manual_palette->get_item_metadata(current);
if (prev_position == position) {
// Same ID and variation, nothing to change
return Vector<Vector2>();
}
}

Rect2i r = node->get_used_rect();
Expand Down

0 comments on commit be14d9d

Please sign in to comment.