Example #1
0
        public Broadcast(IGraphRuntime runtime)
            : base(runtime)
        {
            this.inputPin         = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never);
            this.dynamicOutputPin = new DynamicOutputPin(runtime, outputs, "Output", PinDataTypeFactory.FromType(typeof(ISequence <>)));

            this.inputPin.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;
                    }


                    foreach (var pin in dynamicOutputPin.Pins.OfType <IDataTypeChangeable>())
                    {
                        pin.ChangeType(pinDataType);
                    }
                });
            });
        }
Example #2
0
 public Fork(IGraphRuntime runtime)
     : base(runtime)
 {
     this.flowMode = FlowMode.WaitAny;
     this.AddInputPin("flowIn", PinDataTypeFactory.CreateFlow(), PropertyMode.Never);
     this.flowOutputs = new DynamicOutputPin(runtime, outputs, "Flow", PinDataTypeFactory.CreateFlow());
 }
Example #3
0
        public GetValuesFromArray(IGraphRuntime runtime)
            : base(runtime)
        {
            this.AddInputPin(COUNT_PIN_NAME, PinDataTypeFactory.FromType(typeof(int)), PropertyMode.Always);
            this.AddInputPin("array", PinDataTypeFactory.FromType(typeof(Array)), PropertyMode.Never);

            this.AddOutputPin("OutputRemainings", PinDataTypeFactory.FromType(typeof(Array)));
            this.dynamicOutputPin = new DynamicOutputPin(runtime, outputs, "Output", PinDataTypeFactory.Create <object>());

            this.properties[COUNT_PIN_NAME]
            .WhenNodeEvent
            .OfType <PropertyChangedEvent>()
            .Subscribe(x => UpdateOutputs((int)x.Value.Value));
        }