public void UpdatePorts() { if (string.IsNullOrEmpty(GetFunctionName())) { return; } var ctx = Context.GetContext(); var function = ctx.GetFunction(GetFunctionName()); var existingNames = new HashSet <string>(InstancePorts.Select(p => p.fieldName)); foreach (var input in function?.Inputs ?? Array.Empty <Element.PortInfo>()) { // TODO: Different types for different Element types var type = typeof(ElementNodeValue); if (existingNames.Remove(input.Name)) { GetPort(input.Name).ValueType = type; } else { AddInstanceInput(type, ConnectionType.Multiple, input.Name); } } if (function != null && function.Inputs == null) { for (int i = 0; i < GetVaradicCount(); i++) { AddInstanceInput(typeof(object), ConnectionType.Multiple, $"${i}"); } } foreach (var name in existingNames) { RemoveInstancePort(name); } }
private void GetBranchingNodePortList() { var portFiltered = InstancePorts.ToList(); branchPorts = portFiltered .Where(x => x.ValueType == typeof(ChoiceBranch)) .ToList(); }
private void BindExecutionsToButtons() { buttonPorts = InstancePorts .ToList() .Where(x => x.IsConnected && x.Connection.node.GetType().IsSubclassOf(typeof(AbstractExecutionNode))) .ToList(); for (int i = 0; i < buttonPorts.Count; i++) { ExecuteCommandsInPort(i); } }