mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
save log filter state to the editor settings
This commit is contained in:
@@ -2452,6 +2452,11 @@ impl Editor {
|
||||
fn update(&mut self, dt: f32, loop_controller: ApplicationLoopController) {
|
||||
for_each_plugin!(self.plugins => on_update(self, loop_controller));
|
||||
|
||||
let settings_data = self.settings.data_mut();
|
||||
settings_data.log.log_info = Log::is_logging_info();
|
||||
settings_data.log.log_warning = Log::is_logging_warning();
|
||||
settings_data.log.log_error = Log::is_logging_error();
|
||||
|
||||
self.handle_modes(dt);
|
||||
|
||||
let ui = self.engine.user_interfaces.first_mut();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2019-present Dmitry Stepanov and Fyrox Engine contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
use crate::fyrox::core::reflect::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug, Clone, Reflect)]
|
||||
pub struct LogSettings {
|
||||
pub log_info: bool,
|
||||
pub log_warning: bool,
|
||||
pub log_error: bool,
|
||||
}
|
||||
|
||||
impl Default for LogSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
log_info: true,
|
||||
log_warning: true,
|
||||
log_error: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ use crate::{
|
||||
fyrox::core::{log::Log, reflect::prelude::*},
|
||||
settings::{
|
||||
build::BuildSettings, camera::CameraSettings, debugging::DebuggingSettings,
|
||||
general::GeneralSettings, graphics::GraphicsSettings, keys::KeyBindings,
|
||||
general::GeneralSettings, graphics::GraphicsSettings, keys::KeyBindings, log::LogSettings,
|
||||
model::ModelSettings, move_mode::MoveInteractionModeSettings, navmesh::NavmeshSettings,
|
||||
recent::RecentFiles, rotate_mode::RotateInteractionModeSettings, scene::SceneSettings,
|
||||
selection::SelectionSettings, windows::WindowsSettings,
|
||||
@@ -46,6 +46,7 @@ pub mod debugging;
|
||||
pub mod general;
|
||||
pub mod graphics;
|
||||
pub mod keys;
|
||||
pub mod log;
|
||||
pub mod model;
|
||||
pub mod move_mode;
|
||||
pub mod navmesh;
|
||||
@@ -81,6 +82,10 @@ pub struct SettingsData {
|
||||
pub navmesh: NavmeshSettings,
|
||||
#[reflect(tag = "Group.KeyBindings")]
|
||||
pub key_bindings: KeyBindings,
|
||||
#[reflect(tag = "Group.Log")]
|
||||
#[reflect(hidden)]
|
||||
#[serde(default)]
|
||||
pub log: LogSettings,
|
||||
#[reflect(hidden)]
|
||||
pub scene_settings: HashMap<PathBuf, SceneSettings>,
|
||||
#[reflect(hidden)]
|
||||
@@ -122,13 +127,21 @@ impl DerefMut for Settings {
|
||||
|
||||
impl Settings {
|
||||
pub fn load() -> Result<Self, SettingsError> {
|
||||
let settings = SettingsData::load()?;
|
||||
Log::set_log_info(settings.log.log_info);
|
||||
Log::set_log_warning(settings.log.log_warning);
|
||||
Log::set_log_error(settings.log.log_error);
|
||||
Ok(Settings {
|
||||
settings: SettingsData::load()?,
|
||||
settings,
|
||||
need_save: false,
|
||||
subscribers: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn data_mut(&mut self) -> &mut SettingsData {
|
||||
&mut self.settings
|
||||
}
|
||||
|
||||
pub fn force_save(&mut self) {
|
||||
self.need_save = false;
|
||||
Log::verify(self.settings.save());
|
||||
|
||||
Reference in New Issue
Block a user