Add option *Select actors using this asset* to content menu

This commit is contained in:
Wojtek Figat
2021-10-08 14:39:21 +02:00
parent 352abd1e41
commit fa441abf5c
2 changed files with 31 additions and 25 deletions

View File

@@ -57,31 +57,7 @@ namespace FlaxEditor.Modules
}
if (window != null && !disableAutoShow)
{
var newLocation = (DockState)Editor.Options.Options.Interface.NewWindowLocation;
if (newLocation == DockState.Float)
{
// 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 win = Editor.UI.MasterPanel.FloatingPanels[i];
// 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);
}
Editor.Windows.Open(window);
}
return window;

View File

@@ -665,6 +665,36 @@ namespace FlaxEditor.Modules
}
}
/// <summary>
/// Opens the specified editor window (shows it with editor options handling for new windows).
/// </summary>
/// <param name="window">The window.</param>
public void Open(EditorWindow window)
{
var newLocation = (DockState)Editor.Options.Options.Interface.NewWindowLocation;
if (newLocation == DockState.Float)
{
// 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 win = Editor.UI.MasterPanel.FloatingPanels[i];
if (Vector2.Abs(win.Size - defaultSize).LengthSquared < 100)
{
window.Show(DockState.DockFill, win);
window.Focus();
return;
}
}
window.ShowFloating(defaultSize);
}
else
{
window.Show(newLocation);
}
}
/// <summary>
/// Gets <see cref="EditorWindow"/> that is represented by the given serialized typename. Used to restore workspace layout.
/// </summary>