From 6631f66c2a9d54dc80d57df60376c84ce1252d08 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 17 Jul 2021 18:22:52 -0300 Subject: Optimize StringName usage * Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor. --- editor/editor_themes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editor/editor_themes.cpp') diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 427f079669..cea8081a5f 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -996,7 +996,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger); Ref style_panel_invisible_top = style_content_panel->duplicate(); - int stylebox_offset = theme->get_font("tab_selected", "TabContainer")->get_height(theme->get_font_size("tab_selected", "TabContainer")) + theme->get_stylebox("tab_selected", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(SIDE_TOP); + int stylebox_offset = theme->get_font("tab_selected", "TabContainer")->get_height(theme->get_font_size("tab_selected", "TabContainer")) + theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->get_minimum_size().height + theme->get_stylebox(SNAME("panel"), SNAME("TabContainer"))->get_default_margin(SIDE_TOP); style_panel_invisible_top->set_expand_margin_size(SIDE_TOP, -stylebox_offset); style_panel_invisible_top->set_default_margin(SIDE_TOP, 0); theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top); -- cgit v1.2.3