void nodeDelete(List <NodeLayout> list) { foreach (var l in list) { foreach (var pin in l.Node.PinCollection.Get()) { WireController.Disconnect(pin); } _loadedGraph.ZoomOffset = _zoomArea.ZoomOffset; string path = AssetDatabase.GetAssetPath(l.Node.Root); _loadedGraph.Nodes.Remove(l.Node); AssetDatabase.ImportAsset(path); LoadGraph(_loadedGraph); } }
void InitControls() { _nodeSelection = new NodeSelection(); _nodeSelection.VisualEditor = this; _zoomArea = new ZoomableArea(1, 12, DrawZoomAreaContent); if (_loadedGraph != null) { _zoomArea.PanTo(_loadedGraph.ZoomOffset); } // Create the wire controller if (_loadedGraph != null) { _wireController = new WireController(_loadedGraph, this); } _nodeMenu = new GenericMenu(); }
/// <summary> /// Bridge method to prevent initialization order issue. /// </summary> /// <param name="pin">Pin.</param> void onPinClicked(Pin pin) { Event e = Event.current; if (e.button == (int)MouseButton.Right) { WireController.Disconnect(pin); } else if (e.button == (int)MouseButton.Left) { if (_wireController.IsPinSelected) { _wireController.Connect(pin); } else { _wireController.Select(pin); } } }