Ejemplo n.º 1
0
 public void SetCanvas(NodeCanvas canvas)
 {
     if (nodeCanvas != canvas)
     {
         canvas.Validate(true);
         nodeCanvas  = canvas;
         editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);
         RecreateCache();
         UpdateCanvasInfo();
         nodeCanvas.TraverseAll();
         NodeEditor.RepaintClients();
     }
 }
 /// <summary>
 /// Saves the mainNodeCanvas and it's associated mainEditorState as an asset at path
 /// </summary>
 public void SaveSceneNodeCanvas(string path)
 {
     nodeCanvas.editorStates = new NodeEditorState[] { editorState };
     NodeEditorSaveManager.SaveSceneNodeCanvas(path, ref nodeCanvas, true);
     editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);
         #if UNITY_EDITOR
     if (useCache)
     {
         DeleteCache();
     }
         #endif
     NodeEditor.RepaintClients();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Saves the mainNodeCanvas and it's associated mainEditorState as an asset at path
        /// </summary>
        public void SaveSceneNodeCanvas(string path)
        {
            nodeCanvas.editorStates = new NodeEditorState[] { editorState };
            bool switchedToScene = !nodeCanvas.livesInScene;

            NodeEditorSaveManager.SaveSceneNodeCanvas(path, ref nodeCanvas, true);
            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);
            if (switchedToScene)
            {
                RecreateCache();
            }
            NodeEditor.RepaintClients();
        }
        /// <summary>
        /// Converts the type of the canvas to the specified type.
        /// </summary>
        public static NodeCanvas ConvertCanvasType(NodeCanvas canvas, Type newType)
        {
            NodeCanvas convertedCanvas = canvas;

            if (canvas.GetType() != newType && newType != typeof(NodeCanvas) && newType.IsSubclassOf(typeof(NodeCanvas)))
            {
                canvas                       = NodeEditorSaveManager.CreateWorkingCopy(canvas, true);
                convertedCanvas              = NodeCanvas.CreateCanvas(newType);
                convertedCanvas.nodes        = canvas.nodes;
                convertedCanvas.editorStates = canvas.editorStates;
                convertedCanvas.Validate();
            }
            return(convertedCanvas);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path
        /// </summary>
        public void LoadNodeCanvas(string path)
        {
            // Try to load the NodeCanvas
            if (!File.Exists(path) || (nodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(path, true)) == null)
            {
                NewNodeCanvas();
                return;
            }
            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);

            openedCanvasPath = path;
            RecreateCache();
            UpdateCanvasInfo();
            nodeCanvas.TraverseAll();
            NodeEditor.RepaintClients();
        }
        /// <summary>
        /// Saves the mainNodeCanvas and it's associated mainEditorState as an asset at path
        /// </summary>
        public void SaveNodeCanvas(string path)
        {
            nodeCanvas.editorStates = new NodeEditorState[] { editorState };
            bool switchedToFile = nodeCanvas.livesInScene;

            NodeEditorSaveManager.SaveNodeCanvas(path, ref nodeCanvas, true);
            if (switchedToFile)
            {
                RecreateCache();
            }
            else
            {
                SaveCache(false);
            }
            NodeEditor.RepaintClients();
        }
