diff options
Diffstat (limited to 'editor/editor_log.cpp')
-rw-r--r-- | editor/editor_log.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 35d8021394..b3e90236a6 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -103,7 +103,7 @@ void EditorLog::_start_state_save_timer() { void EditorLog::_save_state() { Ref<ConfigFile> config; - config.instance(); + config.instantiate(); // Load and amend existing config if it exists. config->load(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg")); @@ -122,22 +122,21 @@ void EditorLog::_load_state() { is_loading_state = true; Ref<ConfigFile> config; - config.instance(); - Error err = config->load(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg")); - - if (err == OK) { - const String section = "editor_log"; - for (Map<MessageType, LogFilter *>::Element *E = type_filter_map.front(); E; E = E->next()) { - E->get()->set_active(config->get_value(section, "log_filter_" + itos(E->key()), false)); - } + config.instantiate(); + config->load(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg")); - collapse = config->get_value(section, "collapse", false); - collapse_button->set_pressed(collapse); - bool show_search = config->get_value(section, "show_search", true); - search_box->set_visible(show_search); - show_search_button->set_pressed(show_search); + // Run the below code even if config->load returns an error, since we want the defaults to be set even if the file does not exist yet. + const String section = "editor_log"; + for (Map<MessageType, LogFilter *>::Element *E = type_filter_map.front(); E; E = E->next()) { + E->get()->set_active(config->get_value(section, "log_filter_" + itos(E->key()), true)); } + collapse = config->get_value(section, "collapse", false); + collapse_button->set_pressed(collapse); + bool show_search = config->get_value(section, "show_search", true); + search_box->set_visible(show_search); + show_search_button->set_pressed(show_search); + is_loading_state = false; } |