// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using System.Collections.Generic; using FlaxEngine; using FlaxEngine.Json; namespace FlaxEditor.Options { /// /// Editor options data container object. /// [HideInEditor] public sealed class EditorOptions { /// /// The general options. /// public GeneralOptions General = new GeneralOptions(); /// /// The interface options. /// public InterfaceOptions Interface = new InterfaceOptions(); /// /// The input options. /// public InputOptions Input = new InputOptions(); /// /// The viewport options. /// public ViewportOptions Viewport = new ViewportOptions(); /// /// The visual options. /// public VisualOptions Visual = new VisualOptions(); /// /// The source code options. /// public SourceCodeOptions SourceCode = new SourceCodeOptions(); /// /// The theme options. /// public ThemeOptions Theme = new ThemeOptions(); /// /// The custom settings collection. Can be used by the editor plugins to provide customization for options. Key is a settings tab name and the value is the serialized settings object (for a custom editor). /// public readonly Dictionary CustomSettings = new Dictionary(); /// /// Tries to load the custom settings object by the given key. If settings are missing it creates a new default object of this type. /// /// The settings object type. /// The name. /// The loaded settings object public T GetCustomSettings(string name) where T : class, new() { if (CustomSettings.TryGetValue(name, out var json)) { return JsonSerializer.Deserialize(json); } return new T(); } } }