From 08a86066d0096f63c7d513b81eb409ec00f9588f Mon Sep 17 00:00:00 2001 From: xxSeys1 Date: Mon, 5 May 2025 13:24:01 +0200 Subject: [PATCH 1/4] add window shortcuts --- Source/Editor/Modules/UIModule.cs | 24 +++---- Source/Editor/Options/InputOptions.cs | 92 ++++++++++++++++++++++++++- Source/Editor/Utilities/Utils.cs | 1 - Source/Editor/Windows/EditorWindow.cs | 68 ++++++++++++++++++++ 4 files changed, 170 insertions(+), 15 deletions(-) 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 5168e03d0..d6854352d 100644 --- a/Source/Editor/Options/InputOptions.cs +++ b/Source/Editor/Options/InputOptions.cs @@ -33,6 +33,25 @@ namespace FlaxEditor.Options OpenPrefab, } + /// + /// Play Mode shortcuts 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 { + /// + /// TODO. + /// + public static bool WindowShortcutsAvaliable => !Editor.IsPlayMode || Editor.Instance.Options.Options.Input.PlayModeWindowShortcutAvaliability == PlayModeShortcutAvailability.All; + + /// + /// TODO. + /// + 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)] @@ -375,5 +404,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 b4666b213..26769b826 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -1505,7 +1505,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/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); } From 5b618b4f310450fddfac135857fdbf5d7c151939 Mon Sep 17 00:00:00 2001 From: xxSeys1 Date: Mon, 5 May 2025 13:24:21 +0200 Subject: [PATCH 2/4] add icons to more commonly used editor windows --- Source/Editor/Windows/EditGameWindow.cs | 1 + Source/Editor/Windows/GameWindow.cs | 1 + Source/Editor/Windows/OutputLogWindow.cs | 1 + Source/Editor/Windows/PropertiesWindow.cs | 1 + Source/Editor/Windows/SceneTreeWindow.cs | 1 + Source/Editor/Windows/ToolboxWindow.cs | 1 + 6 files changed, 6 insertions(+) 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/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); } From 87787cb5bf8fa00df232189b96b071eeeb0ad1a2 Mon Sep 17 00:00:00 2001 From: xxSeys1 Date: Mon, 5 May 2025 15:15:32 +0200 Subject: [PATCH 3/4] replace Todo doc comments --- Source/Editor/Options/InputOptions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Options/InputOptions.cs b/Source/Editor/Options/InputOptions.cs index d6854352d..18025633b 100644 --- a/Source/Editor/Options/InputOptions.cs +++ b/Source/Editor/Options/InputOptions.cs @@ -60,12 +60,12 @@ namespace FlaxEditor.Options public sealed class InputOptions { /// - /// TODO. + /// 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; /// - /// TODO. + /// 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; From 6be193bfbf2425115fcc5386c4d88f372bb09a41 Mon Sep 17 00:00:00 2001 From: xxSeys1 Date: Fri, 9 May 2025 11:39:40 +0200 Subject: [PATCH 4/4] fix tooltip --- Source/Editor/Options/InputOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/Options/InputOptions.cs b/Source/Editor/Options/InputOptions.cs index 18025633b..2a173d49c 100644 --- a/Source/Editor/Options/InputOptions.cs +++ b/Source/Editor/Options/InputOptions.cs @@ -34,7 +34,7 @@ namespace FlaxEditor.Options } /// - /// Play Mode shortcuts availability in play mode. + /// Shortcut availability in play mode. /// public enum PlayModeShortcutAvailability {