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;
        }
Ejemplo n.º 2
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;
        }