Can Open Multiple Graphs

This commit is contained in:
Chromium 2025-04-29 07:02:20 +01:00
parent 05600f7bc1
commit e60d3604c0

View File

@ -14,23 +14,25 @@ namespace ImageProcessingGraph.Editor.Windows
public static void Open(ImageProcessingGraphAsset asset)
{
ImageProcessingGraphEditorWindow[] windows = Resources.FindObjectsOfTypeAll<ImageProcessingGraphEditorWindow>();
foreach (var w in windows)
var existingWindows = Resources.FindObjectsOfTypeAll<ImageProcessingGraphEditorWindow>();
foreach (var w in existingWindows)
{
w.Focus();
return;
if (w.CurrentGraph == asset)
{
w.Focus(); // 👁 focus the OG window
return;
}
}
ImageProcessingGraphEditorWindow window =
CreateWindow<ImageProcessingGraphEditorWindow>(typeof(ImageProcessingGraphEditorWindow),
typeof(SceneView));
window.titleContent = new GUIContent($"{asset.name}", EditorGUIUtility.ObjectContent(null, typeof(ImageProcessingGraphAsset)).image
);
var window = CreateWindow<ImageProcessingGraphEditorWindow>(typeof(SceneView));
window.titleContent = new GUIContent($"{asset.name}",
EditorGUIUtility.ObjectContent(null, typeof(ImageProcessingGraphAsset)).image);
window.Load(asset);
window.Focus();
}
void OnEnable()
{
if(currentGraph != null)