/// <summary> /// A recursive function to clear all calculations depending on this node. /// Usually does not need to be called manually /// </summary> public void ClearCalculation() { calculated = false; if (BeginRecursiveSearchLoop()) { return; } foreach (ConnectionPort outputPort in outputPorts) { ValueConnectionKnob outputValueKnob = outputPort as ValueConnectionKnob; if (outputValueKnob != null) { outputValueKnob.ResetValue(); } foreach (ConnectionPort connectionPort in outputPort.connections) { ValueConnectionKnob connectionValueKnob = connectionPort as ValueConnectionKnob; if (connectionValueKnob != null) { connectionValueKnob.ResetValue(); } connectionPort.body.ClearCalculation(); } } EndRecursiveSearchLoop(); }
public override ConnectionPort CreateNew(Node body) { ValueConnectionKnob knob = ScriptableObject.CreateInstance <ValueConnectionKnob> (); knob.Init(body, Name, Direction, StyleID, NodeSide, NodeSidePos); knob.maxConnectionCount = MaxConnectionCount; return(knob); }
public override bool CanApplyConnection(ConnectionPort port) { ValueConnectionKnob valueKnob = port as ValueConnectionKnob; if (valueKnob == null || !valueType.IsAssignableFrom(valueKnob.valueType)) { return(false); } return(base.CanApplyConnection(port)); }
public override void UpdateProperties(ConnectionPort port) { ValueConnectionKnob knob = (ValueConnectionKnob)port; knob.name = Name; knob.direction = Direction; knob.styleID = StyleID; knob.maxConnectionCount = MaxConnectionCount; knob.side = NodeSide; knob.sideOffset = 0; }
public override bool IsCompatibleWith(ConnectionPort port) { if (!(Direction == Direction.None && port.direction == Direction.None) && !(Direction == Direction.In && port.direction == Direction.Out) && !(Direction == Direction.Out && port.direction == Direction.In)) { return(false); } ValueConnectionKnob valueKnob = port as ValueConnectionKnob; if (valueKnob == null) { return(false); } Type knobType = ConnectionPortStyles.GetValueType(StyleID); return(knobType.IsAssignableFrom(valueKnob.valueType)); }