// Handler for the Adding/Removing of pins from the collections void _PinAddedRemoved(object sender, DaggerBasePin pin) { if (_uiNode != null) { _uiNode.CalculateLayout(); } }
/// <summary> /// Returns true if this output pin can connect to a given input pin based on relationship in the Graph /// </summary> /// <param name="pin">input pin to test</param> /// <returns>true if pins can connect</returns> public override bool CanConnectToPin(DaggerBasePin pin) { if (pin is DaggerOutputPin) { return(false); } if (!pin.ParentNode._descendents.Contains(ParentNode)) { return(this.IsCompatibleDataTypes((DaggerInputPin)pin, this)); } else if (pin.ParentNode.Ordinal >= ParentNode.Ordinal) { return(this.IsCompatibleDataTypes((DaggerInputPin)pin, this)); } return(false); }
/// <summary> /// Modify a pin's context menu before showing it /// </summary> /// <param name="pin"></param> void DSFilterNodeUI_BeforePinContextShown(DaggerLib.Core.DaggerBasePin pin) { (pin.PinUIElements as PinUI).ContextMenuStrip = new ContextMenuStrip(); // if it is an output pin and is not connected, offer the Render Pin menu item if (pin is DSOutputPin && !pin.IsConnected) { ToolStripMenuItem tmi = new ToolStripMenuItem("Render Pin"); tmi.Tag = pin; tmi.Click += new EventHandler(renderPinMenuItem_Click); (pin.PinUIElements as PinUI).ContextMenuStrip.Items.Add(tmi); } ToolStripMenuItem ppmi = new ToolStripMenuItem("Pin Properties"); ppmi.Tag = pin; ppmi.Click += new EventHandler(tmi_Click); (pin.PinUIElements as PinUI).ContextMenuStrip.Items.Add(ppmi); }
public DaggerNodeNonSerializationAssistant(DaggerNode node) { NodeType = node.GetType(); NodeInstanceGuid = node.InstanceGuid; InputPins = new List <DaggerInputPin>(); foreach (DaggerInputPin pin in node.InputPins) { InputPins.Add(pin); } OutputPins = new List <DaggerOutputPin>(); foreach (DaggerOutputPin pin in node.OutputPins) { OutputPins.Add(pin); } FieldInfo[] fi = NodeType.GetFields(); for (int i = 0; i < fi.Length; i++) { if (fi[i].FieldType.IsSubclassOf(typeof(DaggerBasePin))) { DaggerBasePin val = (DaggerBasePin)fi[i].GetValue(node); if (val != null) { //if this pin is stored in the collection, serialize it's reflected FieldInfo if (node.InputPins[val.InstanceGuid] != null || node.OutputPins[val.InstanceGuid] != null) { val._reflectedTargets.Add(fi[i]); } } } } }
public override bool CanConnectToPin(DaggerBasePin pin) { if (pin is DaggerInputPin) { return(false); } if (ParentNode == null) { // this is an exported pin, so it can connect to any DaggerOutputPin in the graph return(this.IsCompatibleDataTypes(this, (DaggerOutputPin)pin)); } if (!ParentNode._descendents.Contains(pin.ParentNode)) { return(this.IsCompatibleDataTypes(this, (DaggerOutputPin)pin)); } else if (pin.ParentNode.Ordinal <= ParentNode.Ordinal) { return(this.IsCompatibleDataTypes(this, (DaggerOutputPin)pin)); } return(false); }
public abstract bool CanConnectToPin(DaggerBasePin pin);