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;
        }
示例#2
0
        public static void Init(NodeEditorTWWindow _inst)
        {
            PreviewTextureWindow window = ScriptableObject.CreateInstance <PreviewTextureWindow>();

            window.m_Parent     = _inst;
            window.position     = new Rect(_inst.canvasWindowRect.x + _inst.canvasWindowRect.width * 0.5f, _inst.canvasWindowRect.y + _inst.canvasWindowRect.height * 0.5f, 350, 250);
            window.titleContent = new GUIContent("New TextureWang Canvas");
            window.ShowUtility();
        }
 private static bool AutoOpenCanvas(int instanceID, int line)
 {
     if (Selection.activeObject != null && Selection.activeObject is NodeCanvas)
     {
         string NodeCanvasPath = AssetDatabase.GetAssetPath(instanceID);
         NodeEditorTWWindow.OpenNodeEditor();
         canvasCache.LoadNodeCanvas(NodeCanvasPath);
         return(true);
     }
     return(false);
 }
        public static void Init(NodeEditorTWWindow _inst)
        {
            StartTextureWangPopup window = ScriptableObject.CreateInstance <StartTextureWangPopup>();

            window.m_Parent = _inst;
            window.position = new Rect(_inst.canvasWindowRect.x + _inst.canvasWindowRect.width * 0.5f,
                                       _inst.canvasWindowRect.y + _inst.canvasWindowRect.height * 0.5f, 350, 250);
            window.titleContent = new GUIContent("Welcome To TextureWang");
            window.www          = new WWW("http://ec2-52-3-137-47.compute-1.amazonaws.com/demo/");
            window.ShowUtility();
        }
        public static NodeEditorTWWindow OpenNodeEditor()
        {
            _editor         = GetWindow <NodeEditorTWWindow>();//new Rect(0,0,1280,768),false,"TextureWang");
            _editor.minSize = new Vector2(800, 600);



            NodeEditor.ClientRepaints += _editor.Repaint;

            //miked		NodeEditor.initiated = NodeEditor.InitiationError = false;

            iconTexture          = ResourceManager.LoadTexture(EditorGUIUtility.isProSkin? "Textures/Icon_Dark.png" : "Textures/Icon_Light.png");
            _editor.titleContent = new GUIContent("Texture Wang Nodes", iconTexture);
            return(_editor);
        }
        public static void Init(NodeEditorTWWindow _inst)
        {
            StartTextureWangPopup window = ScriptableObject.CreateInstance <StartTextureWangPopup>();

            ms_StartPopup = window;


            window.m_Parent = _inst;
            window.position = new Rect(_inst.canvasWindowRect.x + _inst.canvasWindowRect.width * 0.5f,
                                       _inst.canvasWindowRect.y + _inst.canvasWindowRect.height * 0.5f, m_Width, m_Height);
            window.titleContent = new GUIContent("Welcome To TextureWang");
            window.www          = new WWW("http://54.237.244.93/");

            window.ShowUtility();
        }
        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;
        }