// 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(); }
// Factory method static public Graph Create(Wiring.Patch patch) { var graph = CreateInstance <Graph>(); graph.Initialize(patch); return(graph); }
// Constructor public Patch(Wiring.Patch instance) { _instance = instance; _nodeList = new List <Node>(); _instanceIDToNodeMap = new Dictionary <int, Node>(); Rescan(); }
// 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(); }
// 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); }
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(); }
// 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; }
// Check if this is a representation of the given patch instance. public bool IsRepresentationOf(Wiring.Patch instance) { return(_instance == instance); }
// Initializer (called from the Create method) void Initialize(Wiring.Patch patch) { hideFlags = HideFlags.HideAndDontSave; _patchInstanceID = patch != null?patch.GetInstanceID() : 0; }
// Initializer (called from OpenPatch) void Initialize(Wiring.Patch patch) { hideFlags = HideFlags.HideAndDontSave; _graph = Graph.Create(patch); _graphGUI = _graph.GetEditor(); }
// 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; }
public void SelectPatch(Wiring.Patch patchInstance) { _patch = new Patch(patchInstance); _patchManager.Select(_patch); }