private bool OnDynamicInputAdd(string id) { dynamicInputPin.Pin(id).WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? typeof(object); var pinEvent = (PinConnectionChangeEvent)evt; // subgraph input var pin = SubGraph.InputModule.Outputs.Where(x => x.Id == pinEvent.Source.Id).OfType <IDataTypeChangeable>().FirstOrDefault(); pin.ChangeType(PinDataTypeFactory.FromType(genericType)); }); }); try { addingSubGraphPin = true; return(SubGraph.InputModule.AddModulePin(id, true, PinDataTypeFactory.CreateAny()) != null); } finally { addingSubGraphPin = false; } }
private bool OnDynamicInputAdd(string id) { return(dynamicInputPin.Pin(id).WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault(); if (genericType != null) { genericDelegate = new GenericDelegate <Func <object, object> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(genericType)); } else { genericDelegate = null; } var pinsToChange = dynamicInputPin.Pins.Where(x => x.Id != id && x.DataType.UnderlyingType != pinDataType.UnderlyingType).OfType <IDataTypeChangeable>(); foreach (var pin in pinsToChange) { pin.ChangeType(pinDataType); } if (!pinsToChange.Any()) { outputPin.ChangeType(pinDataType); } }); }) != null); }
private bool OnDynamicInputAdd(string id) { return(dynamicInputPin.Pin(id).WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.CreateAny(), false, pinDataType => { var dataType = pinDataType.UnderlyingType; this.outputType = dataType; var count = this.dynamicInputPin.Count; var outputType = Array.CreateInstance(dataType, count).GetType(); this.output.ChangeType(PinDataTypeFactory.FromType(outputType)); if (dataType != null) { genericDelegate = new GenericDelegate <Func <object, object> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(dataType)); } else { genericDelegate = null; } }); }) != null); }
private bool OnDynamicInputAdd(string id) { arguments.Pin(id).WhenNodeEvent.Subscribe(evt => PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.CreateAny(), false)); return(true); }