From e60d3604c0e6063724ee1d1af9512bfa0e5d39e4 Mon Sep 17 00:00:00 2001 From: Chromium <62724067+Chromum@users.noreply.github.com> Date: Tue, 29 Apr 2025 07:02:20 +0100 Subject: [PATCH] Can Open Multiple Graphs --- .../ImageProcessingGraphEditorWindow.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Editor/Scripts/Editor/Windows/ImageProcessingGraphEditorWindow.cs b/Editor/Scripts/Editor/Windows/ImageProcessingGraphEditorWindow.cs index d7d9057..182eb66 100644 --- a/Editor/Scripts/Editor/Windows/ImageProcessingGraphEditorWindow.cs +++ b/Editor/Scripts/Editor/Windows/ImageProcessingGraphEditorWindow.cs @@ -14,23 +14,25 @@ namespace ImageProcessingGraph.Editor.Windows public static void Open(ImageProcessingGraphAsset asset) { - ImageProcessingGraphEditorWindow[] windows = Resources.FindObjectsOfTypeAll(); - - foreach (var w in windows) + var existingWindows = Resources.FindObjectsOfTypeAll(); + foreach (var w in existingWindows) { - w.Focus(); - return; + if (w.CurrentGraph == asset) + { + w.Focus(); // 👁 focus the OG window + return; + } } - ImageProcessingGraphEditorWindow window = - CreateWindow(typeof(ImageProcessingGraphEditorWindow), - typeof(SceneView)); - - window.titleContent = new GUIContent($"{asset.name}", EditorGUIUtility.ObjectContent(null, typeof(ImageProcessingGraphAsset)).image - ); + var window = CreateWindow(typeof(SceneView)); + window.titleContent = new GUIContent($"{asset.name}", + EditorGUIUtility.ObjectContent(null, typeof(ImageProcessingGraphAsset)).image); window.Load(asset); + window.Focus(); } + + void OnEnable() { if(currentGraph != null)