/// <summary> /// Loads the canvas from the cache save file /// Called whenever a reload was made /// </summary> private void LoadCache() { #if UNITY_EDITOR if (!useCache) { NewNodeCanvas(); return; } // Try to load the NodeCanvas if ( (!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); #if EDITOR_CACHE_ASSET if (!nodeCanvas.livesInScene && !UnityEditor.AssetDatabase.Contains(editorState)) { NodeEditorSaveManager.AddSubAsset(editorState, lastSessionPath); } #endif CheckCurrentCache(); UpdateCanvasInfo(); nodeCanvas.TraverseAll(); NodeEditor.RepaintClients(); #endif }
/// <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; } // Try to load the NodeCanvas if ((!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 }
/// <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); #if UNITY_EDITOR UnityEditor.AssetDatabase.DeleteAsset(SOMemoryDumpPath); #endif openedCanvasPath = path; nodeCanvas.Validate(); RecreateCache(); UpdateCanvasInfo(); nodeCanvas.TraverseAll(); NodeEditor.RepaintClients(); }
/// <summary> /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path /// </summary> public void LoadSceneNodeCanvas(string path) { // Try to load the NodeCanvas if ((nodeCanvas = NodeEditorSaveManager.LoadSceneNodeCanvas(path, true)) == null) { NewNodeCanvas(); return; } editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier); openedCanvasPath = path; RecreateCache(); UpdateCanvasInfo(); nodeCanvas.TraverseAll(); NodeEditor.RepaintClients(); }
/// <summary> /// Loads the mainNodeCanvas and it's associated mainEditorState from an asset at path /// </summary> public void LoadSceneNodeCanvas(string path) { if (useCache) { DeleteCache(); } // 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(); }
/// <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 }
/// <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 }