diff --git a/Source/Editor/Modules/UIModule.cs b/Source/Editor/Modules/UIModule.cs index da9eaf89a..19a0c1142 100644 --- a/Source/Editor/Modules/UIModule.cs +++ b/Source/Editor/Modules/UIModule.cs @@ -628,19 +628,19 @@ namespace FlaxEditor.Modules MenuWindow = MainMenu.AddButton("Window"); cm = MenuWindow.ContextMenu; cm.VisibleChanged += OnMenuWindowVisibleChanged; - cm.AddButton("Content", Editor.Windows.ContentWin.FocusOrShow); - cm.AddButton("Scene", Editor.Windows.SceneWin.FocusOrShow); - cm.AddButton("Toolbox", Editor.Windows.ToolboxWin.FocusOrShow); - cm.AddButton("Properties", Editor.Windows.PropertiesWin.FocusOrShow); - cm.AddButton("Game", Editor.Windows.GameWin.FocusOrShow); - cm.AddButton("Editor", Editor.Windows.EditWin.FocusOrShow); - cm.AddButton("Debug Log", Editor.Windows.DebugLogWin.FocusOrShow); - cm.AddButton("Output Log", Editor.Windows.OutputLogWin.FocusOrShow); - cm.AddButton("Graphics Quality", Editor.Windows.GraphicsQualityWin.FocusOrShow); - cm.AddButton("Game Cooker", Editor.Windows.GameCookerWin.FocusOrShow); + cm.AddButton("Content", inputOptions.ContentWindow,Editor.Windows.ContentWin.FocusOrShow); + cm.AddButton("Scene", inputOptions.SceneWindow, Editor.Windows.SceneWin.FocusOrShow); + cm.AddButton("Toolbox", inputOptions.ToolboxWindow, Editor.Windows.ToolboxWin.FocusOrShow); + cm.AddButton("Properties", inputOptions.PropertiesWindow, Editor.Windows.PropertiesWin.FocusOrShow); + cm.AddButton("Game", inputOptions.GameWindow, Editor.Windows.GameWin.FocusOrShow); + cm.AddButton("Editor", inputOptions.EditorWindow, Editor.Windows.EditWin.FocusOrShow); + cm.AddButton("Debug Log", inputOptions.DebugLogWindow, Editor.Windows.DebugLogWin.FocusOrShow); + cm.AddButton("Output Log", inputOptions.OutputLogWindow, Editor.Windows.OutputLogWin.FocusOrShow); + cm.AddButton("Graphics Quality", inputOptions.GraphicsQualityWindow, Editor.Windows.GraphicsQualityWin.FocusOrShow); + cm.AddButton("Game Cooker", inputOptions.GameCookerWindow, Editor.Windows.GameCookerWin.FocusOrShow); cm.AddButton("Profiler", inputOptions.ProfilerWindow, Editor.Windows.ProfilerWin.FocusOrShow); - cm.AddButton("Content Search", Editor.ContentFinding.ShowSearch); - cm.AddButton("Visual Script Debugger", Editor.Windows.VisualScriptDebuggerWin.FocusOrShow); + cm.AddButton("Content Search", inputOptions.ContentSearchWindow, Editor.ContentFinding.ShowSearch); + cm.AddButton("Visual Script Debugger", inputOptions.VisualScriptDebuggerWindow, Editor.Windows.VisualScriptDebuggerWin.FocusOrShow); cm.AddSeparator(); cm.AddButton("Save window layout", Editor.Windows.SaveLayout); _menuWindowApplyWindowLayout = cm.AddChildMenu("Window layouts"); diff --git a/Source/Editor/Options/InputOptions.cs b/Source/Editor/Options/InputOptions.cs index b3cc93326..ff7971667 100644 --- a/Source/Editor/Options/InputOptions.cs +++ b/Source/Editor/Options/InputOptions.cs @@ -33,6 +33,25 @@ namespace FlaxEditor.Options OpenPrefab, } + /// + /// Shortcut availability in play mode. + /// + public enum PlayModeShortcutAvailability + { + /// + /// None of the window shortcuts will be available in play mode. + /// + None, + /// + /// Only the profiler window shortcut will be available in play mode. + /// + ProfilerOnly, + /// + /// All window shortcuts will be available in play mode. + /// + All, + } + /// /// Input editor options data container. /// @@ -40,6 +59,16 @@ namespace FlaxEditor.Options [HideInEditor] public sealed class InputOptions { + /// + /// Gets a value based on the current settings that indicates wether window shortcuts will be avaliable during play mode. + /// + public static bool WindowShortcutsAvaliable => !Editor.IsPlayMode || Editor.Instance.Options.Options.Input.PlayModeWindowShortcutAvaliability == PlayModeShortcutAvailability.All; + + /// + /// Gets a value based on the current settings that indicates wether the profiler window shortcut will be avaliable during play mode. + /// + public static bool ProfilerShortcutAvaliable => WindowShortcutsAvaliable || Editor.Instance.Options.Options.Input.PlayModeWindowShortcutAvaliability == PlayModeShortcutAvailability.ProfilerOnly; + #region Common [DefaultValue(typeof(InputBinding), "Ctrl+S")] @@ -230,9 +259,9 @@ namespace FlaxEditor.Options #region Profiler - [DefaultValue(typeof(InputBinding), "None")] + [DefaultValue(typeof(InputBinding), "Ctrl+Alpha7")] [EditorDisplay("Profiler", "Open Profiler Window"), EditorOrder(630)] - public InputBinding ProfilerWindow = new InputBinding(KeyboardKeys.None); + public InputBinding ProfilerWindow = new InputBinding(KeyboardKeys.Alpha7, KeyboardKeys.Control); [DefaultValue(typeof(InputBinding), "None")] [EditorDisplay("Profiler", "Start/Stop Profiler"), EditorOrder(631)] @@ -559,5 +588,64 @@ namespace FlaxEditor.Options public SceneNodeDoubleClick DoubleClickSceneNode = SceneNodeDoubleClick.Expand; #endregion + + #region Windows + + /// + /// Gets or sets a value indicating what window shortcuts will be available during play mode. + /// + [DefaultValue(PlayModeShortcutAvailability.ProfilerOnly)] + [EditorDisplay("Windows", "Avaliability in Play Mode"), EditorOrder(3000)] + public PlayModeShortcutAvailability PlayModeWindowShortcutAvaliability { get; set; } = PlayModeShortcutAvailability.ProfilerOnly; + + [DefaultValue(typeof(InputBinding), "Ctrl+Alpha5")] + [EditorDisplay("Windows"), EditorOrder(3010)] + public InputBinding ContentWindow = new InputBinding(KeyboardKeys.Alpha5, KeyboardKeys.Control); + + [DefaultValue(typeof(InputBinding), "Ctrl+Alpha4")] + [EditorDisplay("Windows"), EditorOrder(3020)] + public InputBinding SceneWindow = new InputBinding(KeyboardKeys.Alpha4, KeyboardKeys.Control); + + [DefaultValue(typeof(InputBinding), "None")] + [EditorDisplay("Windows"), EditorOrder(3030)] + public InputBinding ToolboxWindow = new InputBinding(KeyboardKeys.None); + + [DefaultValue(typeof(InputBinding), "Ctrl+Alpha3")] + [EditorDisplay("Windows"), EditorOrder(3040)] + public InputBinding PropertiesWindow = new InputBinding(KeyboardKeys.Alpha3, KeyboardKeys.Control); + + [DefaultValue(typeof(InputBinding), "Ctrl+Alpha2")] + [EditorDisplay("Windows"), EditorOrder(3050)] + public InputBinding GameWindow = new InputBinding(KeyboardKeys.Alpha2, KeyboardKeys.Control); + + [DefaultValue(typeof(InputBinding), "Ctrl+Alpha1")] + [EditorDisplay("Windows"), EditorOrder(3060)] + public InputBinding EditorWindow = new InputBinding(KeyboardKeys.Alpha1, KeyboardKeys.Control); + + [DefaultValue(typeof(InputBinding), "None")] + [EditorDisplay("Windows"), EditorOrder(3070)] + public InputBinding DebugLogWindow = new InputBinding(KeyboardKeys.None); + + [DefaultValue(typeof(InputBinding), "None")] + [EditorDisplay("Windows"), EditorOrder(3080)] + public InputBinding OutputLogWindow = new InputBinding(KeyboardKeys.C, KeyboardKeys.Control, KeyboardKeys.Shift); + + [DefaultValue(typeof(InputBinding), "None")] + [EditorDisplay("Windows"), EditorOrder(3090)] + public InputBinding GraphicsQualityWindow = new InputBinding(KeyboardKeys.None); + + [DefaultValue(typeof(InputBinding), "None")] + [EditorDisplay("Windows"), EditorOrder(4000)] + public InputBinding GameCookerWindow = new InputBinding(KeyboardKeys.None); + + [DefaultValue(typeof(InputBinding), "None")] + [EditorDisplay("Windows"), EditorOrder(4010)] + public InputBinding ContentSearchWindow = new InputBinding(KeyboardKeys.None); + + [DefaultValue(typeof(InputBinding), "None")] + [EditorDisplay("Windows"), EditorOrder(4020)] + public InputBinding VisualScriptDebuggerWindow = new InputBinding(KeyboardKeys.None); + + #endregion } } diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 7112f9d90..179e50ebb 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -1500,7 +1500,6 @@ namespace FlaxEditor.Utilities inputActions.Add(options => options.BuildNav, Editor.Instance.BuildNavMesh); inputActions.Add(options => options.BuildSDF, Editor.Instance.BuildAllMeshesSDF); inputActions.Add(options => options.TakeScreenshot, Editor.Instance.Windows.TakeScreenshot); - inputActions.Add(options => options.ProfilerWindow, () => Editor.Instance.Windows.ProfilerWin.FocusOrShow()); #if USE_PROFILER inputActions.Add(options => options.ProfilerStartStop, () => { diff --git a/Source/Editor/Windows/EditGameWindow.cs b/Source/Editor/Windows/EditGameWindow.cs index 3600acbee..888dd4250 100644 --- a/Source/Editor/Windows/EditGameWindow.cs +++ b/Source/Editor/Windows/EditGameWindow.cs @@ -140,6 +140,7 @@ namespace FlaxEditor.Windows : base(editor, true, ScrollBars.None) { Title = "Editor"; + Icon = editor.Icons.Grid32; // Create viewport Viewport = new MainEditorGizmoViewport(editor) diff --git a/Source/Editor/Windows/EditorWindow.cs b/Source/Editor/Windows/EditorWindow.cs index f96ab0a78..f61f5cce6 100644 --- a/Source/Editor/Windows/EditorWindow.cs +++ b/Source/Editor/Windows/EditorWindow.cs @@ -2,6 +2,7 @@ using System; using FlaxEditor.Content; +using FlaxEditor.Options; using FlaxEngine; using FlaxEngine.GUI; using DockWindow = FlaxEditor.GUI.Docking.DockWindow; @@ -49,6 +50,73 @@ namespace FlaxEditor.Windows } }); + // Set up editor window shortcuts + InputActions.Add(options => options.ContentWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.ContentWin.FocusOrShow(); + }); + InputActions.Add(options => options.SceneWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.SceneWin.FocusOrShow(); + }); + InputActions.Add(options => options.ToolboxWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.ToolboxWin.FocusOrShow(); + }); + InputActions.Add(options => options.PropertiesWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.PropertiesWin.FocusOrShow(); + }); + InputActions.Add(options => options.GameWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.GameWin.FocusOrShow(); + }); + InputActions.Add(options => options.EditorWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.EditWin.FocusOrShow(); + }); + InputActions.Add(options => options.DebugLogWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.DebugLogWin.FocusOrShow(); + }); + InputActions.Add(options => options.OutputLogWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.OutputLogWin.FocusOrShow(); + }); + InputActions.Add(options => options.GraphicsQualityWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.GraphicsQualityWin.FocusOrShow(); + }); + InputActions.Add(options => options.GameCookerWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.GameCookerWin.FocusOrShow(); + }); + InputActions.Add(options => options.ProfilerWindow, () => + { + if (InputOptions.ProfilerShortcutAvaliable) + Editor.Windows.ProfilerWin.FocusOrShow(); + }); + InputActions.Add(options => options.ContentFinder, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.ContentFinding.ShowSearch(); + }); + InputActions.Add(options => options.VisualScriptDebuggerWindow, () => + { + if (InputOptions.WindowShortcutsAvaliable) + Editor.Windows.VisualScriptDebuggerWin.FocusOrShow(); + }); + // Register Editor.Windows.OnWindowAdd(this); } diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs index f738a7a8c..4db3bcf0f 100644 --- a/Source/Editor/Windows/GameWindow.cs +++ b/Source/Editor/Windows/GameWindow.cs @@ -305,6 +305,7 @@ namespace FlaxEditor.Windows : base(editor, true, ScrollBars.None) { Title = "Game"; + Icon = editor.Icons.Play64; AutoFocus = true; var task = MainRenderTask.Instance; diff --git a/Source/Editor/Windows/OutputLogWindow.cs b/Source/Editor/Windows/OutputLogWindow.cs index b087947dc..cba0ba8d9 100644 --- a/Source/Editor/Windows/OutputLogWindow.cs +++ b/Source/Editor/Windows/OutputLogWindow.cs @@ -482,6 +482,7 @@ namespace FlaxEditor.Windows : base(editor, true, ScrollBars.None) { Title = "Output Log"; + Icon = editor.Icons.Info64; ClipChildren = false; FlaxEditor.Utilities.Utils.SetupCommonInputActions(this); diff --git a/Source/Editor/Windows/PropertiesWindow.cs b/Source/Editor/Windows/PropertiesWindow.cs index 87474fc3a..5ca2d3f53 100644 --- a/Source/Editor/Windows/PropertiesWindow.cs +++ b/Source/Editor/Windows/PropertiesWindow.cs @@ -66,6 +66,7 @@ namespace FlaxEditor.Windows : base(editor, true, ScrollBars.Vertical) { Title = "Properties"; + Icon = editor.Icons.Build64; AutoFocus = true; Presenter = new CustomEditorPresenter(editor.Undo, null, this); diff --git a/Source/Editor/Windows/SceneTreeWindow.cs b/Source/Editor/Windows/SceneTreeWindow.cs index e0c9e0068..8ab07e9c4 100644 --- a/Source/Editor/Windows/SceneTreeWindow.cs +++ b/Source/Editor/Windows/SceneTreeWindow.cs @@ -48,6 +48,7 @@ namespace FlaxEditor.Windows : base(editor, true, ScrollBars.None) { Title = "Scene"; + Icon = editor.Icons.Globe32; // Scene searching query input box var headerPanel = new ContainerControl diff --git a/Source/Editor/Windows/ToolboxWindow.cs b/Source/Editor/Windows/ToolboxWindow.cs index 81f7b94d4..3c9c605a4 100644 --- a/Source/Editor/Windows/ToolboxWindow.cs +++ b/Source/Editor/Windows/ToolboxWindow.cs @@ -455,6 +455,7 @@ namespace FlaxEditor.Windows : base(editor, true, ScrollBars.None) { Title = "Toolbox"; + Icon = editor.Icons.Toolbox96; FlaxEditor.Utilities.Utils.SetupCommonInputActions(this); }