add window shortcuts
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -33,6 +33,25 @@ namespace FlaxEditor.Options
|
||||
OpenPrefab,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play Mode shortcuts availability in play mode.
|
||||
/// </summary>
|
||||
public enum PlayModeShortcutAvailability
|
||||
{
|
||||
/// <summary>
|
||||
/// None of the window shortcuts will be available in play mode.
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// Only the profiler window shortcut will be available in play mode.
|
||||
/// </summary>
|
||||
ProfilerOnly,
|
||||
/// <summary>
|
||||
/// All window shortcuts will be available in play mode.
|
||||
/// </summary>
|
||||
All,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Input editor options data container.
|
||||
/// </summary>
|
||||
@@ -40,6 +59,16 @@ namespace FlaxEditor.Options
|
||||
[HideInEditor]
|
||||
public sealed class InputOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO.
|
||||
/// </summary>
|
||||
public static bool WindowShortcutsAvaliable => !Editor.IsPlayMode || Editor.Instance.Options.Options.Input.PlayModeWindowShortcutAvaliability == PlayModeShortcutAvailability.All;
|
||||
|
||||
/// <summary>
|
||||
/// TODO.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating what window shortcuts will be available during play mode.
|
||||
/// </summary>
|
||||
[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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, () =>
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user