|
|
|
|
|
|
using UnityEditor; |
|
|
|
using UnityEditor.Callbacks; |
|
|
|
using UnityEditor.Experimental.AssetImporters; |
|
|
|
using UnityEditor.MaterialGraph.Drawing; |
|
|
|
using UnityEngine; |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void ShowGraphEditWindow(string path) |
|
|
|
private static bool ShowGraphEditWindow(string path) |
|
|
|
if (asset == null) |
|
|
|
return false; |
|
|
|
|
|
|
|
var windows = Resources.FindObjectsOfTypeAll<SubGraphEditWindow>(); |
|
|
|
bool foundWindow = false; |
|
|
|
foreach (var w in windows) |
|
|
|
|
|
|
window.Show(); |
|
|
|
window.ChangeSelection(asset); |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
[OnOpenAsset] |
|
|
|
static bool OnOpenAsset(int instanceID, int line) |
|
|
|
{ |
|
|
|
var path = AssetDatabase.GetAssetPath(instanceID); |
|
|
|
ShowGraphEditWindow(path); |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |