Пример #1
0
        private void OnEnable()
        {
            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";

            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            PreviewLiveAnimation = true;
            _editor = this;
            NodeEditor.checkInit(false);

            NodeEditor.ClientRepaints -= Repaint;
            NodeEditor.ClientRepaints += Repaint;

            EditorLoadingControl.justLeftPlayMode   -= NormalReInit;
            EditorLoadingControl.justLeftPlayMode   += NormalReInit;
            EditorLoadingControl.justOpenedNewScene -= NormalReInit;
            EditorLoadingControl.justOpenedNewScene += NormalReInit;

            SceneView.onSceneGUIDelegate -= OnSceneGUI;
            SceneView.onSceneGUIDelegate += OnSceneGUI;

            // Fix for .Net 4
            string path = Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this)));

            path        = path.Replace("\\", "/");
            canvasCache = new NodeEditorUserCache(path);
            canvasCache.SetupCacheEvents();
        }
Пример #2
0
        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();
            if (canvasCache.nodeCanvas.GetType() == typeof(NodeCanvas))
            {
                ShowNotification(new GUIContent("The Canvas has no specific type. Please use the convert button to assign a type and re-save the canvas!"));
            }
        }
        private void OnEnable()
        {
            Debug.Log("NodeEditorTWWindow enabled");
            _editor = this;
            NodeEditor.checkInit(false);

            NodeEditorCallbacks.OnLoadCanvas -= OnLoadCanvas;
            NodeEditorCallbacks.OnLoadCanvas += OnLoadCanvas;

            NodeEditorInputControls.m_FinishedDupe -= _editor.RecalcAll;
            NodeEditorInputControls.m_FinishedDupe += _editor.RecalcAll;


            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;
            string assetPath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this));

            if (assetPath.Length > 1)
            {
//                Debug.LogError("asset path " + assetPath);
                string path = Path.GetDirectoryName(assetPath);
                // Setup Cache
                canvasCache = new NodeEditorUserCache(path);
            }
            else
            {
                Debug.LogError("UNKNOWN asset path " + assetPath);
                canvasCache = new NodeEditorUserCache(); //path);
            }
            bool loadCache = true;

            if (!Shader.Find("Hidden/TextureOps"))
            {
                string shadername1 = "http://54.237.244.93/TextureOps" + NodeEditorTWWindow.m_Version + ".txt";
                wwwShader1 = new WWW(shadername1);
                loadCache  = false;
            }

            canvasCache.SetupCacheEvents(loadCache);

            m_NodeSelectionWindow = MultiColumnWindow.GetWindow(this);

            m_InspectorWindow          = NodeInspectorWindow.Init(this);
            NodeEditor.ClientRepaints += m_InspectorWindow.Repaint;
            StartTextureWangPopup.Init(this);

            m_InspectorWindow.m_Source     = this;
            NodeEditorCallbacks.OnAddNode -= NewNodeCallback;
            NodeEditorCallbacks.OnAddNode += NewNodeCallback;
        }
Пример #4
0
        private void AssureCache()
        {
            // Get temp path to save cache to
            string tempPath;

            if (TEMP_PATH_USE_EDITOR_PATH_IF_IN_ASSETS && NodeEditor.editorPath.StartsWith("Assets") &&
                AssetDatabase.IsValidFolder(ResourceManager.StripTrailingSeparator(NodeEditor.editorPath)))
            {
                tempPath = NodeEditor.editorPath;
            }
            else if (!string.IsNullOrEmpty(TEMP_PATH_FIXED))
            {
                tempPath = TEMP_PATH_FIXED;
                Directory.CreateDirectory(tempPath);
            }
            else
            {             // Use variable temp path, only required if we have no folder in Assets/ that we can call ours to store the sessions in
                          // It will start with a default folder, but will allow users to easily move it by moving the files and a marker to any folder in Assets/
                // 1. Try to find temp path marker
                tempPath = AssetDatabase.GUIDToAssetPath(TEMP_PATH_MARKER_GUID);
                // Sometimes this will return a path but the asset behind it has been deleted
                if (!string.IsNullOrEmpty(tempPath) && !AssetDatabase.IsValidFolder(ResourceManager.UnifyPathSeparators(Path.GetDirectoryName(tempPath), '/')))
                {
                    tempPath = "";
                }
                if (string.IsNullOrEmpty(tempPath) || !File.Exists(tempPath))
                {                 // 2. Create temp path marker with specified GUID
                    if (string.IsNullOrEmpty(tempPath))
                    {             // No previous folder trace to use
                        Directory.CreateDirectory(TEMP_PATH_DEFAULT);
                        tempPath = TEMP_PATH_DEFAULT;
                    }
                    using (File.Create(tempPath + "NEFTempFilesMarker")) {}
                    using (StreamWriter sw = File.CreateText(tempPath + "NEFTempFilesMarker.meta"))
                        sw.Write(META_FILE.Replace("MARKER_GUID", TEMP_PATH_MARKER_GUID));
                    AssetDatabase.Refresh();
                    tempPath = AssetDatabase.GUIDToAssetPath(TEMP_PATH_MARKER_GUID);
                    Debug.LogWarning("Created temp marker '" + tempPath + "'! You can move this marker along with the cache files curSession and lastSession to a different cache location.");
                }
                tempPath = ResourceManager.UnifyPathSeparators(Path.GetDirectoryName(tempPath), '/') + "/";
            }
            if (!string.IsNullOrEmpty(TEMP_PATH_SUBFOLDER))
            {             // 3. Apply subfolder
                tempPath = tempPath + TEMP_PATH_SUBFOLDER;
                Directory.CreateDirectory(tempPath);
            }

            // Make sure we have a cache at that temp path with a canvas
            if (canvasCache == null)
            {
                canvasCache = new NodeEditorUserCache(tempPath);
            }
            else
            {
                canvasCache.SetCachePath(tempPath);
            }
            canvasCache.AssureCanvas();
        }
Пример #5
0
        public void Start()
        {
            NodeEditor.checkInit(false);
            FPSCounter.Create();

            cache = new NodeEditorUserCache();
            if (canvas != null)
            {
                cache.SetCanvas(canvas);
            }
        }
        public void Start()
        {
            NodeEditor.checkInit(false);
            FPSCounter.Create();

            cache = new NodeEditorUserCache();
            if (canvas != null)
            {
                cache.SetCanvas(NodeEditorSaveManager.CreateWorkingCopy(canvas, true));
            }
        }
Пример #7
0
        private void AssureSetup()
        {
            if (canvasCache == null)
            {             // Create cache
                canvasCache = new NodeEditorUserCache(Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this))));
            }
            canvasCache.AssureCanvas();

            NodeEditorInterface.GetInstance().canvasCache            = canvasCache;
            NodeEditorInterface.GetInstance().ShowNotificationAction = ShowNotification;
        }
        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 AssureSetup()
 {
     if (_canvasCache == null)
     { // Create cache
         _canvasCache = new NodeEditorUserCache();
     }
     _canvasCache.AssureCanvas();
     if (_editorInterface == null)
     { // Setup editor interface
         _editorInterface                        = new AbilityEditorInterface();
         _editorInterface.canvasCache            = _canvasCache;
         _editorInterface.ShowNotificationAction = ShowNotification;
     }
 }
Пример #10
0
 private void AssureSetup()
 {
     if (canvasCache == null)
     {             // Create cache and load startup-canvas
         canvasCache = new NodeEditorUserCache();
         canvasCache.SetCanvas(NodeEditorSaveManager.CreateWorkingCopy(canvas));
     }
     canvasCache.AssureCanvas();
     if (editorInterface == null)
     {             // Setup editor interface
         editorInterface             = NodeEditorInterface.GetInstance();
         editorInterface.canvasCache = canvasCache;
     }
 }
        private void AssureSetup()
        {
            if (canvasCache == null)
            {
                // Create cache
                canvasCache = new NodeEditorUserCache();
            }

            canvasCache.AssureCanvas();
            if (editorInterface == null)
            {
                // Setup editor interface
                editorInterface                        = new NodeEditorInterface();
                editorInterface.canvasCache            = canvasCache;
                editorInterface.ShowNotificationAction = ShowNotification;
            }
        }
Пример #12
0
        private void OnEnable()
        {
            Debug.Log("NodeEditorTWWindow enabled");
            _editor = this;
            NodeEditor.checkInit(false);

            NodeEditorCallbacks.OnLoadCanvas += OnLoadCanvas;

            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;
            string assetPath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this));

            if (assetPath.Length > 1)
            {
                Debug.LogError("asset path " + assetPath);
                string path = Path.GetDirectoryName(assetPath);
                // Setup Cache
                canvasCache = new NodeEditorUserCache(path);
            }
            else
            {
                Debug.LogError("UNKNOWN asset path " + assetPath);
                canvasCache = new NodeEditorUserCache(); //path);
            }
            canvasCache.SetupCacheEvents();

            m_NodeSelectionWindow = MultiColumnWindow.GetWindow(this);

            m_InspectorWindow          = NodeInspectorWindow.Init(this);
            NodeEditor.ClientRepaints += m_InspectorWindow.Repaint;
            StartTextureWangPopup.Init(this);

            m_InspectorWindow.m_Source = this;
        }
Пример #13
0
        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);
        }
Пример #14
0
 private void AssureSetup()
 {
     if (canvasCache == null)
     {             // Create cache and load startup-canvas
         canvasCache = new NodeEditorUserCache();
         if (canvas != null)
         {
             canvasCache.SetCanvas(NodeEditorSaveManager.CreateWorkingCopy(canvas));
         }
         else if (!string.IsNullOrEmpty(loadSceneName))
         {
             canvasCache.LoadSceneNodeCanvas(loadSceneName);
         }
     }
     canvasCache.AssureCanvas();
     if (editorInterface == null)
     {             // Setup editor interface
         editorInterface             = new NodeEditorInterface();
         editorInterface.canvasCache = canvasCache;
     }
 }