public First(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <object>()); this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var method = EvaluateInternalAttribute.GetMethod(GetType()); var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault(); if (genericType != null) { genericDelegate = new GenericDelegate <Func <object, object, Task <object> > >(this, method.MakeGenericMethod(genericType)); } else { genericDelegate = null; genericType = typeof(object); } outputPin.ChangeType(PinDataTypeFactory.FromType(genericType)); }); }); }
public ZipFunc(IGraphRuntime runtime) : base(runtime) { this.funcPin = AddInputPin("Function", PinDataTypeFactory.Create <Delegate>(), PropertyMode.Allow); this.dynamicInputPin = new DynamicInputPin(runtime, inputs, "Input", PinDataTypeFactory.Create <ISequence>()); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); }
public Where(IGraphRuntime runtime) : base(runtime, false, PinDataTypeFactory.Create <bool>(), SUBGRAPH_SOURCE_PIN_ID) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); this.subGraphSource = ((GenericOutputPin)this.subGraphInputModule.Outputs[SUBGRAPH_SOURCE_PIN_ID]); this.subGraphResult = this.SubGraph.OutputModule.DefaultInputPin; this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? typeof(object); subGraphSource.ChangeType(PinDataTypeFactory.FromType(genericType)); var outputType = PinDataTypeFactory.FromType(typeof(ISequence <>).MakeGenericType(genericType)); if (outputPin.DataType.UnderlyingType != outputType.UnderlyingType) { outputPin.ChangeType(outputType); } genericDelegate = new GenericDelegate <Func <object, object, object> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(genericType)); }); }); }
private static IPinDataType CreateTargetPinDataType(ConvertTypeCode typeCode) { switch (typeCode) { case ConvertTypeCode.Any: return(PinDataTypeFactory.CreateAny());; case ConvertTypeCode.Boolean: return(PinDataTypeFactory.CreateBoolean()); case ConvertTypeCode.Byte: return(PinDataTypeFactory.FromType(typeof(byte))); case ConvertTypeCode.Int16: return(PinDataTypeFactory.FromType(typeof(short))); case ConvertTypeCode.Int32: return(PinDataTypeFactory.CreateInt32()); case ConvertTypeCode.Int64: return(PinDataTypeFactory.FromType(typeof(long))); case ConvertTypeCode.Float32: return(PinDataTypeFactory.FromType(typeof(float))); case ConvertTypeCode.Float64: return(PinDataTypeFactory.FromType(typeof(double))); case ConvertTypeCode.String: return(PinDataTypeFactory.CreateString()); } return(PinDataTypeFactory.Create <object>()); }
public PythonScriptModuleBase(IGraphRuntime runtime, ILoggerFactory loggerFactory, IPythonMainThread mainThread) : base(runtime, ModuleKind.ScriptModule) { logger = loggerFactory.CreateLogger <PythonScriptModuleBase>(); this.mainThread = mainThread; this.captionPin = this.AddInputPin("caption", PinDataTypeFactory.Create <string>(), PropertyMode.Always); this.functionNamePin = this.AddInputPin("functionName", PinDataTypeFactory.Create <string>(DEFAULT_FUNCTION_NAME), PropertyMode.Default); this.useMainThreadPin = this.AddInputPin("useMainThread", PinDataTypeFactory.Create <bool>(true), PropertyMode.Always); this.parserErrorPin = this.AddInputPin("parserError", PinDataTypeFactory.Create <Models.ExceptionModel>(null, WellKnownEditors.ExceptionViewer), PropertyMode.Always); var scriptSourcePinId = this.AddScriptSourcePin(); this.argumentPins = new List <GenericInputPin>(); this.resultPins = new List <GenericOutputPin>(); this.properties[scriptSourcePinId].WhenNodeEvent.OfType <PropertyChangedEvent>().Subscribe(evt => { logger.LogInformation("Script source changed"); UpdateSignatureSafe(); }); this.properties[functionNamePin.Id].WhenNodeEvent.OfType <PropertyChangedEvent>().Subscribe(evt => { logger.LogInformation("Function name changed"); UpdateSignatureSafe(); }); this.DynamicDisplayName = new DynamicDisplayNameFunc(FormatDisplayName); }
public SelectFunc(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.Create <ISequence>(), PropertyMode.Never); this.funcPin = AddInputPin("Function", PinDataTypeFactory.Create <Delegate>(), PropertyMode.Allow); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); }
public Repeat(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.countPin = AddInputPin("Count", PinDataTypeFactory.Create <int?>(null, WellKnownEditors.IntNumber), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.FromType(typeof(ISequence <object>))); 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, object> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(genericType)); outputPin.ChangeType(pinDataType); } else { genericDelegate = null; outputPin.ChangeType(PinDataTypeFactory.FromType(typeof(ISequence <object>))); } }); }); }
public IFrameModuleBase(IGraphRuntime runtime) : base(runtime, ModuleKind.Iframe, DisplayMode.Expanded) { this.AddInputPin("Caption", PinDataTypeFactory.Create <string>(), PropertyMode.Always); this.AddInputPin("SourceUri", PinDataTypeFactory.Create <string>(), PropertyMode.Always); this.AddInputPin("Size", PinDataTypeFactory.Create <Int2>(new Int2(320, 240)), PropertyMode.Always); }
public SelectMany(IGraphRuntime runtime) : base(runtime, false, PinDataTypeFactory.FromType(typeof(ISequence <>)), SUBGRAPH_SOURCE_PIN_ID) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.sequentialPin = AddInputPin("Sequential", PinDataTypeFactory.Create <bool>(true), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); this.maxConcurrencyPin = AddInputPin("MaxConcurrency", PinDataTypeFactory.Create <int>(8), PropertyMode.Default); this.subGraphSource = ((GenericOutputPin)this.subGraphInputModule.Outputs[SUBGRAPH_SOURCE_PIN_ID]); this.subGraphResult = this.SubGraph.OutputModule.DefaultInputPin; this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? typeof(object); subGraphSource.ChangeType(PinDataTypeFactory.FromType(genericType)); BuildGenericDelegate(); }); }); this.subGraphResult.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { outputPin.ChangeType(pinDataType); BuildGenericDelegate(); }); }); }
private static IPinDataType CreateTargetPinDataType(ConvertTypeCode typeCode) { switch (typeCode) { case ConvertTypeCode.Any: return(PinDataTypeFactory.Create <ISequence <object> >()); case ConvertTypeCode.Boolean: return(PinDataTypeFactory.Create <ISequence <bool> >()); case ConvertTypeCode.Byte: return(PinDataTypeFactory.Create <ISequence <byte> >()); case ConvertTypeCode.Int16: return(PinDataTypeFactory.Create <ISequence <short> >()); case ConvertTypeCode.Int32: return(PinDataTypeFactory.Create <ISequence <int> >()); case ConvertTypeCode.Int64: return(PinDataTypeFactory.Create <ISequence <long> >()); case ConvertTypeCode.Float32: return(PinDataTypeFactory.Create <ISequence <float> >()); case ConvertTypeCode.Float64: return(PinDataTypeFactory.Create <ISequence <double> >()); case ConvertTypeCode.String: return(PinDataTypeFactory.Create <ISequence <string> >()); } return(PinDataTypeFactory.Create <object>()); }
public Range(IGraphRuntime runtime) : base(runtime) { this.startPin = AddInputPin("Start", PinDataTypeFactory.CreateInt32(0), PropertyMode.Default); this.countPin = AddInputPin("Count", PinDataTypeFactory.CreateInt32(10), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <int> >()); }
public ShaGenerator(IGraphRuntime runtime, HashAlgorithmType type) : base(runtime) { this.type = type; this.inputPin = AddInputPin("Input", PinDataTypeFactory.Create <object>(), PropertyMode.Never); this.hashPin = AddOutputPin("Hash", PinDataTypeFactory.Create <byte[]>()); }
public SelectManyFunc(IGraphRuntime runtime) : base(runtime) { inputPin = AddInputPin("Input", PinDataTypeFactory.Create <ISequence>(), PropertyMode.Never); funcPin = AddInputPin("Function", PinDataTypeFactory.Create <Delegate>(), PropertyMode.Allow); sequentialPin = AddInputPin("Sequential", PinDataTypeFactory.Create <bool>(true), PropertyMode.Default); outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); }
public GaussianRandomSequence(IGraphRuntime runtime) : base(runtime) { this.seedPin = AddInputPin("Seed", PinDataTypeFactory.Create <int?>(null, WellKnownEditors.IntNumber), PropertyMode.Default); this.muPin = AddInputPin("µ", PinDataTypeFactory.Create <double>(0, WellKnownEditors.FloatNumber), PropertyMode.Default); this.sigmaPin = AddInputPin("σ", PinDataTypeFactory.Create <double>(1, WellKnownEditors.FloatNumber), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <double> >()); }
public WriteFile(IGraphRuntime runtime) : base(runtime) { pathPin = this.AddInputPin("fileName", PinDataTypeFactory.Create <string>(string.Empty, WellKnownEditors.FileSelector), PropertyMode.Default, flags: PinFlags.ResolvePath); modePin = this.AddInputPin("mode", PinDataTypeFactory.CreateEnum(WriteFileMode.OverwriteOrCreate, WellKnownEditors.DropDown), PropertyMode.Default); writablePin = this.AddInputPin("writable", PinDataTypeFactory.Create <IWritable>(), PropertyMode.Never); appendGuidPin = this.AddInputPin("appendGuid", PinDataTypeFactory.CreateBoolean(false), PropertyMode.Default); createDirectoryPin = this.AddInputPin("createDirectory", PinDataTypeFactory.CreateBoolean(false), PropertyMode.Default); EnableVirtualOutputPin(); }
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)); }
public Return(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Value", PinDataTypeFactory.CreateAny(), PropertyMode.Allow); this.outputPin = AddOutputPin("Sequence", PinDataTypeFactory.Create <ISequence <object> >()); this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.CreateAny(), false, pinDataType => { var method = EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(pinDataType.UnderlyingType); genericDelegate = new GenericDelegate <Func <object, object> >(this, method); outputPin.ChangeType(PinDataTypeFactory.FromType(typeof(ISequence <>).MakeGenericType(pinDataType.UnderlyingType))); }); }); }
public Any(IGraphRuntime runtime) : base(runtime, false, PinDataTypeFactory.Create <bool>(), SUBGRAPH_SOURCE_PIN_ID) { this.input = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.output = AddOutputPin("Output", PinDataTypeFactory.CreateBoolean()); this.subGraphInput = ((GenericOutputPin)this.subGraphInputModule.Outputs[SUBGRAPH_SOURCE_PIN_ID]); this.input.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? typeof(object); subGraphInput.ChangeType(PinDataTypeFactory.FromType(genericType)); BuildGenericDelegate(); }); }); }
public PropertyAccessorModule(IGraphRuntime runtime) : base(runtime) { this.itemPin = AddInputPin("Item", PinDataTypeFactory.Create <object>(), PropertyMode.Never); this.itemTypeNamePin = AddInputPin("ItemType", PinDataTypeFactory.Create <string>(OBJECT_TYPE_NAME), PropertyMode.Invisible); this.itemPropertyPins = new List <GenericOutputPin>(); this.itemPin.WhenNodeEvent.Subscribe(evt => { if (itemPin.Connections.Any()) { BuildOutputPins(itemPin.Connections.Single().Remote.DataType.UnderlyingType); } else { BuildOutputPins(OBJECT_TYPE); } }); }
protected override string AddScriptSourcePin() { pathPin = AddInputPin("path", PinDataTypeFactory.Create <string>(null, WellKnownEditors.SingleLineText), PropertyMode.Always, false, false, PinFlags.ResolvePath); return(pathPin.Id); }
public Catch(IGraphRuntime runtime) : base(runtime) { this.AddOutputPin("OnError", PinDataTypeFactory.CreateFlow(), 1); this.AddOutputPin("Exception", PinDataTypeFactory.Create <Exception>()); }
public Interval(IGraphRuntime runtime) : base(runtime) { this.periodPin = AddInputPin("Period", PinDataTypeFactory.CreateTimeSpan(), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <long> >()); }
public VideoCommentModule(IGraphRuntime runtime) : base(runtime) { this.AddInputPin("Autoplay", PinDataTypeFactory.Create <bool>(), PropertyMode.Always); }
public Empty(IGraphRuntime runtime) : base(runtime) { this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); }
public VectorInput(IGraphRuntime runtime) : base(runtime, null, PinDataTypeFactory.Create <string>(), PinDataTypeFactory.Create <V <double> >(), WellKnownEditors.MultiLineText) { }
public ReadableToString(IGraphRuntime runtime) : base(runtime) { this.readablePin = AddInputPin("Readable", PinDataTypeFactory.Create <IReadable>(), PropertyMode.Allow); this.stringPin = AddOutputPin("String", PinDataTypeFactory.Create <string>()); }
protected override string AddScriptSourcePin() { scriptPin = AddInputPin("Script", PinDataTypeFactory.Create <string>(DEFAULT_SCRIPT, WellKnownEditors.Python), PropertyMode.Always); return(scriptPin.Id); }
public Throw(IGraphRuntime runtime) : base(runtime) { this.messagePin = AddInputPin("Message", PinDataTypeFactory.Create <string>(string.Empty, WellKnownEditors.MultiLineText), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); }
public ImageDecoderBase(IGraphRuntime runtime) : base(runtime) { this.readablePin = this.AddInputPin("Readable", PinDataTypeFactory.Create <IReadable>(), PropertyMode.Never); this.imagePin = this.AddOutputPin("Image", PinDataTypeFactory.Create <IImageBuffer>()); }
public Func(IGraphRuntime runtime) : base(runtime, true) { funcPin = AddOutputPin("Function", PinDataTypeFactory.Create <Delegate>()); }