From 0b5c4216c86a838e96a158c71a3f2015d47217e8 Mon Sep 17 00:00:00 2001 From: Vladislav Slobodenyuk Date: Fri, 9 Dec 2022 22:20:08 +0900 Subject: Fix TileMap drawing itself twice on creation Adds a check before calling `item_rect_changed()` in `_recompute_rect_cache()` of `scene/2d/tile_map.cpp`. Makes sure TileMap is only redrawn if the rect is actually changed. Fixes #69754 --- scene/2d/tile_map.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 4d4ea2b26d..ced77b26ee 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -995,9 +995,11 @@ void TileMap::_recompute_rect_cache() { } } + bool changed = rect_cache != r_total; + rect_cache = r_total; - item_rect_changed(); + item_rect_changed(changed); rect_cache_dirty = false; #endif -- cgit v1.2.3