You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Fix TileMapLayer bug where dirty cells could be marked twice
When using runtime data in a TileMapLayer, calling notify_runtime_tile_update can cause error messages to be printed to the console if the same cell has been set or erased in the same frame. This could be partially worked around by using call_deferred on notify_runtime_tile_update, but the problem could re-emerge if those updates were being made in coroutines. This commit addresses the issue by adding an additional check to the dirty cell marking of the TileMapLayer when notify_runtime_tile_update is called. This check ensures that the cell has not already been added to the dirty cell list, preventing the condition that causes the error message.
This commit is contained in:
@@ -1413,7 +1413,7 @@ void TileMapLayer::_build_runtime_update_tile_data_for_cell(CellData &r_cell_dat
|
||||
|
||||
tile_map_node->GDVIRTUAL_CALL(_tile_data_runtime_update, layer_index_in_tile_map_node, r_cell_data.coords, tile_data_runtime_use);
|
||||
|
||||
if (p_auto_add_to_dirty_list) {
|
||||
if (p_auto_add_to_dirty_list && !r_cell_data.dirty_list_element.in_list()) {
|
||||
dirty.cell_list.add(&r_cell_data.dirty_list_element);
|
||||
}
|
||||
}
|
||||
@@ -1428,7 +1428,7 @@ void TileMapLayer::_build_runtime_update_tile_data_for_cell(CellData &r_cell_dat
|
||||
|
||||
GDVIRTUAL_CALL(_tile_data_runtime_update, r_cell_data.coords, tile_data_runtime_use);
|
||||
|
||||
if (p_auto_add_to_dirty_list) {
|
||||
if (p_auto_add_to_dirty_list && !r_cell_data.dirty_list_element.in_list()) {
|
||||
dirty.cell_list.add(&r_cell_data.dirty_list_element);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user