Rename NewWindowMethod to NewWindowLocation and add handling for new asset windows too

#577
This commit is contained in:
Wojtek Figat
2021-08-05 18:56:55 +02:00
parent 16654fa639
commit 425c23fea1
3 changed files with 28 additions and 22 deletions

View File

@@ -241,7 +241,7 @@ namespace FlaxEditor.GUI.Docking
/// </summary>
public void FocusOrShow()
{
FocusOrShow((DockState)Editor.Instance.Options.Options.Interface.NewWindowMethod);
FocusOrShow((DockState)Editor.Instance.Options.Options.Interface.NewWindowLocation);
}
/// <summary>

View File

@@ -2,9 +2,9 @@
using System;
using FlaxEditor.Content;
using FlaxEditor.GUI.Docking;
using FlaxEditor.Windows;
using FlaxEngine;
using DockState = FlaxEditor.GUI.Docking.DockState;
namespace FlaxEditor.Modules
{
@@ -42,7 +42,6 @@ namespace FlaxEditor.Modules
var proxy = Editor.ContentDatabase.GetProxy(item);
if (proxy == null)
{
// Error
Editor.Log("Missing content proxy object for " + item);
return null;
}
@@ -58,24 +57,31 @@ namespace FlaxEditor.Modules
}
if (window != null && !disableAutoShow)
{
// Check if there is a floating window that has the same size
Vector2 defaultSize = window.DefaultSize;
for (var i = 0; i < Editor.UI.MasterPanel.FloatingPanels.Count; i++)
var newLocation = (DockState)Editor.Options.Options.Interface.NewWindowLocation;
if (newLocation == DockState.Float)
{
var win = Editor.UI.MasterPanel.FloatingPanels[i];
// Check if size is similar
if (Vector2.Abs(win.Size - defaultSize).LengthSquared < 100)
// Check if there is a floating window that has the same size
Vector2 defaultSize = window.DefaultSize;
for (var i = 0; i < Editor.UI.MasterPanel.FloatingPanels.Count; i++)
{
// Dock
window.Show(DockState.DockFill, win);
window.Focus();
return window;
}
}
var win = Editor.UI.MasterPanel.FloatingPanels[i];
// Show floating
window.ShowFloating(defaultSize);
// Check if size is similar
if (Vector2.Abs(win.Size - defaultSize).LengthSquared < 100)
{
// Dock
window.Show(DockState.DockFill, win);
window.Focus();
return window;
}
}
window.ShowFloating(defaultSize);
}
else
{
window.Show(newLocation);
}
}
return window;
@@ -122,7 +128,7 @@ namespace FlaxEditor.Modules
if (item is NewItem ni)
{
if (!ni.Proxy.IsFileNameValid(shortName))
{
{
hint = "Name does not follow " + ni.Proxy.Name + " name restrictions !";
return false;
}
@@ -131,7 +137,7 @@ namespace FlaxEditor.Modules
{
var proxy = Editor.ContentDatabase.GetProxy(item);
if (proxy != null && !proxy.IsFileNameValid(shortName))
{
{
hint = "Name does not follow " + proxy.Name + " name restrictions !";
return false;
}

View File

@@ -110,8 +110,8 @@ namespace FlaxEditor.Options
/// Gets or sets the method window opening.
/// </summary>
[DefaultValue(DockStateProxy.Float)]
[EditorDisplay("Interface", "Define The Opening Window Method"), EditorOrder(150), Tooltip("Define the opening method for new windows, open in a new tab by default.")]
public DockStateProxy NewWindowMethod { get; set; } = DockStateProxy.Float;
[EditorDisplay("Interface", "New Window Location"), EditorOrder(150), Tooltip("Define the opening method for new windows, open in a new tab by default.")]
public DockStateProxy NewWindowLocation { get; set; } = DockStateProxy.Float;
/// <summary>
/// Gets or sets the timestamps prefix mode for debug log messages.