Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't force-cleanup already cleaned up TileMap cells #89809

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kleonc
Copy link
Member

@kleonc kleonc commented Mar 23, 2024

AFAICT fixes #89774.
cc @MagmaGuy if you could please test for confirmation.

This seems like a band aid fix though, I'd say there's plenty to improve regarding cleaning/freeing stuff. There should probably be more control about it. E.g. currently when toggling visibility of a TileMapLayer it cleanups all rendering stuff on hiding, and recreates everything on show. Meaning if you'd e.g. want to keep blinking a TileMapLayer (without making any other changes to it) then it would still do all needless freeing/recreating, very inefficient (blinking is of course quite an exteme example). I'd say it should be somehow possible to prevent freeing (and thus recreating), on demand or something like that.

@kleonc kleonc added this to the 4.3 milestone Mar 23, 2024
@kleonc kleonc requested a review from groud March 23, 2024 14:18
@kleonc kleonc requested a review from a team as a code owner March 23, 2024 14:18
Comment on lines -1680 to -1694
// List the cells to delete definitely.
Vector<Vector2i> to_delete;
// Remove cells that are empty after the cleanup.
for (SelfList<CellData> *cell_data_list_element = dirty.cell_list.first(); cell_data_list_element; cell_data_list_element = cell_data_list_element->next()) {
CellData &cell_data = *cell_data_list_element->self();
// Select the cell from tile_map if it is invalid.
if (cell_data.cell.source_id == TileSet::INVALID_SOURCE) {
to_delete.push_back(cell_data.coords);
tile_map.erase(cell_data.coords);
}
}

// Remove cells that are empty after the cleanup.
for (const Vector2i &coords : to_delete) {
tile_map.erase(coords);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's kinda unrelated change, is there any reason why it was done like that? 🤔 (could revert that part if so)

@MagmaGuy
Copy link

I can't test because unless I didn't spot it the actions don't create a windows mono artifact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Massive performance drop when modifying a tile from a disabled tilemap
2 participants