private static bool AutoOpenCanvas(int instanceID, int line) { if (Selection.activeObject != null && Selection.activeObject is NodeCanvas) { string NodeCanvasPath = AssetDatabase.GetAssetPath(instanceID); NodeEditorWindow.OpenNodeEditor().canvasCache.LoadNodeCanvas(NodeCanvasPath); return(true); } return(false); }
public static NodeEditorWindow OpenNodeEditor() { _editor = GetWindow <NodeEditorWindow>(); _editor.minSize = new Vector2(400, 200); NodeEditor.ReInit(false);//0.113 -> NodeEditorInputSystem.SetupInput() Texture iconTexture = ResourceManager.LoadTexture(EditorGUIUtility.isProSkin ? "Textures/Icon_Dark.png" : "Textures/Icon_Light.png"); _editor.titleContent = new GUIContent("Node Editor", iconTexture); return(_editor); }
private static bool AutoOpenCanvas(int instanceID, int line) { if (Selection.activeObject != null && Selection.activeObject.GetType() == typeof(NodeCanvas)) { string NodeCanvasPath = AssetDatabase.GetAssetPath(instanceID); NodeEditorWindow.OpenNodeEditor(); EditorWindow.GetWindow <NodeEditorWindow> ().LoadNodeCanvas(NodeCanvasPath); return(true); } return(false); }
public static NodeEditorWindow OpenNodeEditor() { _editor = GetWindow <NodeEditorWindow>(); _editor.minSize = new Vector2(800, 600); NodeEditor.initiated = NodeEditor.InitiationError = false; iconTexture = ResourceManager.LoadTexture(EditorGUIUtility.isProSkin ? "Textures/Icon_Dark.png" : "Textures/Icon_Light.png"); _editor.titleContent = new GUIContent("Node Editor", iconTexture); return(_editor); }
public static NodeEditorWindow OpenNodeEditor() { _editor = GetWindow <NodeEditorWindow>(); _editor.minSize = new Vector2(400, 200); NodeEditor.ReInit(false); Texture iconTexture = ResourceManager.LoadTexture("Textures/Icon_Dark.png"); _editor.titleContent = new GUIContent("Node Editor", iconTexture); return(_editor); }
private void OnDestroy() { editorInterface.AssertSavaCanvasSuccessfully(); // Unsubscribe from events NodeEditor.ClientRepaints -= Repaint; NodeEditor.curEditorState = null; NodeEditor.curNodeCanvas = null; editorInterface = null; _editor = null; this.canvasCache = null; }
private void OnEnable() { _editor = this; NormalReInit();//0.215 -> NodeEditor.ReInit() // Subscribe to events NodeEditor.ClientRepaints -= Repaint; NodeEditor.ClientRepaints += Repaint; EditorLoadingControl.justLeftPlayMode -= NormalReInit; EditorLoadingControl.justLeftPlayMode += NormalReInit; EditorLoadingControl.justOpenedNewScene -= NormalReInit; EditorLoadingControl.justOpenedNewScene += NormalReInit; SceneView.onSceneGUIDelegate -= OnSceneGUI; SceneView.onSceneGUIDelegate += OnSceneGUI; }
/* * /// <summary> * /// Assures that the canvas is opened when double-clicking a canvas asset * /// </summary> * [UnityEditor.Callbacks.OnOpenAsset(1)] * private static bool AutoOpenCanvas(int instanceID, int line) * { * if (Selection.activeObject != null && Selection.activeObject is NodeCanvas) * { * string NodeCanvasPath = AssetDatabase.GetAssetPath(instanceID); * OpenNodeEditor().canvasCache.LoadNodeCanvas(NodeCanvasPath); * return true; * } * return false; * } */ private void OnEnable() { _editor = this; NormalReInit(); // Subscribe to events NodeEditor.ClientRepaints -= Repaint; NodeEditor.ClientRepaints += Repaint; EditorLoadingControl.justLeftPlayMode -= NormalReInit; EditorLoadingControl.justLeftPlayMode += NormalReInit; EditorLoadingControl.justOpenedNewScene -= NormalReInit; EditorLoadingControl.justOpenedNewScene += NormalReInit; SceneView.duringSceneGui -= OnSceneGUI; SceneView.duringSceneGui += OnSceneGUI; EditorApplication.LockReloadAssemblies(); }
/* * /// <summary> * /// Assures that the canvas is opened when double-clicking a canvas asset * /// </summary> * [UnityEditor.Callbacks.OnOpenAsset(1)] * private static bool AutoOpenCanvas(int instanceID, int line) * { * if (Selection.activeObject != null && Selection.activeObject is NodeCanvas) * { * string NodeCanvasPath = AssetDatabase.GetAssetPath(instanceID); * OpenNodeEditor().canvasCache.LoadNodeCanvas(NodeCanvasPath); * return true; * } * return false; * } */ private void OnEnable() { _editor = this; NormalReInit(); // Subscribe to events NodeEditor.ClientRepaints -= Repaint; NodeEditor.ClientRepaints += Repaint; EditorLoadingControl.justLeftPlayMode -= NormalReInit; EditorLoadingControl.justLeftPlayMode += NormalReInit; EditorLoadingControl.justOpenedNewScene -= NormalReInit; EditorLoadingControl.justOpenedNewScene += NormalReInit; SceneView.onSceneGUIDelegate -= OnSceneGUI; SceneView.onSceneGUIDelegate += OnSceneGUI; NodeEditorInterface.GetInstance().isOpenedWindows = true; }
private void OnEnable() { _editor = this; NodeEditor.checkInit(false); NodeEditor.ClientRepaints -= Repaint; NodeEditor.ClientRepaints += Repaint; EditorLoadingControl.justLeftPlayMode -= NormalReInit; EditorLoadingControl.justLeftPlayMode += NormalReInit; // Here, both justLeftPlayMode and justOpenedNewScene have to act because of timing EditorLoadingControl.justOpenedNewScene -= NormalReInit; EditorLoadingControl.justOpenedNewScene += NormalReInit; // Setup Cache tempSessionPath = Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this))); SetupCacheEvents(); LoadCache(); }
/* * /// <summary> * /// Assures that the canvas is opened when double-clicking a canvas asset * /// </summary> * [UnityEditor.Callbacks.OnOpenAsset(1)] * private static bool AutoOpenCanvas(int instanceID, int line) * { * if (Selection.activeObject != null && Selection.activeObject is NodeCanvas) * { * string NodeCanvasPath = AssetDatabase.GetAssetPath(instanceID); * OpenNodeEditor().canvasCache.LoadNodeCanvas(NodeCanvasPath); * return true; * } * return false; * } */ private void OnEnable() { _editor = this; NormalReInit(); // Subscribe to events NodeEditor.ClientRepaints -= Repaint; NodeEditor.ClientRepaints += Repaint; EditorLoadingControl.justLeftPlayMode -= NormalReInit; EditorLoadingControl.justLeftPlayMode += NormalReInit; EditorLoadingControl.justOpenedNewScene -= NormalReInit; EditorLoadingControl.justOpenedNewScene += NormalReInit; SceneView.onSceneGUIDelegate -= OnSceneGUI; SceneView.onSceneGUIDelegate += OnSceneGUI; Undo.undoRedoPerformed -= NodeEditor.RepaintClients; Undo.undoRedoPerformed += NodeEditor.RepaintClients; Undo.undoRedoPerformed -= UndoRedoRecalculate; Undo.undoRedoPerformed += UndoRedoRecalculate; }
private void OnEnable() { _editor = this; NodeEditor.checkInit(false); NodeEditor.ClientRepaints -= Repaint; NodeEditor.ClientRepaints += Repaint; EditorLoadingControl.justLeftPlayMode -= NormalReInit; EditorLoadingControl.justLeftPlayMode += NormalReInit; // Here, both justLeftPlayMode and justOpenedNewScene have to act because of timing EditorLoadingControl.justOpenedNewScene -= NormalReInit; EditorLoadingControl.justOpenedNewScene += NormalReInit; SceneView.onSceneGUIDelegate -= OnSceneGUI; SceneView.onSceneGUIDelegate += OnSceneGUI; // Setup Cache canvasCache = new NodeEditorUserCache(Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this)))); canvasCache.SetupCacheEvents(true); }
public override void OnInspectorGUI() { if (canvas == null) { canvas = (NodeCanvas)target; } if (canvas == null) { return; } if (titleStyle == null) { titleStyle = new GUIStyle(GUI.skin.label); titleStyle.fontStyle = FontStyle.Bold; titleStyle.alignment = TextAnchor.MiddleCenter; titleStyle.fontSize = 16; } if (subTitleStyle == null) { subTitleStyle = new GUIStyle(GUI.skin.label); subTitleStyle.fontStyle = FontStyle.Bold; subTitleStyle.alignment = TextAnchor.MiddleCenter; subTitleStyle.fontSize = 12; } if (boldLabelStyle == null) { boldLabelStyle = new GUIStyle(GUI.skin.label); boldLabelStyle.fontStyle = FontStyle.Bold; } EditorGUI.BeginChangeCheck(); GUILayout.Space(10); GUILayout.Label(new GUIContent(canvas.saveName, canvas.savePath), titleStyle); GUILayout.Label(canvas.livesInScene? "Scene Save" : "Asset Save", subTitleStyle); GUILayout.Label("Type: " + canvas.canvasName, subTitleStyle); GUILayout.Space(10); EditorGUI.BeginDisabledGroup(NodeEditor.curNodeCanvas != null && NodeEditor.curNodeCanvas.savePath == canvas.savePath); if (GUILayout.Button("Open")) { string NodeCanvasPath = AssetDatabase.GetAssetPath(canvas); NodeEditorWindow.OpenNodeEditor().canvasCache.LoadNodeCanvas(NodeCanvasPath); } EditorGUI.EndDisabledGroup(); GUILayout.Space(10); GUILayout.Label("Nodes", boldLabelStyle); foreach (Node node in canvas.nodes) { string label = node.Title; EditorGUILayout.ObjectField(label, node, node.GetType(), true); } GUILayout.Space(10); canvas.DrawCanvasPropertyEditor(); if (EditorGUI.EndChangeCheck()) { NodeEditor.RepaintClients(); } }