/// <summary> /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path /// </summary> public void LoadNodeCanvas(string path) { // Load the NodeCanvas NodeCanvas nodeCanvas = NodeEditor.LoadNodeCanvas(path); if (nodeCanvas == null) { NewNodeCanvas(); return; } mainNodeCanvas = nodeCanvas; // Load the associated MainEditorState List <NodeEditorState> editorStates = NodeEditor.LoadEditorStates(path); mainEditorState = editorStates.Find(x => x.name == "MainEditorState"); if (mainEditorState == null) { mainEditorState = CreateInstance <NodeEditorState> (); } // Set some editor properties openedCanvasPath = path; NodeEditor.RecalculateAll(mainNodeCanvas); Repaint(); }
/// <summary> /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path /// </summary> public void LoadNodeCanvas(string path) { // Load the NodeCanvas NodeCanvas nodeCanvas = NodeEditor.LoadNodeCanvas(path); if (nodeCanvas == null) { return; } mainNodeCanvas = nodeCanvas; // Load the associated MainEditorState List <NodeEditorState> editorStates = NodeEditor.LoadEditorStates(path); mainEditorState = editorStates.Find(x => x.name == "MainEditorState"); if (mainEditorState == null) { mainEditorState = CreateInstance <NodeEditorState> (); } // Set some editor properties string[] folders = path.Split(new char[] { '/' }, StringSplitOptions.None); openedCanvas = folders [folders.Length - 1]; openedCanvasPath = path; NodeEditor.RecalculateAll(mainNodeCanvas); Repaint(); }
/// <summary> /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path /// </summary> public void LoadNodeCanvas(string path) { // Load the NodeCanvas mainNodeCanvas = NodeEditor.LoadNodeCanvas(path); if (mainNodeCanvas == null) { NewNodeCanvas(); return; } // Load the associated MainEditorState List <NodeEditorState> editorStates = NodeEditor.LoadEditorStates(path); if (editorStates.Count == 0) { mainEditorState = ScriptableObject.CreateInstance <NodeEditorState> (); } else { mainEditorState = editorStates.Find(x => x.name == "MainEditorState"); if (mainEditorState == null) { mainEditorState = editorStates[0]; } } mainEditorState.canvas = mainNodeCanvas; openedCanvasPath = path; NodeEditor.RecalculateAll(mainNodeCanvas); //SaveCache (); Repaint(); }