void FCfgSave_Changed(IDiffSpread<bool> spread) { if (spread[0]) { this.FShader.SaveByteCode(this.FCfgSavePath[0]); } }
protected void ScanForFaces(IDiffSpread<bool> spread) { if (firstFrame || FScan[0]) { var baseType = typeof (IAgent); var faces = from assembly in AppDomain.CurrentDomain.GetAssemblies() // where assembly.FullName.Contains("Game") // filters out only Assemblies, that have something to do with Game, some Assemblies might contain stuff that cannot be reflected properly let types = assembly.GetTypes() from type in types where type.IsInterface where typeof(IAgent).IsAssignableFrom(type) select type; var names = new string[faces.Count()]; AllAgentFaces = faces.ToArray(); int i = 0; foreach (var face in AllAgentFaces) { names[i] = face.ToString(); i++; } EnumManager.UpdateEnum("AllAgentFaces", baseType.ToString(), names); AgentSkills.Methods.Clear(); // Reset Method Cache } }
private void InputCountConfigOnChanged(IDiffSpread<int> sender) { if (_elementInputs.SliceCount > sender[0]) { for (var i = _elementInputs.SliceCount - 1; i >= sender[0]; i--) { if (((Grid)UIElementOut[0]).Children.Contains(_elementInputs[i].IOObject[0])) ((Grid)UIElementOut[0]).Children.Remove(_elementInputs[i].IOObject[0]); _elementInputs[i].Dispose(); _elementInputs.SliceCount = i; } } else if (_elementInputs.SliceCount < sender[0]) { var oldCount = _elementInputs.SliceCount; _elementInputs.SliceCount = sender[0]; for (var i = oldCount; i < sender[0]; i++) { _elementInputs[i] = IOFactory.CreateIOContainer<IDiffSpread<UIElement>>(new InputAttribute("Element " + (i + 1)) { IsSingle = true, Order = i + 11 }); } } }
public DX11CubeRendererNode(IPluginHost FHost, IIOFactory iofactory) { string ename = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.RenderTarget); InputAttribute tattr = new InputAttribute("Target Format"); tattr.IsSingle = true; tattr.EnumName = ename; tattr.DefaultEnumEntry = "R8G8B8A8_UNorm"; this.FInFormat = iofactory.CreateDiffSpread<EnumEntry>(tattr); this.depthmanager = new DepthBufferManager(FHost, iofactory); this.lookats.Add(new Vector3(1.0f, 0.0f, 0.0f)); this.lookats.Add(new Vector3(-1.0f, 0.0f, 0.0f)); this.lookats.Add(new Vector3(0.0f, 1.0f, 0.0f)); this.lookats.Add(new Vector3(0.0f, - 1.0f, 0.0f)); this.lookats.Add(new Vector3(0.0f, 0.0f, 1.0f)); this.lookats.Add(new Vector3(0.0f, 0.0f, -1.0f)); this.upvectors.Add(new Vector3(0.0f, 1.0f, 0.0f)); this.upvectors.Add(new Vector3(0.0f, 1.0f, 0.0f)); this.upvectors.Add(new Vector3(0.0f, 0.0f, -1.0f)); this.upvectors.Add(new Vector3(0.0f, 0.0f, 1.0f)); this.upvectors.Add(new Vector3(0.0f, 1.0f, 0.0f)); this.upvectors.Add(new Vector3(0.0f, 1.0f, 0.0f)); }
protected void ApplyFace(IDiffSpread<EnumEntry> spread) { if (firstFrame) // during patch loading it is not useful to re-apply a Face. Just stick to whatever is in the config pin. { firstFrame = false; return; } if (AllAgentFaces.Length == 0) ScanForFaces(FScan); Type face = AllAgentFaces[FFace[0].Index]; var fields = face.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); string config = ""; foreach (var field in fields) { Type type = field.PropertyType; if (type.IsSubclassOf(typeof(Bin))) type = type.GetGenericArguments()[0]; if (TypeIdentity.Instance.ContainsKey(type)) { config += TypeIdentity.Instance[type]; config += " " + field.Name; config += ", "; } } config = config.TrimEnd(new char[] { ' ', ',' }); FConfig[0] = config; }
protected void ConfigPin(IDiffSpread spread) { string typeAlias = "string"; if (!FAlias.IsAnyInvalid()) typeAlias = FAlias[0].Name; var newConfig = typeAlias + " Value"; if (newConfig != FConfig[0]) FConfig[0] = newConfig; // first frame or user mistake will not reconfigure }
public DX11Texture1dArrayRendererNode(IPluginHost FHost, IIOFactory iofactory) { string ename = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.UnorderedAccessView); InputAttribute tattr = new InputAttribute("Target Format"); tattr.EnumName = ename; tattr.DefaultEnumEntry = "R8G8B8A8_UNorm"; this.FInFormat = iofactory.CreateDiffSpread<EnumEntry>(tattr); }
public InputElementJoinNode(IPluginHost host,IIOFactory iofactory) { this.FHost = host; this.FIOFactory = iofactory; InputAttribute fmtAttr = new InputAttribute("Format"); fmtAttr.EnumName = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.VertexBuffer); fmtAttr.DefaultEnumEntry = "R32G32B32A32_Float"; FInFormat = this.FIOFactory.CreateDiffSpread<EnumEntry>(fmtAttr); }
protected override void HandleConfigChange(IDiffSpread<string> configSpread) { FCount = 0; List<string> invalidPins = FPins.Keys.ToList(); var formular = new MessageFormular(configSpread[0]); foreach (string field in formular.Fields) { bool create = false; if (FPins.ContainsKey(field) && FPins[field] != null) { invalidPins.Remove(field); if (FTypes.ContainsKey(field)) { if (FTypes[field] != formular.GetType(field)) { FPins[field].Dispose(); FPins[field] = null; create = true; } } else { // key is in FPins, but no type defined. should never happen create = true; } } else { FPins.Add(field, null); create = true; } if (create) { Type type = formular.GetType(field); IOAttribute attr = DefinePin(field, type, formular.GetCount(field)); // each implementation of DynamicPinsNode must create its own InputAttribute or OutputAttribute ( Type pinType = typeof(ISpread<>).MakeGenericType((typeof(ISpread<>)).MakeGenericType(type)); // the Pin is always a binsized one FPins[field] = FIOFactory.CreateIOContainer(pinType, attr); FTypes.Add(field, type); } FCount += 2; // total pincount. always add two to account for data pin and binsize pin } foreach (string name in invalidPins) { FPins[name].Dispose(); FPins.Remove(name); FTypes.Remove(name); } }
public DX11VolumeRendererNode(IPluginHost FHost,IIOFactory factory) { string ename = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.RenderTarget); InputAttribute tattr = new InputAttribute("Target Format"); tattr.EnumName = ename; tattr.DefaultEnumEntry = "R8G8B8A8_UNorm"; tattr.CheckIfChanged = true; this.FInFormat = factory.CreateDiffSpread<EnumEntry>(tattr); }
public DX11SamplerStatePresetNode(IPluginHost host, IIOFactory iofactory) { string[] enums = DX11SamplerStates.Instance.StateKeys; host.UpdateEnum(DX11SamplerStates.Instance.EnumName, enums[0], enums); InputAttribute attr = new InputAttribute("Mode"); attr.EnumName = DX11SamplerStates.Instance.EnumName; attr.DefaultEnumEntry = enums[0]; this.FInPreset = iofactory.CreateDiffSpread<EnumEntry>(attr); }
public DX11MRTRendererNode(IPluginHost FHost,IIOFactory iofactory) { string ename = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.RenderTarget); InputAttribute tattr = new InputAttribute("Target Format"); tattr.EnumName = ename; tattr.DefaultEnumEntry = "R8G8B8A8_UNorm"; this.FInFormat = iofactory.CreateDiffSpread<EnumEntry>(tattr); this.depthmanager = new DepthBufferManager(FHost,iofactory); }
private void editAgents(IDiffSpread<Agent> spread) { FAgents.Clear(); FAgents.AddRange(spread); if (IsPinValid(FInput)) { FInput[0].Agents.Clear(); FInput[0].Agents.AddRange(spread); } }
public DepthBufferManager(IPluginHost host, IIOFactory factory) { this.host = host; this.factory = factory; ConfigAttribute cattr = new ConfigAttribute("Depth Buffer Mode"); cattr.IsSingle = true; pinmode = this.factory.CreateDiffSpread<eDepthBufferMode>(cattr); pinmode.Changed += Pinmode_Changed; this.currentmode = eDepthBufferMode.None; }
public DX11RenderStatePresetNode(IPluginHost host, IIOFactory iofactory) { InputAttribute attr = new InputAttribute("Blend Mode"); attr.EnumName = DX11BlendStates.Instance.EnumName; this.FInBlendPreset = iofactory.CreateDiffSpread<EnumEntry>(attr); attr = new InputAttribute("Rasterizer Mode"); attr.EnumName = DX11RasterizerStates.Instance.EnumName; this.FInRasterPreset = iofactory.CreateDiffSpread<EnumEntry>(attr); attr = new InputAttribute("Depth Stencil Mode"); attr.EnumName = DX11DepthStencilStates.Instance.EnumName; this.FInDepthPreset = iofactory.CreateDiffSpread<EnumEntry>(attr); }
private void HandleTransitionPins(IDiffSpread <string> sender) { //FLogger.Log(LogType.Debug, "Update Pins"); // CREATE INIT if (stateList.Count == 0) { stateList.Add(new State() { ID = "Init", Name = "Init", Bounds = new Rectangle(new Point(0, 0), new Size(p.StateSize, p.StateSize)) }); } //delete pins which are not in the new list foreach (var name in FPins.Keys) { if (TransitionNames.IndexOf(name) == -1) { FPins[name].Dispose(); } } Dictionary <string, IIOContainer> newPins = new Dictionary <string, IIOContainer>(); foreach (var name in TransitionNames) { if (!string.IsNullOrEmpty(name)) //ignore empty slices { if (FPins.ContainsKey(name)) //pin already exists, copy to new dict { newPins.Add(name, FPins[name]); FPins.Remove(name); } else if (!newPins.ContainsKey(name)) //just checking in case of duplicate names { var attr = new InputAttribute(name); attr.IsBang = true; var type = typeof(IDiffSpread <bool>); var container = FIOFactory.CreateIOContainer(type, attr); newPins.Add(name, container); } } } //FPins now only holds disposed IIOContainers, since we copied the reusable ones to newPins FPins = newPins; }
void FHideUnusedProjectsIn_Changed(IDiffSpread <bool> spread) { FHideUnusedProjectsCheckBox.Checked = FHideUnusedProjectsIn[0]; if (!spread[0]) { FMappingRegistry.RegisterMapping <ISolution, SolutionViewProvider>(); } else { FMappingRegistry.RegisterMapping <ISolution, LoadedProjectsSolutionViewProvider>(); } FTreeViewer.Reload(); }
private void FTopicChanged(IDiffSpread <string> spread) { foreach (var address in WorkingSockets.ToArray()) { Subscribe(false, Sockets[address], Topic); } Topic.Clear(); Topic = FTopic.ToList(); foreach (var address in WorkingSockets.ToArray()) { Subscribe(true, Sockets[address], Topic); } }
protected void ConfigPin(IDiffSpread spread) { Type type = typeof (string); if (FAlias != null && FAlias.SliceCount > 0) type = TypeIdentity.Instance.FindType(FAlias[0].Name); string name = "Foo"; if (FKey != null && FKey.SliceCount > 0) name = FKey[0]; if (FValue!=null) FValue.Dispose(); IOAttribute attr = DefinePin(name, type); // each implementation of DynamicNode must create its own InputAttribute or OutputAttribute ( Type pinType = typeof(ISpread<>).MakeGenericType((typeof(ISpread<>)).MakeGenericType(type)); // the Pin is always a binsized one FValue = FIOFactory.CreateIOContainer(pinType, attr); }
private void _OnConfigPinChanged(IDiffSpread <TConfigType> spread) { if (Initialized) { OnConfigPinChanged(); return; } if (IsConfigDefault()) { return; } Initialize(); Initialized = true; OnConfigPinChanged(); }
Dictionary <string, IIOContainer> FPins = new Dictionary <string, IIOContainer>(); //dynamic pins #endregion variables #region constructor and init public void OnImportsSatisfied() { TransitionNames.Changed += HandleTransitionPins; //dynamic enum attributes with unique name FHost.GetNodePath(true, out EnumName); //get unique node path EnumName += "AutomataUI"; // add unique name to path attr = new InputAttribute("Default State"); //name of pin attr.EnumName = EnumName; attr.DefaultEnumEntry = "Init"; //default state attr.Visibility = PinVisibility.OnlyInspector; //make invisible DefaultState = FIOFactory.CreateDiffSpread <EnumEntry>(attr); }
protected void ConfigPin(IDiffSpread spread) { string typeAlias = "string"; if (!FAlias.IsAnyInvalid()) { typeAlias = FAlias[0].Name; } var newConfig = typeAlias + " Value"; if (newConfig != FConfig[0]) { FConfig[0] = newConfig; // first frame or user mistake will not reconfigure } }
public void CreateEnumPin(string pinName, IEnumerable<string> entries) { EnumName = "Enum_" + this.GetHashCode().ToString(); EnumManager.UpdateEnum(EnumName, entries.First(), entries.ToArray()); var attr = new InputAttribute(pinName); attr.Order = 2; attr.AutoValidate = true; attr.EnumName = EnumName; Type pinType = typeof(IDiffSpread<EnumEntry>); var pin = FIOFactory.CreateIOContainer(pinType, attr); FUseAsID = (IDiffSpread<EnumEntry>)(pin.RawIOObject); }
private void Change(IDiffSpread <string> spread) { FContext.SliceCount = 1; var id = "Default"; if (FContextID.SliceCount > 0 && FContextID[0].Trim() != "") { id = FContextID[0]; } var context = NetMQContextDictionary.GetContext(id); FContext[0] = context; FContext.Flush(); }
public DX11RenderStatePresetNode(IPluginHost host, IIOFactory iofactory) { InputAttribute attr = new InputAttribute("Blend Mode"); attr.EnumName = DX11BlendStates.Instance.EnumName; this.FInBlendPreset = iofactory.CreateDiffSpread <EnumEntry>(attr); attr = new InputAttribute("Rasterizer Mode"); attr.EnumName = DX11RasterizerStates.Instance.EnumName; this.FInRasterPreset = iofactory.CreateDiffSpread <EnumEntry>(attr); attr = new InputAttribute("Depth Stencil Mode"); attr.EnumName = DX11DepthStencilStates.Instance.EnumName; this.FInDepthPreset = iofactory.CreateDiffSpread <EnumEntry>(attr); }
public void CreateEnumPin() { EnumName = ParticleSystemRegistry.ATTRIBUTE_ENUM + "_" + this.GetHashCode(); var attr = new InputAttribute("Attribute Name"); attr.Order = 2; attr.AutoValidate = true; attr.EnumName = EnumName; Type pinType = typeof(IDiffSpread <EnumEntry>); var pin = FIOFactory.CreateIOContainer(pinType, attr); FAttributeName = (IDiffSpread <EnumEntry>)(pin.RawIOObject); }
public DX11RendererNode2(IPluginHost host, IIOFactory iofactory) { this.ctrl = new Control(); this.ctrl.Dock = DockStyle.Fill; this.ctrl.Resize += new EventHandler(ctrl_Resize); this.depthmanager = new DepthBufferManager(host, iofactory); ConfigAttribute bbAttr = new ConfigAttribute("Back Buffer Format"); bbAttr.IsSingle = true; bbAttr.EnumName = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.BackBufferCast); bbAttr.DefaultEnumEntry = DX11EnumFormatHelper.NullDeviceFormats.GetAllowedFormats(FormatSupport.BackBufferCast)[0]; this.FCfgBackBufferFormat = iofactory.CreateDiffSpread<EnumEntry>(bbAttr); this.FCfgBackBufferFormat[0] = new EnumEntry(DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.BackBufferCast), 0); this.FCfgBackBufferFormat.Changed += new SpreadChangedEventHander<EnumEntry>(FCfgBackBufferFormat_Changed); }
void FEyetrackerInfo_Changed(IDiffSpread <EyetrackerInfo> spread) { int c = spread.SliceCount; if (spread.SliceCount == 0) { if (FEyetrackerInfo != null) { FEyetrackerInfo = null; } } else { FEyetrackerInfo = spread[0]; } FConnectionChanged = true; }
protected void TestDiffSpread <T>(IDiffSpread <T> spread, T[] sampleData) { bool eventRaised = false; spread.Changed += delegate(IDiffSpread <T> s) { eventRaised = true; }; spread[0] = sampleData[0]; spread[0] = default(T); spread[0] = sampleData[1]; Assert.IsTrue(spread.Sync()); Assert.IsTrue(eventRaised, "Changed event was not raised"); }
void ParameterNamesConfig_Changed(IDiffSpread <string> spread) { //temp pin dictionary var prevPins = new Dictionary <string, ParamPin>(FParamPins); //create pin? foreach (var pinDefinitionString in spread) { if (string.IsNullOrWhiteSpace(pinDefinitionString)) { continue; } if (!prevPins.ContainsKey(pinDefinitionString)) { var paramPin = ParamPin.Parse(pinDefinitionString); var oa = new InputAttribute(paramPin.ParamName); //FLogger.Log(LogType.Debug, col.DataType.ToString()); paramPin.Pin = FHost.CreateValueInput(oa, typeof(float)); foreach (var signal in FInternalSignals) { UpdateExposedState(signal, paramPin, true); } FParamPins[pinDefinitionString] = paramPin; } else { prevPins.Remove(pinDefinitionString); } } //any pin which is left over can be removed foreach (var pin in prevPins) { FHost.DeletePin(pin.Value.Pin); FParamPins.Remove(pin.Key); foreach (var signal in FInternalSignals) { UpdateExposedState(signal, pin.Value, false); } } }
public void CreateEnumPin(string pinName, IEnumerable <string> entries) { EnumName = "Enum_" + this.GetHashCode().ToString(); EnumManager.UpdateEnum(EnumName, entries.First(), entries.ToArray()); var attr = new InputAttribute(pinName); attr.Order = 2; attr.AutoValidate = true; attr.EnumName = EnumName; Type pinType = typeof(IDiffSpread <EnumEntry>); var pin = FIOFactory.CreateIOContainer(pinType, attr); FUseAsID = (IDiffSpread <EnumEntry>)(pin.RawIOObject); }
void FEyetrackerIn_Changed(IDiffSpread <IEyetracker> spread) { if (spread[0] == null) { if (FEyetracker != null) { FEyetracker.Dispose(); FEyetracker = null; } FPointsOut.SliceCount = 0; } else { FEyetracker = spread[0]; FConnected = true; } }
protected virtual void OnConfigChange(IDiffSpread<string> configSpread) { var formular = new MessageFormular(MessageFormular.DYNAMIC, configSpread[0] ?? "string Value"); if (formular.FieldNames.Count() < 1) return; if (FValue != null) { FValue.Dispose(); } var name = formular.FieldNames.First(); TargetDynamicType = formular[name].Type; IOAttribute attr = DefinePin(formular[name]); // each implementation of DynamicNode must create its own InputAttribute or OutputAttribute Type pinType = typeof(ISpread<>).MakeGenericType((typeof(ISpread<>)).MakeGenericType(TargetDynamicType)); // the Pin is always a binsized one FValue = FIOFactory.CreateIOContainer(pinType, attr); }
public DiffSpreadList(IIOFactory ioFactory, IOAttribute attribute) : base(0) { //store fields FIOFactory = ioFactory; FAttribute = attribute; //create config pin var att = new ConfigAttribute(FAttribute.Name + " Count"); att.DefaultValue = 2; //increment instance Counter and store it as pin offset FOffsetCounter = FInstanceCounter++; FCountSpread = ioFactory.CreateIO <IDiffSpread <int> >(att); FCountSpread.Changed += UpdatePins; }
public GroupOutStream(IIOFactory factory, OutputAttribute attribute) { FFactory = factory; FOutputAttribute = attribute; //increment instance Counter and store it as pin offset FOffsetCounter = FInstanceCounter++; FCountSpread = factory.CreateIO <IDiffSpread <int> >( new ConfigAttribute(FOutputAttribute.Name + " Count") { DefaultValue = 2, MinValue = 2 } ); FCountSpread.Changed += HandleCountSpreadChanged; FCountSpread.Sync(); }
void FBuildConfigIn_Changed(IDiffSpread <BuildConfiguration> spread) { FBuildConfigComboBox.SelectedIndex = (int)spread[0]; var projects = from p in Solution.Projects where p is MsBuildProject select p as MsBuildProject; foreach (var project in projects) { project.BuildConfiguration = spread[0]; if (IsProjectInUse(project)) { project.CompileAsync(); } } }
protected void ChangeOrder(IDiffSpread <ColorComponentOrder> spread) { for (int i = 0; i < 3; i++) { var color = ComponentOrder[0].ToString()[i]; switch (color) { case 'R': Order[i] = 0; break; case 'G': Order[i] = 1; break; case 'B': Order[i] = 2; break; } } }
private void HandlePinCountChanged(IDiffSpread <int> sender) { var count = Math.Max(1, CountIn[0]); ResizePinGroups(count, InputContainers, (i) => new InputAttribute(string.Format("Input {0}", i)) { AutoValidate = false }); ResizePinGroups(count, DefaultContainers, (i) => new InputAttribute(string.Format("Default {0}", i)) { AutoValidate = false }); ResizePinGroups(count, OutputContainers, (i) => new OutputAttribute(string.Format("Output {0}", i))); FBuffers.Resize( count, i => new Spread <T>(1), DisposeSpread ); }
private void Pinmode_Changed(IDiffSpread <eRenderFormatMode> spread) { if (this.currentmode == eRenderFormatMode.Manual) { this.DisposeTexIn(); } this.currentmode = spread[0]; if (this.currentmode == eRenderFormatMode.Inherit) { this.CreateTextureIn(); } if (this.currentmode == eRenderFormatMode.InheritSize) { this.CreateTextureIn(); } }
public DX11RendererNode2(IPluginHost host, IIOFactory iofactory) { this.ctrl = new Control(); this.ctrl.Dock = DockStyle.Fill; this.ctrl.Resize += new EventHandler(ctrl_Resize); this.depthmanager = new DepthBufferManager(host, iofactory); ConfigAttribute bbAttr = new ConfigAttribute("Back Buffer Format"); bbAttr.IsSingle = true; bbAttr.EnumName = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.BackBufferCast); bbAttr.DefaultEnumEntry = DX11EnumFormatHelper.NullDeviceFormats.GetAllowedFormats(FormatSupport.BackBufferCast)[0]; this.FCfgBackBufferFormat = iofactory.CreateDiffSpread <EnumEntry>(bbAttr); this.FCfgBackBufferFormat[0] = new EnumEntry(DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.BackBufferCast), 0); this.FCfgBackBufferFormat.Changed += new SpreadChangedEventHander <EnumEntry>(FCfgBackBufferFormat_Changed); }
private void FileChanged(IDiffSpread <string> spread) { if (File != null) { Reader.Close(); File.Dispose(); } try { File = new FileStream(FFile[0], FileMode.Open); var io = new StreamReader(File); Reader = new JsonTextReader(io); MessageEnumerator = (JObject.ReadFrom(Reader) as JArray).Children().GetEnumerator(); } catch (Exception e) { FError[0] = e.Message; } }
public void OnImportsSatisfied() { FInputContainer = FFactory.CreateIOContainer <IInStream <IInStream <T> > >( new InputAttribute("Input") { IsPinGroup = true }); FOutputContainer = FFactory.CreateIOContainer <IOutStream <T> >( new OutputAttribute("Output")); FAllowEmptySpreadsConfig = FFactory.CreateDiffSpread <bool>( new InputAttribute("Allow Empty Spreads") { IsSingle = true, Visibility = PinVisibility.OnlyInspector }); FAllowEmptySpreadsConfig.Changed += (s) => FAllowEmptySpreads = s[0]; }
void AttributeNamesPin_Changed(IDiffSpread <string> spread) { if (spread.SliceCount == 0) { return; } AttributeNames = AttributeNamesPin[0].Split(',').ToList().Select(s => s.Trim()).Where(s => s.Length > 0).ToArray(); //add new pins foreach (var attributeName in AttributeNames) { if (!AttributeInfos.Any(info => info.AttributeName == attributeName)) { var outputInfo = new AttributeInfo() { AttributeName = attributeName, AttributeContainer = IOFactory.CreateIOContainer <ISpread <string> >(new OutputAttribute(attributeName + " Value")), AttributeExistsContainer = IOFactory.CreateIOContainer <ISpread <bool> >( new OutputAttribute(attributeName + " Available") { Visibility = PinVisibility.Hidden } ), }; AttributeInfos.Add(outputInfo); } } //remove obsolete pins foreach (var outputInfo in AttributeInfos.ToArray()) { if (!AttributeNames.Contains(outputInfo.AttributeName)) { AttributeInfos.Remove(outputInfo); outputInfo.AttributeContainer.Dispose(); outputInfo.AttributeExistsContainer.Dispose(); } } ConfigChanged = true; }
// on ChildElementNames changed void ChildElementNamesPin_Changed(IDiffSpread <string> spread) { if (spread.SliceCount == 0) { return; } ChildElementNames = ChildElementNamesPin[0].Split(',').ToList().Select(s => s.Trim()).Where(s => s.Length > 0).ToArray(); // add new pins foreach (var elementName in ChildElementNames) { if (!ChildElementInfos.Any(info => info.ChildElementName == elementName)) { var outputInfo = new ChildElementInfo() { ChildElementName = elementName, ChildElementPinName = elementName + " (Children)", ChildElementContainer = IOFactory.CreateIOContainer <ISpread <XElement> >(new OutputAttribute(elementName + " (Children)")), ChildElementExistsContainer = IOFactory.CreateIOContainer <ISpread <bool> >( new OutputAttribute(elementName + " Available") { Visibility = PinVisibility.OnlyInspector } ), }; ChildElementInfos.Add(outputInfo); } } // remove obsolete pins foreach (var outputInfo in ChildElementInfos.ToArray()) { if (!ChildElementNames.Contains(outputInfo.ChildElementName)) { ChildElementInfos.Remove(outputInfo); outputInfo.ChildElementContainer.Dispose(); outputInfo.ChildElementExistsContainer.Dispose(); } } ConfigChanged = true; }
private void HandleBufferChange(IDiffSpread <DX11Resource <IDX11RWStructureBuffer> > spread) { string[] entries = FConfig[0].Split(",".ToCharArray()); int length = entries.Length; if (entries[0] != "") { int cnt = 0; foreach (string entry in entries) { if (entry != "" && FInput.SliceCount != 0) { int slicenumber = Convert.ToInt32(entry.Split(":".ToCharArray())[0]); var outputSpread = FOutputs[cnt].IOObject; outputSpread[0] = FInput[slicenumber]; cnt++; } } } }
protected override void OnConfigChange(IDiffSpread <string> configSpread) { base.OnConfigChange(configSpread); var attr = new InputAttribute("AvoidNil"); attr.BinVisibility = PinVisibility.OnlyInspector; attr.Order = 6; attr.BinOrder = 7; attr.BinSize = 1; attr.CheckIfChanged = true; Type pinType = typeof(ISpread <>).MakeGenericType((typeof(ISpread <>)).MakeGenericType(TargetDynamicType)); // the Pin is always a binsized one if (FAvoidNil != null) { FAvoidNil.Dispose(); } FAvoidNil = FIOFactory.CreateIOContainer(pinType, attr); }
public DX11TextureSpreadRendererNode(IPluginHost FHost, IIOFactory iofactory) { string ename = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.RenderTarget); InputAttribute tattr = new InputAttribute("Target Format"); tattr.EnumName = ename; tattr.DefaultEnumEntry = "R8G8B8A8_UNorm"; ConfigAttribute dfAttr = new ConfigAttribute("Depth Buffer Format"); dfAttr.EnumName = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.DepthStencil); dfAttr.DefaultEnumEntry = "D32_Float"; dfAttr.IsSingle = true; this.depthformatpin = iofactory.CreateDiffSpread <EnumEntry>(dfAttr); this.depthformatpin[0] = new EnumEntry(dfAttr.EnumName, 1); this.FInFormat = iofactory.CreateDiffSpread <EnumEntry>(tattr); }
public PluginColladaLoader( IPluginHost host, [Config("Coordinate system of source", IsSingle = true)] IDiffSpread <CoordinateSystemType> csSourceTypeConfig, [Config("Source up axis", IsSingle = true)] IDiffSpread <Axis> upAxisSourceConfig, [Config("Source right axis", IsSingle = true)] IDiffSpread <Axis> rightAxisSourceConfig, [Config("Source distance unit in meter", IsSingle = true, DefaultValue = 0)] IDiffSpread <double> meterSourceConfig, [Config("Coordinate system of target", IsSingle = true)] IDiffSpread <CoordinateSystemType> csTargetTypeConfig, [Config("Target up axis", IsSingle = true)] IDiffSpread <Axis> upAxisTargetConfig, [Config("Target right axis", IsSingle = true)] IDiffSpread <Axis> rightAxisTargetConfig, [Config("Target distance unit in meter", IsSingle = true, DefaultValue = 0)] IDiffSpread <double> meterTargetConfig) { FInfo = new List <string>(); FCsSourceTypeConfig = csSourceTypeConfig; // COLLADA is right handed by default. FCsSourceTypeConfig[0] = CoordinateSystemType.RightHanded; FUpAxisSourceConfig = upAxisSourceConfig; FRightAxisSourceConfig = rightAxisSourceConfig; FMeterSourceConfig = meterSourceConfig; FCsTargetTypeConfig = csTargetTypeConfig; FUpAxisTargetConfig = upAxisTargetConfig; FRightAxisTargetConfig = rightAxisTargetConfig; FMeterTargetConfig = meterTargetConfig; FCsSourceTypeConfig.Changed += FCsSourceTypeConfig_Changed; FUpAxisSourceConfig.Changed += FUpAxisSourceConfig_Changed; FRightAxisSourceConfig.Changed += FRightAxisSourceConfig_Changed; FMeterSourceConfig.Changed += FMeterSourceConfig_Changed; FCsTargetTypeConfig.Changed += FCsTargetTypeConfig_Changed; FUpAxisTargetConfig.Changed += FUpAxisTargetConfig_Changed; FRightAxisTargetConfig.Changed += FRightAxisTargetConfig_Changed; FMeterTargetConfig.Changed += FMeterTargetConfig_Changed; }
public SpreadList(IIOFactory factory, IOAttribute attribute) : base(new SpreadListStream()) { //store fields FFactory = factory; FAttribute = attribute; //increment instance Counter and store it as pin offset FOffsetCounter = FInstanceCounter++; //create config pin FCountSpread = factory.CreateIO <IDiffSpread <int> >( new ConfigAttribute(FAttribute.Name + " Count") { DefaultValue = 2, MinValue = 2 } ); FCountSpread.Changed += HandleCountSpreadChanged; FCountSpread.Sync(); }
protected override void OnConfigChange(IDiffSpread<string> configSpread) { base.OnConfigChange(configSpread); var attr = new InputAttribute("AvoidNil"); attr.BinVisibility = PinVisibility.OnlyInspector; attr.Order = 6; attr.BinOrder = 7; attr.BinSize = 1; attr.CheckIfChanged = true; Type pinType = typeof(ISpread<>).MakeGenericType((typeof(ISpread<>)).MakeGenericType(TargetDynamicType)); // the Pin is always a binsized one if (FAvoidNil != null) FAvoidNil.Dispose(); FAvoidNil = FIOFactory.CreateIOContainer(pinType, attr); }
void FInputCount_Changed(IDiffSpread<int> spread) { this.SetInputs(); }
protected void UpdateAddress(IDiffSpread<string> spread) { ValidAddress.Clear(); for (int i=0;i<FAddress.SliceCount;i++) { var address = FAddress[i]; ValidAddress.Add(CreateWildCardRegex(address)); } }
private void depthformatpin_Changed(IDiffSpread<EnumEntry> spread) { this.NeedReset = true; this.FormatChanged = true; }
private void FileChanged(IDiffSpread<string> spread) { FError.FlushItem("Loading."); FEndOfStream[0] = false; try { if (FFile.IsAnyInvalid() || string.IsNullOrWhiteSpace(FFile[0])) { FError.FlushItem("Nothing Loaded."); UnLoad(); return; } else UnLoad(); // reset everything anyway var fileName = FFile[0]; File = new FileStream(fileName, FileMode.Open); var io = new StreamReader(File); Reader = new JsonTextReader(io); // todo: allow single-entry json files as well MessageEnumerator = (JObject.ReadFrom(Reader) as JArray).Children().GetEnumerator(); FError.FlushItem("OK."); } catch (Exception ex) { UnLoad(); FError.FlushItem(ex.Message); FLogger.Log(LogType.Error, ex.ToString()); } }
private void Pinmode_Changed(IDiffSpread<eDepthBufferMode> spread) { if (this.currentmode != spread[0]) { if (this.currentmode == eDepthBufferMode.Standard) { if (this.depthoutputpin != null) { //Destroy depth stencil if (this.depthoutputpin.IOObject[0] != null) { this.depthoutputpin.IOObject[0].Dispose(); } this.depthoutputpin.Dispose(); this.depthformatpin.Dispose(); this.depthformatpin = null; this.depthoutputpin = null; } } if (this.currentmode == eDepthBufferMode.ReadOnly) { if (this.depthinputpin != null) { this.depthinputpin.Dispose(); this.depthinputpin = null; } } this.currentmode = spread[0]; if (this.currentmode == eDepthBufferMode.Standard) { OutputAttribute oattr = new OutputAttribute("Depth Buffer"); oattr.IsSingle = true; this.depthoutputpin = this.factory.CreateIOContainer<Pin<DX11Resource<DX11DepthStencil>>>(oattr); this.depthoutputpin.IOObject[0] = new DX11Resource<DX11DepthStencil>(); ConfigAttribute dfAttr = new ConfigAttribute("Depth Buffer Format"); dfAttr.EnumName = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.DepthStencil); dfAttr.DefaultEnumEntry = DX11EnumFormatHelper.NullDeviceFormats.GetAllowedFormats(FormatSupport.DepthStencil)[0]; dfAttr.IsSingle = true; this.depthformatpin = this.factory.CreateIOContainer<IDiffSpread<EnumEntry>>(dfAttr); this.depthformatpin.IOObject[0] = new EnumEntry(dfAttr.EnumName, 1); this.depthformatpin.IOObject.Changed += depthformatpin_Changed; } if (this.currentmode == eDepthBufferMode.ReadOnly) { InputAttribute oattr = new InputAttribute("Depth Buffer"); oattr.IsSingle = true; this.depthinputpin = this.factory.CreateIOContainer<Pin<DX11Resource<DX11DepthStencil>>>(oattr); } this.NeedReset = true; } }
private void FCfgBackBufferFormat_Changed(IDiffSpread<EnumEntry> spread) { this.invalidatesc = true; }
private void Pinmode_Changed(IDiffSpread<eRenderFormatMode> spread) { if (this.currentmode == eRenderFormatMode.Manual) { this.DisposeTexIn(); } this.currentmode = spread[0]; if (this.currentmode == eRenderFormatMode.Inherit) { this.CreateTextureIn(); } if (this.currentmode == eRenderFormatMode.InheritSize) { this.CreateTextureIn(); } }
void FLayout_Changed(IDiffSpread<string> spread) { foreach (IIOContainer sp in this.outspreads) { sp.Dispose(); } this.outspreads.Clear(); layout = spread[0].Split(",".ToCharArray()); int id = 1; foreach (string lay in layout) { OutputAttribute attr = new OutputAttribute("Output " + id.ToString()); IIOContainer container = null; switch (lay) { case "float": container = this.FIO.CreateIOContainer<ISpread<float>>(attr); break; case "float2": container = this.FIO.CreateIOContainer<ISpread<Vector2>>(attr); break; case "float3": container = this.FIO.CreateIOContainer<ISpread<Vector3>>(attr); break; case "float4": container = this.FIO.CreateIOContainer<ISpread<Vector4>>(attr); break; case "float4x4": container = this.FIO.CreateIOContainer<ISpread<Matrix>>(attr); break; case "int": container = this.FIO.CreateIOContainer<ISpread<int>>(attr); break; case "uint": container = this.FIO.CreateIOContainer<ISpread<uint>>(attr); break; case "uint2": //attr.AsInt = true; container = this.FIO.CreateIOContainer<ISpread<Vector2>>(attr); break; case "uint3": //attr.AsInt = true; container = this.FIO.CreateIOContainer<ISpread<Vector3>>(attr); break; } if (container != null) { this.outspreads.Add(container); id++; } } }
protected virtual void HandleConfigChange(IDiffSpread<string> configSpread) { FCount = 0; List<string> invalidPins = FPins.Keys.ToList(); string[] config = configSpread[0].Trim().Split(','); foreach (string pinConfig in config) { string[] pinData = pinConfig.Trim().Split(' '); try { string typeName = pinData[0].ToLower(); string name = pinData[1]; bool create = false; if (FPins.ContainsKey(name) && FPins[name] != null) { invalidPins.Remove(name); if (FTypes.ContainsKey(name)) { if (FTypes[name] != typeName) { FPins[name].Dispose(); FPins[name] = null; create = true; } } else { // key is in FPins, but no type defined. should never happen create = true; } } else { FPins.Add(name, null); create = true; } if (create) { Type type = typeof (string); foreach (Type key in TypeIdentity.Instance.Keys) { if (TypeIdentity.Instance[key] == typeName) { type = key; } } IOAttribute attr = DefinePin(name, type); // each implementation of DynamicNode must create its own InputAttribute or OutputAttribute ( Type pinType = typeof (ISpread<>).MakeGenericType((typeof (ISpread<>)).MakeGenericType(type)); // the Pin is always a binsized one FPins[name] = FIOFactory.CreateIOContainer(pinType, attr); FTypes.Add(name, typeName); } FCount += 2; // total pincount. always add two to account for data pin and binsize pin } catch (Exception ex) { var e = ex; FLogger.Log(LogType.Debug, ex.ToString()); FLogger.Log(LogType.Debug, "Invalid Descriptor in Config Pin"); } } foreach (string name in invalidPins) { FPins[name].Dispose(); FPins.Remove(name); FTypes.Remove(name); } }
void ParameterNamesConfig_Changed(IDiffSpread<string> spread) { //temp pin dictionary var prevPins = new Dictionary<string, ParamPin>(FParamPins); //create pin? foreach (var pinString in spread) { if(string.IsNullOrWhiteSpace(pinString)) continue; if (!prevPins.ContainsKey(pinString)) { var paramPin = ParamPin.Parse(pinString); var oa = new InputAttribute(paramPin.ParamName); //FLogger.Log(LogType.Debug, col.DataType.ToString()); paramPin.Pin = FHost.CreateValueInput(oa, typeof(float)); FParamPins[pinString] = paramPin; } else { prevPins.Remove(pinString); } } //any pin which is left over can be removed foreach (var pin in prevPins) { FHost.DeletePin(pin.Value.Pin); FParamPins.Remove(pin.Key); } }