Ejemplo n.º 7
0
        private void SaveNewTransition(Transition transition)
        {
            if (!mainNodeCanvas.nodes.Contains(transition.startNode) || !mainNodeCanvas.nodes.Contains(transition.endNode))
            {
                throw new UnityException("Cache system: Writing new Transition to save file failed as Node members are not part of the Cache!");
            }
            string path = tempSessionPath + "/LastSession.asset";

            if (AssetDatabase.GetAssetPath(mainNodeCanvas) != path)
            {
                throw new UnityException("Cache system error: Current Canvas is not saved as the temporary cache!");
            }
            NodeEditorSaveManager.AddSubAsset(transition, path);

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
        /// <summary>
        /// Creates a new cache save file for the currently loaded canvas
        /// Only called when a new canvas is created or loaded
        /// </summary>
        private void SaveCache()
        {
            if (!useCache)
            {
                return;
            }
            if (nodeCanvas.livesInScene)
            {
                DeleteCache();
                return;
            }

            nodeCanvas.editorStates = new NodeEditorState[] { editorState };
            NodeEditorSaveManager.SaveNodeCanvas(lastSessionPath, nodeCanvas, false);

            CheckCurrentCache();
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Makes sure the current canvas is saved to the cache
 /// </summary>
 private void CheckCurrentCache()
 {
     if (!useCache)
     {
         return;
     }
     if (nodeCanvas.livesInScene)
     {
         if (!NodeEditorSaveManager.HasSceneSave("lastSession"))
         {
             SaveCache();
         }
     }
     else if (UnityEditor.AssetDatabase.LoadAssetAtPath <NodeCanvas> (lastSessionPath) == null)
     {
         SaveCache();
     }
 }
        /// <summary>
        /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path
        /// </summary>
        public void LoadNodeCanvas(string path)
        {
            // Try to load the NodeCanvas
            if (!File.Exists(path) || (nodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(path, true)) == null)
            {
                NewNodeCanvas();
                return;
            }
            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);

            openedCanvasPath = path;
            if (useCache)
            {
                SaveCache();
            }
            NodeEditor.RecalculateAll(nodeCanvas);
            NodeEditor.RepaintClients();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Loads the canvas from the cache save file
        /// Called whenever a reload was made
        /// </summary>
        public void LoadCache()
        {
#if CACHE
            if (!useCache)
            {             // Simply create a ne canvas
                NewNodeCanvas();
                return;
            }

            bool skipLoad = false;
            if (cacheMemorySODump)
            {             // Check if a memory dump has been found, if so, load that
                nodeCanvas = ResourceManager.LoadResource <NodeCanvas>(SOMemoryDumpPath);
                if (nodeCanvas != null && !nodeCanvas.Validate(false))
                {
                    Debug.LogWarning("Cache Dump corrupted! Loading crash-proof lastSession, you might have lost a bit of work. \n "
                                     + "To prevent this from happening in the future, allow the Node Editor to properly save the cache "
                                     + "by clicking out of the window before switching scenes, since there are no callbacks to facilitate this!");
                    nodeCanvas = null;
                    UnityEditor.AssetDatabase.DeleteAsset(SOMemoryDumpPath);
                }
                if (nodeCanvas != null)
                {
                    skipLoad = true;
                }
            }

            // Try to load the NodeCanvas
            if (!skipLoad &&
                (!File.Exists(lastSessionPath) || (nodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(lastSessionPath, cacheWorkingCopy)) == null) &&                    // Check for asset cache
                (nodeCanvas = NodeEditorSaveManager.LoadSceneNodeCanvas("lastSession", cacheWorkingCopy)) == null)                                                      // Check for scene cache
            {
                NewNodeCanvas();
                return;
            }

            // Fetch the associated MainEditorState
            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);
            UpdateCanvasInfo();
            nodeCanvas.Validate();
            nodeCanvas.TraverseAll();
            NodeEditor.RepaintClients();
#endif
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Saves the current canvas to the cache
        /// </summary>
        public void SaveCache(bool crashSafe = true)
        {
#if CACHE
            if (!useCache)
            {
                return;
            }
            if (!nodeCanvas || nodeCanvas.GetType() == typeof(NodeCanvas))
            {
                return;
            }
            UnityEditor.EditorUtility.SetDirty(nodeCanvas);
            if (editorState != null)
            {
                UnityEditor.EditorUtility.SetDirty(editorState);
            }
            lastCacheTime = UnityEditor.EditorApplication.timeSinceStartup;

            nodeCanvas.editorStates = new NodeEditorState[] { editorState };
            if (nodeCanvas.livesInScene || nodeCanvas.allowSceneSaveOnly)
            {
                NodeEditorSaveManager.SaveSceneNodeCanvas("lastSession", ref nodeCanvas, cacheWorkingCopy);
            }
            else if (crashSafe)
            {
                NodeEditorSaveManager.SaveNodeCanvas(lastSessionPath, ref nodeCanvas, cacheWorkingCopy, true);
            }

            if (cacheMemorySODump)
            {             // Functionality for asset saves only
                if (nodeCanvas.livesInScene || nodeCanvas.allowSceneSaveOnly)
                {         // Delete for scene save so that next cache load, correct lastSession is used
                    UnityEditor.AssetDatabase.DeleteAsset(SOMemoryDumpPath);
                }
                else
                {                 // Dump all SOs used in this session (even if deleted) in this file to keep them alive for undo
                    NodeEditorUndoActions.CompleteSOMemoryDump(nodeCanvas);
                    NodeEditorSaveManager.ScriptableObjectReferenceDump(nodeCanvas.SOMemoryDump, SOMemoryDumpPath, false);
                }
            }
#endif
        }
 private void CheckCurrentCache()
 {
     if (!useCache)
     {
         return;
     }
     if (nodeCanvas.livesInScene)
     {
         if (!NodeEditorSaveManager.HasSceneSave("lastSession"))
         {
             SaveCache();
         }
     }
     else if (UnityEditor.AssetDatabase.LoadAssetAtPath <NodeCanvas>(lastSessionPath) == null)
     {
         SaveCache();
     }
     //        if (!nodeCanvas.livesInScene && UnityEditor.AssetDatabase.GetAssetPath (nodeCanvas) != lastSessionPath)
     //throw new UnityException ("Cache system error: Current Canvas is not saved as the temporary cache!");
 }
        /// <summary>
        /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path
        /// </summary>
        public void LoadSceneNodeCanvas(string path)
        {
                #if UNITY_EDITOR
            if (useCache)
            {
                DeleteCache();
            }
                #endif
            // Try to load the NodeCanvas
            if ((nodeCanvas = NodeEditorSaveManager.LoadSceneNodeCanvas(path, true)) == null)
            {
                NewNodeCanvas();
                return;
            }
            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);

            openedCanvasPath = path;
            NodeEditor.RecalculateAll(nodeCanvas);
            NodeEditor.RepaintClients();
        }
 private static void SaveCanvas(NodeEditorInputInfo info)
 {
     if (info.inputEvent.type == EventType.Layout)
     {
         return;
     }
     #if UNITY_EDITOR
     NodeEditorState state = info.editorState;
     if (!string.IsNullOrEmpty(state.canvas.savePath))
     {
         NodeEditorSaveManager.SaveNodeCanvas(state.canvas.savePath, ref state.canvas, true);
         EditorWindow.focusedWindow.ShowNotification(new GUIContent("Canvas Saved!"));
         NodeEditorCallbacks.IssueOnSaveCanvas(state.canvas);
     }
     else
     {
         EditorWindow.focusedWindow.ShowNotification(new GUIContent("No save location found. Use 'Save As' [Ctrl+Alt+S]"));
     }
     #endif
     info.inputEvent.Use();
 }
Ejemplo n.º 16
0
        private void SaveNewNode(Node node)
        {
            if (!mainNodeCanvas.nodes.Contains(node))
            {
                throw new UnityException("Cache system: Writing new Node to save file failed as Node is not part of the Cache!");
            }
            string path = tempSessionPath + "/LastSession.asset";

            if (AssetDatabase.GetAssetPath(mainNodeCanvas) != path)
            {
                throw new UnityException("Cache system error: Current Canvas is not saved as the temporary cache!");
            }
            NodeEditorSaveManager.AddSubAsset(node, path);
            foreach (NodeKnob knob in node.nodeKnobs)
            {
                NodeEditorSaveManager.AddSubAsset(knob, path);
            }

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path
        /// </summary>
        public void LoadSceneNodeCanvas(string path)
        {
            if (path.StartsWith("SCENE/"))
            {
                path = path.Substring(6);
            }

            // Try to load the NodeCanvas
            if ((nodeCanvas = NodeEditorSaveManager.LoadSceneNodeCanvas(path, true)) == null)
            {
                NewNodeCanvas();
                return;
            }
            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);

            openedCanvasPath = path;
            nodeCanvas.Validate();
            RecreateCache();
            UpdateCanvasInfo();
            nodeCanvas.TraverseAll();
            NodeEditor.RepaintClients();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path
        /// </summary>
        public void LoadNodeCanvas(string path)
        {
            // Try to load the NodeCanvas
            if (!File.Exists(path) || (nodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(path, true)) == null)
            {
                NewNodeCanvas();
                return;
            }
            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);

            openedCanvasPath = path;
            nodeCanvas.Validate();
            RecreateCache();
            UpdateCanvasInfo();
            nodeCanvas.TraverseAll();
            NodeEditor.RepaintClients();

#if UNITY_EDITOR
            UnityEditor.AssetDatabase.DeleteAsset(SOMemoryDumpPath);
            NodeEditorUndoActions.CompleteSOMemoryDump(nodeCanvas);
#endif
        }
        private static void SaveCanvasAs(NodeEditorInputInfo info)
        {
            if (info.inputEvent.type == EventType.Layout)
            {
                return;
            }
            NodeEditorState state     = info.editorState;
            string          panelPath = NodeEditor.editorPath + "Resources/Saves/";

            if (state.canvas != null && !string.IsNullOrEmpty(state.canvas.savePath))
            {
                panelPath = state.canvas.savePath;
            }
            #if UNITY_EDITOR
            string path = EditorUtility.SaveFilePanelInProject("Save Node Canvas", "Node Canvas", "asset", "", panelPath);
            if (!string.IsNullOrEmpty(path))
            {
                NodeEditorSaveManager.SaveNodeCanvas(path, ref state.canvas, true);
            }
            #endif
            info.inputEvent.Use();
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path
        /// </summary>
        public void LoadNodeCanvas(string path)
        {
            // Else it will be stuck forever
            NodeEditor.StopTransitioning(mainNodeCanvas);

            // Load the NodeCanvas
            mainNodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(path, true);
            if (mainNodeCanvas == null)
            {
                Debug.Log("Error loading NodeCanvas from '" + path + "'!");
                NewNodeCanvas();
                return;
            }

            // Load the associated MainEditorState
            List <NodeEditorState> editorStates = NodeEditorSaveManager.LoadEditorStates(path, true);

            if (editorStates.Count == 0)
            {
                mainEditorState = ScriptableObject.CreateInstance <NodeEditorState> ();
                Debug.LogError("The save file '" + path + "' did not contain an associated 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();
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Loads the canvas from the cache save file
        /// Called whenever a reload was made
        /// </summary>
        public void LoadCache()
        {
#if CACHE
            if (!useCache)
            {             // Simply create a ne canvas
                NewNodeCanvas();
                return;
            }

            bool skipLoad = false;
            if (cacheMemorySODump)
            {             // Check if a memory dump has been found, if so, load that
                nodeCanvas = ResourceManager.LoadResource <NodeCanvas>(SOMemoryDumpPath);
                if (nodeCanvas != null)
                {
                    skipLoad = true;
                }
            }

            // Try to load the NodeCanvas
            if (!skipLoad &&
                (!File.Exists(lastSessionPath) || (nodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(lastSessionPath, cacheWorkingCopy)) == null) &&                    // Check for asset cache
                (nodeCanvas = NodeEditorSaveManager.LoadSceneNodeCanvas("lastSession", cacheWorkingCopy)) == null)                                                      // Check for scene cache
            {
                NewNodeCanvas();
                return;
            }

            // Fetch the associated MainEditorState
            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);
            UpdateCanvasInfo();
            nodeCanvas.Validate();
            nodeCanvas.TraverseAll();
            NodeEditor.RepaintClients();
#endif
        }
Ejemplo n.º 22
0
 private void CheckCurrentCache()
 {
                 #if UNITY_EDITOR && EDITOR_CACHE_ASSET
     if (!useCache)
     {
         return;
     }
     if (nodeCanvas.livesInScene)
     {
         if (NodeEditorSaveManager.FindOrCreateSceneSave("lastSession").savedNodeCanvas != nodeCanvas)
         {
             Debug.LogError("Cache system error: Current scene canvas is not saved as the temporary cache scene save!");
         }
     }
     else if (UnityEditor.AssetDatabase.GetAssetPath(nodeCanvas) != lastSessionPath)
     {
         Debug.LogError("Cache system error: Current asset canvas is not saved as the temporary cache asset!");
     }
                 #elif UNITY_EDITOR
     if (!useCache)
     {
         return;
     }
     if (nodeCanvas.livesInScene)
     {
         if (NodeEditorSaveManager.FindOrCreateSceneSave("lastSession").savedNodeCanvas == null)
         {
             SaveCache();
         }
     }
     else if (UnityEditor.AssetDatabase.LoadAssetAtPath <NodeCanvas> (lastSessionPath) == null)
     {
         SaveCache();
     }
                 #endif
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path
        /// 加载一个Canvas
        /// </summary>
        public void LoadNodeCanvas(string path)
        {
            //如果路径一致,说明是同一个canvas
            if (NodeEditor.curEditorState != null && NodeEditor.curEditorState.canvas != null && (NodeEditor.curEditorState.canvas.savePath == path ||
                                                                                                  path.Contains(NodeEditor.curEditorState.canvas.savePath)) && (
                    NodeEditorSaveManager.GetLastCanvasPath() == path || path.Contains(NodeEditorSaveManager.GetLastCanvasPath())))
            {
                this.nodeCanvas = NodeEditor.curEditorState.canvas;
                return;
            }

            //如果不存在路径,则新建一个DefaultCanvas
            if (!File.Exists(path) || (nodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(path)) == null)
            {
                NewNodeCanvas();
                return;
            }

            editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);
            nodeCanvas.Validate();
            UpdateCanvasInfo();
            NodeEditor.RepaintClients();
            Debug.Log($"加载{path}成功");
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Converts the given canvas to the specified type
        /// </summary>
        public static NodeCanvas ConvertCanvasType(NodeCanvas canvas, Type newType)
        {
            NodeCanvas convertedCanvas = canvas;

            if (canvas.GetType() != newType && newType.IsSubclassOf(typeof(NodeCanvas)))
            {
                canvas.Validate();
                canvas                       = NodeEditorSaveManager.CreateWorkingCopy(canvas);
                convertedCanvas              = NodeCanvas.CreateCanvas(newType);
                convertedCanvas.nodes        = canvas.nodes;
                convertedCanvas.groups       = canvas.groups;
                convertedCanvas.editorStates = canvas.editorStates;
                for (int i = 0; i < convertedCanvas.nodes.Count; i++)
                {
                    if (!CheckCanvasCompability(convertedCanvas.nodes[i].GetID, newType))
                    {                     // Check if nodes is even compatible with the canvas, if not delete it
                        convertedCanvas.nodes[i].Delete();
                        i--;
                    }
                }
                convertedCanvas.Validate();
            }
            return(convertedCanvas);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Saves the mainNodeCanvas and it's associated mainEditorState as an asset at path
 /// </summary>
 public void SaveNodeCanvas(string path)
 {
     NodeEditorSaveManager.SaveNodeCanvas(path, true, mainNodeCanvas, mainEditorState);
     Repaint();
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Creates a node of the specified ID at pos on the specified canvas, optionally auto-connecting the specified output to a matching input
        /// silent disables any events, init specifies whether OnCreate should be called
        /// </summary>
        public static Node Create(string nodeID, Vector2 pos, NodeCanvas hostCanvas,
                                  ConnectionPort connectingPort = null, bool silent = false, bool init = true)
        {
            if (string.IsNullOrEmpty(nodeID) || hostCanvas == null)
            {
                throw new ArgumentException();
            }
            if (!NodeCanvasManager.CheckCanvasCompability(nodeID, hostCanvas.GetType()))
            {
                throw new UnityException("Cannot create Node with ID '" + nodeID +
                                         "' as it is not compatible with the current canavs type (" +
                                         hostCanvas.GetType().ToString() + ")!");
            }
            if (!hostCanvas.CanAddNode(nodeID))
            {
                throw new UnityException("Cannot create Node with ID '" + nodeID + "' on the current canvas of type (" +
                                         hostCanvas.GetType().ToString() + ")!");
            }
            // Create node from data
            NodeTypeData data = NodeTypes.GetNodeData(nodeID);
            Node         node = (Node)CreateInstance(data.type);

            if (node == null)
            {
                return(null);
            }

            // Init node state
            node.canvas   = hostCanvas;
            node.name     = node.Title;
            node.autoSize = node.DefaultSize;
            node.position = pos;

            Undo.RecordObject(hostCanvas, "NodeEditor_新增保存");
            NodeEditorSaveManager.AddSubAsset(node, hostCanvas);
            ConnectionPortManager.UpdateConnectionPorts(node);
            if (init)
            {
                node.OnCreate();
            }

            if (connectingPort != null)
            {
                // Handle auto-connection and link the output to the first compatible input
                for (int i = 0; i < node.connectionPorts.Count; i++)
                {
                    if (node.connectionPorts[i].TryApplyConnection(connectingPort, silent))
                    {
                        break;
                    }
                }
            }

            // Add node to host canvas
            hostCanvas.nodes.Add(node);
            if (!silent)
            {
                // Callbacks
                NodeEditorCallbacks.IssueOnAddNode(node);
                hostCanvas.Validate();
                NodeEditor.RepaintClients();
            }

            return(node);
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Saves the mainNodeCanvas and it's associated mainEditorState as an asset at path
 /// </summary>
 public void SaveNodeCanvas(string path)
 {
     nodeCanvas.editorStates = new NodeEditorState[] { editorState };
     NodeEditorSaveManager.SaveNodeCanvas(path, ref nodeCanvas);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Saves the mainNodeCanvas and it's associated mainEditorState as an asset at path
 /// </summary>
 public void SaveNodeCanvas(string path)
 {
     nodeCanvas.editorStates = new NodeEditorState[] { editorState };
     NodeEditorSaveManager.SaveNodeCanvas(path, nodeCanvas, true);
     NodeEditor.RepaintClients();
 }
 public void SetCanvas(NodeCanvas canvas)
 {
     nodeCanvas  = canvas;
     editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier);
     NodeEditor.RepaintClients();
 }