Can Open Multiple Graphs
This commit is contained in:
parent
05600f7bc1
commit
e60d3604c0
@ -14,23 +14,25 @@ namespace ImageProcessingGraph.Editor.Windows
|
|||||||
|
|
||||||
public static void Open(ImageProcessingGraphAsset asset)
|
public static void Open(ImageProcessingGraphAsset asset)
|
||||||
{
|
{
|
||||||
ImageProcessingGraphEditorWindow[] windows = Resources.FindObjectsOfTypeAll<ImageProcessingGraphEditorWindow>();
|
var existingWindows = Resources.FindObjectsOfTypeAll<ImageProcessingGraphEditorWindow>();
|
||||||
|
foreach (var w in existingWindows)
|
||||||
foreach (var w in windows)
|
|
||||||
{
|
{
|
||||||
w.Focus();
|
if (w.CurrentGraph == asset)
|
||||||
return;
|
{
|
||||||
|
w.Focus(); // 👁 focus the OG window
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageProcessingGraphEditorWindow window =
|
var window = CreateWindow<ImageProcessingGraphEditorWindow>(typeof(SceneView));
|
||||||
CreateWindow<ImageProcessingGraphEditorWindow>(typeof(ImageProcessingGraphEditorWindow),
|
window.titleContent = new GUIContent($"{asset.name}",
|
||||||
typeof(SceneView));
|
EditorGUIUtility.ObjectContent(null, typeof(ImageProcessingGraphAsset)).image);
|
||||||
|
|
||||||
window.titleContent = new GUIContent($"{asset.name}", EditorGUIUtility.ObjectContent(null, typeof(ImageProcessingGraphAsset)).image
|
|
||||||
);
|
|
||||||
window.Load(asset);
|
window.Load(asset);
|
||||||
|
window.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
{
|
{
|
||||||
if(currentGraph != null)
|
if(currentGraph != null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user