Merge pull request #35325 from Calinou/optimize-editor-theme-creation

Only create the editor theme once
This commit is contained in:
Rémi Verschelde 2020-01-19 22:20:16 +01:00 committed by GitHub
commit 5358254b6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 10 deletions

View file

@ -1218,7 +1218,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) {
Ref<Theme> theme;
String custom_theme = EditorSettings::get_singleton()->get("interface/theme/custom_theme");
const String custom_theme = EditorSettings::get_singleton()->get("interface/theme/custom_theme");
if (custom_theme != "") {
theme = ResourceLoader::load(custom_theme);
}

View file

@ -2419,12 +2419,11 @@ ProjectManager::ProjectManager() {
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"));
set_anchors_and_margins_preset(Control::PRESET_WIDE);
set_theme(create_editor_theme());
set_theme(create_custom_theme());
gui_base = memnew(Control);
add_child(gui_base);
gui_base->set_anchors_and_margins_preset(Control::PRESET_WIDE);
gui_base->set_theme(create_custom_theme());
Panel *panel = memnew(Panel);
gui_base->add_child(panel);

View file

@ -109,14 +109,8 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
const int feature_min_height = 160 * EDSCALE;
Ref<Theme> collapse_theme = create_editor_theme();
collapse_theme->set_icon("checked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
collapse_theme->set_icon("unchecked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
CheckBox *chk_collapse_features = memnew(CheckBox);
CheckButton *chk_collapse_features = memnew(CheckButton);
chk_collapse_features->set_text(TTR("Advanced Options"));
chk_collapse_features->set_theme(collapse_theme);
chk_collapse_features->set_focus_mode(FOCUS_NONE);
vbc->add_child(chk_collapse_features);
tabc_features = memnew(TabContainer);