public PortView AddPort(Orientation orientation, Direction direction, PortData portData) { PortView p = new PortView(orientation, direction, portData); if (string.IsNullOrEmpty(portData.portID)) //Make sure port has unique id. { portData.portID = "$" + UnityEngine.Random.Range(0, short.MaxValue).ToString(); } portData.owner = this; portData.port = p; if (p.direction == Direction.Input) { inputPorts.Add(p); if (orientation == Orientation.Vertical) { flowInputContainer.Add(p); } else { if (UIElementUtility.Theme.preferredDisplayValue == DisplayValueKind.Inside) { p.EnableInClassList("port-control", true); p.Add(new ControlView(portData.InstantiateControl(true), true)); } else { var portInputView = new PortInputView(portData); portInputContainer.Add(portInputView); } inputContainer.Add(p); } } else { outputPorts.Add(p); if (orientation == Orientation.Vertical) { flowOutputContainer.Add(p); } else { outputContainer.Add(p); } } p.Initialize(this, portData); return(p); }
public PortView AddPort(PortData portData) { PortView p = new PortView(Orientation.Horizontal, Direction.Input, portData); if (string.IsNullOrEmpty(portData.portID)) //Make sure port has unique id. { portData.portID = UnityEngine.Random.Range(0, short.MaxValue).ToString(); } portData.owner = owner.nodeView; portData.port = p; inputContainer.Add(p); portViews.Add(p); p.EnableInClassList("control", true); p.Initialize(owner.nodeView, portData); return(p); }