void OnConnectionAdded(object sender, AcceptNodeConnectionEventArgs e) { bool isHidden = (Control.ModifierKeys & Keys.Shift) != 0; MyNode fromNode = (e.Connection.From.Node as MyNodeView).Node; MyNode toNode = (e.Connection.To.Node as MyNodeView).Node; int fromIndex = (int)e.Connection.From.Item.Tag; int toIndex = (int)e.Connection.To.Item.Tag; if (toNode.AcceptsConnection(fromNode, fromIndex, toIndex)) { MyConnection newConnection = new MyConnection(fromNode, toNode, fromIndex, toIndex); newConnection.Connect(); newConnection.IsHidden = isHidden; e.Connection.Tag = newConnection; (e.Connection as MyNodeViewConnection).Hidden = isHidden; m_mainForm.RefreshConnections(this); m_mainForm.ProjectStateChanged("Connection added"); } else { // Make the graph library drop the connection. e.Cancel = true; } }
void OnConnectionAdded(object sender, AcceptNodeConnectionEventArgs e) { MyNode fromNode = (e.Connection.From.Node as MyNodeView).Node; MyNode toNode = (e.Connection.To.Node as MyNodeView).Node; int fromIndex = (int)e.Connection.From.Item.Tag; int toIndex = (int)e.Connection.To.Item.Tag; MyConnection newConnection = new MyConnection(fromNode, toNode, fromIndex, toIndex); newConnection.Connect(); e.Connection.Tag = newConnection; }
private void OnConnectionAdded(object sender, AcceptNodeConnectionEventArgs e) { NodeConnection graphConnection = e.Connection; Project.Node nodeFrom = (graphConnection.From.Node as NodeView)?.Node; Project.Node nodeTo = (graphConnection.To.Node as NodeView)?.Node; var indexFrom = (int)graphConnection.From.Item.Tag; var indexTo = (int)graphConnection.To.Item.Tag; if (nodeTo.InputPorts[indexTo] != null) { e.Cancel = true; return; } var connection = new Connection(nodeFrom, indexFrom, nodeTo, indexTo); connection.Connect(); graphConnection.Tag = connection; }
private void Desktop_ConnectionAdding(object sender, AcceptNodeConnectionEventArgs e) { e.Cancel = CanChangeGraph(); }
void OnConnectionAdded(object sender, AcceptNodeConnectionEventArgs e) { //e.Cancel = true; e.Connection.Name = "Connection " + counter++; e.Connection.DoubleClick += new EventHandler <NodeConnectionEventArgs>(OnConnectionDoubleClick); }
void OnConnectionAdding(object sender, AcceptNodeConnectionEventArgs e) { //e.Cancel = true; }
void OnConnectionRemoved(object sender, AcceptNodeConnectionEventArgs e) { //e.Cancel = true; }
void OnConnectionRemoved(object sender, AcceptNodeConnectionEventArgs e) { ShaderFragmentNodeUtil.InvalidateShaderStructure(graphControl); }
void OnConnectionAdded(object sender, AcceptNodeConnectionEventArgs e) { e.Connection.Name = "Connection " + counter++; ShaderFragmentNodeUtil.InvalidateShaderStructure(graphControl); }
void OnConnectionAdding(object sender, AcceptNodeConnectionEventArgs e) { }
private void OnConnectionRemoving(object sender, AcceptNodeConnectionEventArgs e) { }
private void GraphControl1_ConnectionAdded(object sender, AcceptNodeConnectionEventArgs e) { if (GeneratingGraph) { return; } var to = GetInputItem(e.Connection.From.Item, e.Connection.To.Item); var from = GetOutputItem(e.Connection.From.Item, e.Connection.To.Item); //Clear all other connections. This is to prevent multiple connections from attaching to the same pin. //Only the latest connection will provide data. List <NodeConnection> connections = new List <NodeConnection>(to.Connector.Connectors); foreach (var con in connections) { if (con == e.Connection) { continue; // Skip our connection, we want to keep it } graphControl1.Disconnect(con); } Console.WriteLine("Connected " + from.Node.Title + " to " + to.Node.Title + "'s " + to.Tag); if (!(to is ExecuteNodeItem) && to.Node is ActionNode) //If the to node is an action node, notify it that a pin was connected { var an = to.Node as ActionNode; an.PinConnected(from, (string)to.Tag); } //If we are connecting execute nodes, lets walk back if (from is ExecuteNodeItem) { var executeItem = from as ExecuteNodeItem; if (executeItem.ActionCollection != null) //We are directly connected to the root { OnExecuteNodeChanged(from as ExecuteNodeItem); } else //Walk back the connection chain to find the execute node with the action collection { executeItem = (executeItem.Node as AbilityGraphNode).InputExecute; while (executeItem != null && executeItem.ActionCollection == null) //Keep moving backwards until we either are null or we have a action collection { var connection = executeItem.Connector.Connectors.FirstOrDefault(); if (connection == null) { executeItem = null; break; } executeItem = connection.From.Item as ExecuteNodeItem; if (executeItem.ActionCollection == null) { executeItem = (executeItem.Node as AbilityGraphNode).InputExecute; } } if (executeItem != null && executeItem.ActionCollection != null) //We've walked back to an action node and we aren't null, so it's an Event node. { OnExecuteNodeChanged(executeItem); } } } ActiveDocument.DocumentEdited(this); }
private void Desktop_ConnectionAdding(object sender, AcceptNodeConnectionEventArgs e) { e.Cancel = TestIfInsideSimulation(); }