Fix showing Content Search window to properly use context window

This commit is contained in:
Wojtek Figat
2025-03-31 14:12:03 +02:00
parent f947aa3ae2
commit c00876fa94
2 changed files with 4 additions and 3 deletions

View File

@@ -92,7 +92,7 @@ namespace FlaxEditor.Modules
DockWindow window = null;
foreach (var editorWindow in Editor.Windows.Windows)
{
if (editorWindow.Visible && editorWindow.ContainsFocus)
if (editorWindow.Visible && editorWindow.ContainsFocus && editorWindow.Parent != null)
{
window = editorWindow;
break;

View File

@@ -570,6 +570,7 @@ namespace FlaxEditor.Surface
var interfaceOptions = editor.Options.Options.Interface;
var inputOptions = editor.Options.Options.Input;
var undo = surface.Undo;
var showSearch = () => editor.ContentFinding.ShowSearch(window);
// Toolstrip
saveButton = toolStrip.AddButton(editor.Icons.Save64, window.Save).LinkTooltip("Save", ref inputOptions.Save);
@@ -577,7 +578,7 @@ namespace FlaxEditor.Surface
undoButton = toolStrip.AddButton(editor.Icons.Undo64, undo.PerformUndo).LinkTooltip("Undo", ref inputOptions.Undo);
redoButton = toolStrip.AddButton(editor.Icons.Redo64, undo.PerformRedo).LinkTooltip("Redo", ref inputOptions.Redo);
toolStrip.AddSeparator();
toolStrip.AddButton(editor.Icons.Search64, editor.ContentFinding.ShowSearch).LinkTooltip("Open content search tool", ref inputOptions.Search);
toolStrip.AddButton(editor.Icons.Search64, showSearch).LinkTooltip("Open content search tool", ref inputOptions.Search);
toolStrip.AddButton(editor.Icons.CenterView64, surface.ShowWholeGraph).LinkTooltip("Show whole graph");
var gridSnapButton = toolStrip.AddButton(editor.Icons.Grid32, surface.ToggleGridSnapping);
gridSnapButton.LinkTooltip("Toggle grid snapping for nodes.");
@@ -588,7 +589,7 @@ namespace FlaxEditor.Surface
// Setup input actions
window.InputActions.Add(options => options.Undo, undo.PerformUndo);
window.InputActions.Add(options => options.Redo, undo.PerformRedo);
window.InputActions.Add(options => options.Search, editor.ContentFinding.ShowSearch);
window.InputActions.Add(options => options.Search, showSearch);
}
}
}