// Open the patcher window with a given patch.
        public static void OpenPatch(Wiring.Patch patch)
        {
            var window = EditorWindow.GetWindow <PatcherWindow>("Patcher");

            window.Initialize(patch);
            window.Show();
        }
Esempio n. 2
0
        // Factory method
        static public Graph Create(Wiring.Patch patch)
        {
            var graph = CreateInstance <Graph>();

            graph.Initialize(patch);
            return(graph);
        }
Esempio n. 3
0
        // Constructor
        public Patch(Wiring.Patch instance)
        {
            _instance            = instance;
            _nodeList            = new List <Node>();
            _instanceIDToNodeMap = new Dictionary <int, Node>();

            Rescan();
        }
Esempio n. 4
0
        // Open the patcher window with a given patch.
        public static void OpenPatch(Wiring.Patch patchInstance)
        {
            var window = EditorWindow.GetWindow <PatcherWindow>("Patcher");

            window._patch = new Patch(patchInstance);
            window._patchManager.Select(window._patch);

            window.Show();
        }
Esempio n. 5
0
        // Open the patcher window with a given patch.
        public static PatcherWindow OpenPatch(Wiring.Patch patch)
        {
            var window = EditorWindow.GetWindow <PatcherWindow>("EDD");

            window.Initialize(patch);
            window.wantsMouseMove = true;
            window.Show();
            //EditorWindow.FocusWindowIfItsOpen ();
            return(window);
        }
Esempio n. 6
0
        public static void OpenPatch(Wiring.Patch patchInstance)
        {
            var window    = EditorWindow.GetWindow <PatcherMainWindow>("Patcher", typeof(SceneView));
            var uI        = typeof(Editor).Assembly.GetType("UnityEditor.InspectorWindow");
            var inspector = EditorWindow.GetWindow <PatcherInspectorWindow>("Patcher Inspector", uI);

            window._patch = new Patch(patchInstance);
            window._patchManager.Select(window._patch);

            inspector._patch        = window._patch;
            inspector._patchManager = window._patchManager;

            window.Show();
            inspector.Show();
            window.ResetPosition();
            window.ResetSelection();
        }
Esempio n. 7
0
        // Synchronize with the source patch immediately.
        void ForceSyncNow()
        {
            // Operations on this graph are not reflected to the patch from now.
            _isEditing = false;

            // Reset the state.
            Clear(true);
            _patch = null;

            // Retrieve the patch object based on the instance ID.
            foreach (var obj in GameObject.FindObjectsOfType <Wiring.Patch>())
            {
                if (obj.GetInstanceID() == _patchInstanceID)
                {
                    _patch = obj;
                    break;
                }
            }

            // Scan the patch if available.
            if (_patch != null)
            {
                // Enumerate all the node instances.
                foreach (var i in _patch.GetComponentsInChildren <Wiring.NodeBase>())
                {
                    AddNode(Node.Create(i, NodeRendererMap.GetRenderer(i.GetType())));
                }

                // Enumerate all the edges.
                foreach (Node node in nodes)
                {
                    node.PopulateEdges();
                }
            }

            // Operations will be reflected to the patch again.
            _isEditing = true;
        }
Esempio n. 8
0
 // Check if this is a representation of the given patch instance.
 public bool IsRepresentationOf(Wiring.Patch instance)
 {
     return(_instance == instance);
 }
Esempio n. 9
0
 // Initializer (called from the Create method)
 void Initialize(Wiring.Patch patch)
 {
     hideFlags        = HideFlags.HideAndDontSave;
     _patchInstanceID = patch != null?patch.GetInstanceID() : 0;
 }
Esempio n. 10
0
 // Initializer (called from OpenPatch)
 void Initialize(Wiring.Patch patch)
 {
     hideFlags = HideFlags.HideAndDontSave;
     _graph    = Graph.Create(patch);
     _graphGUI = _graph.GetEditor();
 }
Esempio n. 11
0
        // Synchronize with the source patch immediately.
        void ForceSyncNow()
        {
            // Operations on this graph are not reflected to the patch from now.
            _isEditing = false;

            // Reset the state.
            Clear(true);
            _patch = null;

            // Retrieve the patch object based on the instance ID.
            foreach (var obj in GameObject.FindObjectsOfType<Wiring.Patch>())
            {
                if (obj.GetInstanceID() == _patchInstanceID)
                {
                    _patch = obj;
                    break;
                }
            }

            // Scan the patch if available.
            if (_patch != null)
            {
                // Enumerate all the node instances.
                foreach (var i in _patch.GetComponentsInChildren<Wiring.NodeBase>())
                    AddNode(Node.Create(i));

                // Enumerate all the edges.
                foreach (Node node in nodes)
                    node.PopulateEdges();
            }

            // Operations will be reflected to the patch again.
            _isEditing = true;
        }
Esempio n. 12
0
 public void SelectPatch(Wiring.Patch patchInstance)
 {
     _patch = new Patch(patchInstance);
     _patchManager.Select(_patch);
 }