From b2e78e117ca5560f5b9290b2f333d054b9756a3e Mon Sep 17 00:00:00 2001 From: Guilherme Felipe Date: Sat, 30 Jun 2018 21:36:54 -0300 Subject: [PATCH] Fix performance for godot's interface --- scene/gui/control.cpp | 9 ++++++++- scene/gui/item_list.cpp | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 18a0cd13d90..6ef8016dd59 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -160,9 +160,16 @@ void Control::_update_minimum_size_cache() { Size2 minsize = get_minimum_size(); minsize.x = MAX(minsize.x, data.custom_minimum_size.x); minsize.y = MAX(minsize.y, data.custom_minimum_size.y); + + bool size_changed = false; + if (data.minimum_size_cache != minsize) + size_changed = true; + data.minimum_size_cache = minsize; data.minimum_size_valid = true; - minimum_size_changed(); + + if (size_changed) + minimum_size_changed(); } Size2 Control::get_combined_minimum_size() const { diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 57b9a9a11b2..72ed0e9b812 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -942,6 +942,7 @@ void ItemList::_notification(int p_what) { } } + minimum_size_changed(); shape_changed = false; }