Example #1
0
        /// <summary>
        /// Returns the native plugin io interfaces if any.
        /// </summary>
        public static IEnumerable <IPluginIO> GetPluginIOs(this IIOContainer container)
        {
            var pluginIO = container.RawIOObject as IPluginIO;

            if (pluginIO != null)
            {
                yield return(pluginIO);
            }
            var baseContainer = container.BaseContainer;

            if (baseContainer != null)
            {
                foreach (var p in baseContainer.GetPluginIOs())
                {
                    yield return(p);
                }
            }
            else
            {
                var containers = container.AssociatedContainers;
                if (containers != null)
                {
                    foreach (var c in containers)
                    {
                        foreach (var p in c.GetPluginIOs())
                        {
                            yield return(p);
                        }
                    }
                }
            }
        }
 private void SetInputs()
 {
     if (this.FInputCount[0] != FLayers.Count)
     {
         if (this.FInputCount[0] > FLayers.Count)
         {
             while (this.FInputCount[0] > FLayers.Count)
             {
                 InputAttribute attr = new InputAttribute("Layer " + Convert.ToString(this.FLayers.Count + 1));
                 attr.IsSingle       = true;
                 attr.CheckIfChanged = true;
                 attr.AutoValidate   = false;
                 //Create new layer Pin
                 IIOContainer <Pin <DX11Resource <DX11Layer> > > newlayer = this.FIOFactory.CreateIOContainer <Pin <DX11Resource <DX11Layer> > >(attr);
                 newlayer.IOObject.SliceCount = 1;
                 this.FLayers.Add(newlayer);
                 newlayer.IOObject[0] = new DX11Resource <DX11Layer>();
             }
         }
         else
         {
             while (this.FInputCount[0] < FLayers.Count)
             {
                 this.FLayers[this.FLayers.Count - 1].Dispose();
                 this.FLayers.RemoveAt(this.FLayers.Count - 1);
             }
         }
     }
 }
 private void SetInputs()
 {
     if (FInputCount[0] != FInputs.Count)
     {
         if (FInputCount[0] > FInputs.Count)
         {
             while (FInputCount[0] > FInputs.Count)
             {
                 InputAttribute attr = new InputAttribute("Input " + Convert.ToString(FInputs.Count + 1));
                 attr.CheckIfChanged = true;
                 IIOContainer <Pin <IEntity> > pin = FIOFactory.CreateIOContainer <Pin <IEntity> >(attr);
                 pin.IOObject.SliceCount = 0;
                 FInputs.Add(pin);
             }
         }
         else
         {
             while (FInputCount[0] < FInputs.Count)
             {
                 FInputs[FInputs.Count - 1].Dispose();
                 FInputs.RemoveAt(FInputs.Count - 1);
             }
         }
     }
 }
Example #4
0
 public MultiDimInStream(IIOFactory factory, InputAttribute attribute)
 {
     FDataContainer    = factory.CreateIOContainer <IInStream <T> >(attribute.DecreaseBinSizeWrapCount(), false);
     FBinSizeContainer = factory.CreateIOContainer <IInStream <int> >(attribute.GetBinSizeInputAttribute(FDataContainer), false);
     FDataStream       = FDataContainer.IOObject;
     FBinSizeStream    = FBinSizeContainer.IOObject;
 }
Example #5
0
        protected bool HasLink(IIOContainer pinContainer)
        {
            try
            {
                var connected = pinContainer.GetPluginIO().IsConnected;

                foreach (var associated in pinContainer.AssociatedContainers)
                {
                    connected |= associated.GetPluginIO().IsConnected;
                }
                return(connected);
            }
            catch (InvalidComObjectException)
            {
                // [Import]s not yet ready. try another time.
                // its safe to assume that no pins have been created yet.
                FLogger.Log(LogType.Warning, "Not fully initialized [" + this.GetType().Name + "].");
                return(false);
            }
            catch (Exception)
            {
                string nodePath = PluginHost.GetNodePath(false);
                FLogger.Log(LogType.Error, "Failed to protect a " + this.GetType().Name + " node: " + nodePath);
                return(false);
            }
        }
Example #6
0
 public MultiDimInStream(IIOFactory factory, InputAttribute attribute)
 {
     FDataContainer    = factory.CreateIOContainer <IInStream <T> >(attribute, false);
     FBinSizeContainer = factory.CreateIOContainer <IInStream <int> >(attribute.GetBinSizeInputAttribute(), false);
     FDataStream       = FDataContainer.IOObject;
     FBinSizeStream    = (IntInStream)FBinSizeContainer.IOObject;
 }
        public void WriteToIO(Field field, IIOContainer ioContainer, ref Core.Struct str)
        {
            dynamic source = str[field];
            dynamic dest   = ioContainer.RawIOObject;

            AssignStream(source, dest);
        }
        public void WriteToIOBin(Field field, IIOContainer ioContainer, ref Core.Struct str, int index = 0)
        {
            dynamic source = str[field];
            dynamic dest   = ioContainer.RawIOObject;

            WriteStream(source, dest, index);
        }
Example #9
0
            public QueryInfo(string Name, IIOFactory IOFactory)
            {
                string pinName = Name;        //.Replace("/"," ");

//              if (pinName.StartsWith("/"))
//                  pinName = pinName.Replace("/","|");
                this.Name            = Name;
                QueryExistsContainer = IOFactory.CreateIOContainer <IOutStream <bool> >(new OutputAttribute(pinName + " Available")
                {
                    Visibility = PinVisibility.OnlyInspector
                });
                QueryExistsContainer.IOObject.Length = 0;
                QueryContainer = IOFactory.CreateIOContainer <IOutStream <string> >(new OutputAttribute(pinName));
                QueryContainer.IOObject.Length = 0;
                FirstContainer = IOFactory.CreateIOContainer <IOutStream <XElement> >(new OutputAttribute(pinName + " (Child)")
                {
                    Visibility = PinVisibility.OnlyInspector
                });
                FirstContainer.IOObject.Length = 0;
                AllContainer = IOFactory.CreateIOContainer <IOutStream <IInStream <XElement> > >(
                    new OutputAttribute(pinName + " (Children)")
                {
                    Visibility = PinVisibility.OnlyInspector, BinVisibility = PinVisibility.OnlyInspector
                });

                AllContainer.IOObject.Length = 0;
            }
Example #10
0
 public IOContainer(IIOContainer container, bool isInput = true, bool isBinSized = false, int order = 0)
 {
     iiocontainer = container;
     //IsInput = isInput;
     IsBinSized = isBinSized;
     Order      = order;
 }
 private void SetInputs()
 {
     if (this.FInputCount[0] != FInputs.Count)
     {
         if (this.FInputCount[0] > FInputs.Count)
         {
             while (this.FInputCount[0] > FInputs.Count)
             {
                 InputAttribute attr = new InputAttribute("Input " + Convert.ToString(this.FInputs.Count + 1));
                 //attr.IsSingle = true;
                 attr.CheckIfChanged = true;
                 //Create new layer Pin
                 IIOContainer <Pin <DX11Resource <DX11IndexedGeometry> > > newlayer = this.FIOFactory.CreateIOContainer <Pin <DX11Resource <DX11IndexedGeometry> > >(attr);
                 newlayer.IOObject.SliceCount = 1;
                 this.FInputs.Add(newlayer);
             }
         }
         else
         {
             while (this.FInputCount[0] < FInputs.Count)
             {
                 this.FInputs[this.FInputs.Count - 1].Dispose();
                 this.FInputs.RemoveAt(this.FInputs.Count - 1);
             }
         }
     }
 }
Example #12
0
        private void ManageDiffOutput(IDiffSpread <bool> advanced)
        {
            if (FAdvanced[0])
            {
                Keep.QuickMode = false;

                var ia = new InputAttribute("Include input in Diff");
                ia.Order          = 2;
                ia.IsSingle       = true;
                ia.IsToggle       = true;
                ia.DefaultBoolean = true;

                Type pinType = typeof(IDiffSpread <>).MakeGenericType(typeof(bool));
                DoAllChange = FIOFactory.CreateIOContainer(pinType, ia);
                var pin = DoAllChange.RawIOObject as IDiffSpread <bool>;
                pin.Changed += UpdateChangeAll;

                var attr = new OutputAttribute("Message Diff");
                attr.AutoFlush = false;
                attr.Order     = 2;

                pinType    = typeof(Pin <>).MakeGenericType(typeof(Message));
                Change     = FIOFactory.CreateIOContainer(pinType, attr);
                FChangeOut = Change.RawIOObject as Pin <Message>;

                attr           = new OutputAttribute("Changed Message Index");
                attr.AutoFlush = false;
                attr.Order     = 3;

                pinType         = typeof(ISpread <>).MakeGenericType(typeof(int));
                ChangeIndex     = FIOFactory.CreateIOContainer(pinType, attr);
                FChangeIndexOut = ChangeIndex.RawIOObject as Pin <int>;
            }
            else
            {
                Keep.QuickMode = true;

                if (DoAllChange != null)
                {
                    DoAllChange.Dispose();
                    DoAllChange      = null;
                    ManageAllChanges = true;
                }

                if (ChangeIndex != null)
                {
                    ChangeIndex.Dispose();
                    ChangeIndex     = null;
                    FChangeIndexOut = null;
                }

                if (FChangeOut != null)
                {
                    Change.Dispose();
                    Change     = null;
                    FChangeOut = null;
                }
            }
        }
Example #13
0
 private void DisposeTexIn()
 {
     if (this.texinputpin != null)
     {
         this.texinputpin.Dispose();
         this.texinputpin = null;
     }
 }
Example #14
0
 public OutputAttribute GetBinSizeOutputAttribute(IIOContainer dataContainer)
 {
     return(new OutputAttribute(BinName == DefaultBinName ? GetBinSizeName(Name, dataContainer) : BinName)
     {
         Order = BinOrder,
         Visibility = BinVisibility
     });
 }
Example #15
0
        public static ISpread <ISpread <T> > CreateBinSizeSpread <T>(this IIOContainer <IOutStream <int> > binSizePin, OutputAttribute attribute, bool subscribe = true)
        {
            var factory = binSizePin.Factory;
            var context = IOBuildContext.Create(typeof(ISpread <ISpread <T> >), attribute, subscribe);

            context.BinSizeIOContainer = binSizePin;
            return(factory.CreateIO(context) as ISpread <ISpread <T> >);
        }
Example #16
0
        public void OnImportsSatisfied()
        {
            FInputContainer = FFactory.CreateIOContainer <IInStream <IInStream <T> > >(
                new InputAttribute("Input"));

            FOutputContainer = FFactory.CreateIOContainer <IOutStream <IInStream <T> > >(
                new OutputAttribute("Output"));
        }
Example #17
0
 public OutputBinSpreadStream(IIOFactory ioFactory, OutputAttribute attribute)
 {
     FDataContainer    = ioFactory.CreateIOContainer <IOutStream <T> >(attribute, false);
     FBinSizeContainer = ioFactory.CreateIOContainer <IOutStream <int> >(attribute.GetBinSizeOutputAttribute(), false);
     FDataStream       = FDataContainer.IOObject;
     FBinSizeStream    = FBinSizeContainer.IOObject;
     Length            = 1;
 }
Example #18
0
 public MultiDimOutStream(IIOFactory ioFactory, OutputAttribute attribute)
 {
     FDataContainer    = ioFactory.CreateIOContainer <IOutStream <T> >(attribute.DecreaseBinSizeWrapCount(), false);
     FBinSizeContainer = ioFactory.CreateIOContainer <IOutStream <int> >(attribute.GetBinSizeOutputAttribute(FDataContainer), false);
     FDataStream       = FDataContainer.IOObject;
     FBinSizeStream    = FBinSizeContainer.IOObject;
     Length            = 1;
 }
Example #19
0
        public void ChangePins()
        {
            TypesAndFields.Clear();

            string def = "";

            if (FDefinition[0] != null)
            {
                def = FDefinition[0];
            }
            string[] tempfields = def.Trim().Split(',');

            int           order      = 100;
            List <string> fieldnames = new List <string>();

            foreach (string field in tempfields)
            {
                string[] typefieldpair = field.Trim().Split(' ');
                if (typefieldpair.Length == 2)
                {
                    typefieldpair[0] = typefieldpair[0].Trim();
                    typefieldpair[0] = typefieldpair[0].ToLower();
                    typefieldpair[1] = typefieldpair[1].Trim();

                    if (IdentityType.Instance.ContainsKey(typefieldpair[0]) && (!fieldnames.Contains(typefieldpair[1].ToLower())))
                    {
                        fieldnames.Add(typefieldpair[1].ToLower());
                        TypesAndFields.Add(typefieldpair);

                        if (!Spreads.ContainsKey(typefieldpair[1]))
                        {
                            Type         currtype   = IdentityType.Instance[typefieldpair[0]];
                            Type         pinType    = typeof(ISpread <>).MakeGenericType((typeof(ISpread <>)).MakeGenericType(currtype));
                            IIOContainer currpin    = FIOFactory.CreateIOContainer(pinType, PinAttribute(typefieldpair[1], order));
                            NGISpread    currspread = currpin.ToISpread();
                            Spreads.Add(typefieldpair[1], currspread);
                            Pins.Add(typefieldpair[1], currpin);
                        }
                    }
                }
                order++;
            }
            List <string> Removable = new List <string>();

            foreach (string k in Spreads.Keys)
            {
                if (!fieldnames.Contains(k.ToLower()))
                {
                    Removable.Add(k);
                }
            }
            foreach (string k in Removable)
            {
                Spreads.Remove(k);
                Pins[k].Dispose();
                Pins.Remove(k);
            }
        }
        public override void OnSync(IIOContainer ioContainer)
        {
            dynamic self = (ioContainer.Factory.PluginHost.Plugin as IPluginContainer).PluginBase;

            if (self.RenderRequest != null)
            {
                self.RenderRequest(self, ioContainer.Factory.PluginHost);
            }
        }
Example #21
0
        int GetBinSizePinCount(IIOContainer container)
        {
            var multiPin = container.RawIOObject as IIOMultiPin;

            if (multiPin != null && multiPin.AssociatedContainers.Length == 1)
            {
                return(GetBinSizePinCount(multiPin.AssociatedContainers[0]) + 1);
            }
            return(0);
        }
Example #22
0
 public IOContainerBase(IOBuildContext context, IIOFactory factory, IIOContainer baseContainer, object rawIOObject)
 {
     Factory       = factory;
     BaseContainer = baseContainer;
     RawIOObject   = rawIOObject;
     if (context.SubscribeToIOEvents)
     {
         Factory.Disposing += HandleFactoryDisposing;
     }
 }
Example #23
0
        public void OnImportsSatisfied()
        {
            AutomataUI.Connected    += Input_Connected;
            AutomataUI.Disconnected += Input_Disconnected;

            //new way of enums
            InputAttribute attr = new InputAttribute("State");

            StatesEnum = FIOFactory.CreateIOContainer <IDiffSpread <EnumEntry> >(attr, true);
        }
Example #24
0
        private void CreateTextureIn()
        {
            if (this.texinputpin == null)
            {
                InputAttribute tattr = new InputAttribute("Texture In");
                tattr.Order = -1;

                this.texinputpin = this.iofactory.CreateIOContainer <Pin <DX11Resource <DX11Texture2D> > >(tattr);
            }
        }
Example #25
0
        public void ReadFromIOBin(Field field, IIOContainer ioContainer, ISpread <Core.Struct> structs)
        {
            dynamic multidim = ioContainer.RawIOObject;
            var     spread   = GetMultidim(multidim);

            for (int i = 0; i < structs.SliceCount; i++)
            {
                structs[i][field] = spread[i];
            }
        }
Example #26
0
            public Column(IIOFactory factory, Keys keyCode, IScheduler scheduler)
            {
                KeyCode    = keyCode;
                FScheduler = scheduler;
                var attribute = new OutputAttribute(keyCode.ToString())
                {
                    IsBang = true
                };

                IOContainer = factory.CreateIOContainer <ISpread <bool> >(attribute);
            }
Example #27
0
 public KeyboardEventsSplitNode(IIOFactory factory)
 {
     KeyboardIn = factory.CreateSpread <Keyboard>(new InputAttribute("Keyboard"));
     BinSizePin = factory.CreateBinSizeOutput(new OutputAttribute("Bin Size")
     {
         Order = int.MaxValue
     });
     EventTypeOut = BinSizePin.CreateBinSizeSpread <KeyNotificationKind>(new OutputAttribute("Event Type"));
     KeyCodeOut   = BinSizePin.CreateBinSizeSpread <int>(new OutputAttribute("Key Code"));
     KeyCharOut   = BinSizePin.CreateBinSizeSpread <string>(new OutputAttribute("Key Char"));
 }
Example #28
0
        public void OnImportsSatisfied()
        {
            FInputContainer = FFactory.CreateIOContainer <ISpread <ISpread <T> > >(
                new InputAttribute("Input")
            {
                BinSize = 1
            });

            FOutputContainer = FFactory.CreateIOContainer <ISpread <ISpread <T> > >(
                new OutputAttribute("Output"));
        }
Example #29
0
        public static Type GetInnerMostType(this IIOContainer pinContainer)
        {
            var type = pinContainer.GetType();

            while (type.GenericTypeArguments.Length > 0)
            {
                type = type.GenericTypeArguments[0];
            }

            return(type);
        }
Example #30
0
 public InputBinSpreadStream(IIOFactory ioFactory, InputAttribute attribute, bool checkIfChanged, Func <IIOContainer <IInStream <int> > > binSizeIOContainerFactory)
 {
     // Don't do this, as spread max won't get computed for this pin
     //                attribute.AutoValidate = false;
     attribute.CheckIfChanged = checkIfChanged;
     FDataContainer           = ioFactory.CreateIOContainer <IInStream <T> >(attribute, false);
     FBinSizeContainer        = binSizeIOContainerFactory();
     FDataStream    = FDataContainer.IOObject;
     FBinSizeStream = FBinSizeContainer.IOObject;
     FDataIO        = FDataContainer.GetPluginIO();
 }
Example #31
0
        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);
        }
Example #32
0
        public RenderTargetManager(IPluginHost host, IIOFactory iofactory)
        {
            this.host = host;
            this.iofactory = iofactory;

            ConfigAttribute cattr = new ConfigAttribute("Texture Input Mode");
            cattr.IsSingle = true;
            cattr.DefaultEnumEntry = "Manual";

            pinmode = this.iofactory.CreateIOContainer<IDiffSpread<eRenderFormatMode>>(cattr);
            pinmode.IOObject.Changed += Pinmode_Changed;

            this.currentmode = eRenderFormatMode.Manual;

            this.CreateFormat();
            this.CreateSize();
        }
Example #33
0
        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);
        }
        private void ManageDiffOutput(IDiffSpread<bool> advanced)
        {
            if (FAdvanced[0])
            {
                Keep.QuickMode = false;

                var ia = new InputAttribute("Include input in Diff");
                ia.Order = 2;
                ia.IsSingle = true;
                ia.IsToggle = true;
                ia.DefaultBoolean = true;

                Type pinType = typeof(IDiffSpread<>).MakeGenericType(typeof(bool));
                DoAllChange = FIOFactory.CreateIOContainer(pinType, ia);
                var pin = DoAllChange.RawIOObject as IDiffSpread<bool>;
                pin.Changed += UpdateChangeAll;

                var attr = new OutputAttribute("Message Diff");
                attr.AutoFlush = false;
                attr.Order = 2;

                pinType = typeof(Pin<>).MakeGenericType(typeof(Message));
                Change = FIOFactory.CreateIOContainer(pinType, attr);
                FChangeOut = Change.RawIOObject as Pin<Message>;

                attr = new OutputAttribute("Changed Message Index");
                attr.AutoFlush = false;
                attr.Order = 3;

                pinType = typeof(ISpread<>).MakeGenericType(typeof(int));
                ChangeIndex = FIOFactory.CreateIOContainer(pinType, attr);
                FChangeIndexOut = ChangeIndex.RawIOObject as Pin<int>;
            }
            else
            {
                Keep.QuickMode = true;

                if (DoAllChange!= null)
                {
                    DoAllChange.Dispose();
                    DoAllChange = null;
                    ManageAllChanges = true;
                }

                if (ChangeIndex != null)
                {
                    ChangeIndex.Dispose();
                    ChangeIndex = null;
                    FChangeIndexOut = null;
                }

                if (FChangeOut != null)
                {
                    Change.Dispose();
                    Change = null;
                    FChangeOut = null;
                }

            }
        }
Example #35
0
 private void DisposeTexIn()
 {
     if (this.texinputpin != null)
     {
         this.texinputpin.Dispose();
         this.texinputpin = null;
     }
 }
Example #36
0
        private void CreateTextureIn()
        {
            if (this.texinputpin == null)
            {
                InputAttribute tattr = new InputAttribute("Texture In");
                tattr.Order = -1;

                this.texinputpin = this.iofactory.CreateIOContainer<Pin<DX11Resource<DX11Texture2D>>>(tattr);
            }
        }
Example #37
0
        private void CreateSize()
        {
            if (this.FInTextureSize == null)
            {
                InputAttribute a = new InputAttribute("Texture Size");
                a.Order = 8;
                a.DefaultValues = new double[] { 400, 300 };
                a.CheckIfChanged = true;

                this.FInTextureSize = this.iofactory.CreateIOContainer<IDiffSpread<Vector2D>>(a);

                a.Name = "Texture Scale";
                a.DefaultValues = new double[] { 1, 1 };
                this.FInTextureScale = this.iofactory.CreateIOContainer<IDiffSpread<Vector2D>>(a);
            }
        }
Example #38
0
        private void CreateFormat()
        {
            if (this.FInFormat == null)
            {
                string ename = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.RenderTarget);

                InputAttribute tattr = new InputAttribute("Target Format");
                tattr.EnumName = ename;
                tattr.DefaultEnumEntry = "R8G8B8A8_UNorm";
                tattr.DefaultString = "R8G8B8A8_UNorm";
                tattr.AllowDefault = true;
                tattr.Order = 0;
                tattr.CheckIfChanged = true;
                tattr.DefaultString = "R8G8B8A8_UNorm";

                this.FInFormat = this.iofactory.CreateIOContainer<IDiffSpread<EnumEntry>>(tattr);
            }
        }
Example #39
0
		public void OnImportsSatisfied()
		{
			FBinSize = FFactory.CreateBinSizeInput(new InputAttribute("Bin Size") { DefaultValue = -1, Order = int.MaxValue });
			FAttractor = FBinSize.CreateBinSizeSpread<Vector3D>(new InputAttribute("Attractor"));
			FStrength = FBinSize.CreateBinSizeSpread<double>(new InputAttribute("Strength"));
			FPower = FBinSize.CreateBinSizeSpread<double>(new InputAttribute("Power") { DefaultValue = 1 });
			FRadius = FBinSize.CreateBinSizeSpread<double>(new InputAttribute("Radius") { DefaultValue = 0.1 });
		}
Example #40
0
		public void OnImportsSatisfied()
		{
			FBinSize = FFactory.CreateBinSizeInput(new InputAttribute("Bin Size") { DefaultValue = -1, Order = int.MaxValue });
			FForce = FBinSize.CreateBinSizeSpread<Vector3D>(new InputAttribute("Force"));
			FId = FBinSize.CreateBinSizeSpread<int>(new InputAttribute("Index"));
		}
Example #41
0
		public void OnImportsSatisfied()
		{
			FBinSize = FFactory.CreateBinSizeInput(new InputAttribute("Bin Size") { DefaultValue = -1, Order = int.MaxValue });
			FPosition = FBinSize.CreateBinSizeSpread<Vector3D>(new InputAttribute("Position"));
			FId = FBinSize.CreateBinSizeSpread<int>(new InputAttribute("Index"));
			FApply = FBinSize.CreateBinSizeSpread<double>(new InputAttribute("Apply"));
		}
        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);
        }
Example #43
0
        protected bool HasLink(IIOContainer pinContainer)
        {
            try
            {
                var connected = pinContainer.GetPluginIO().IsConnected;

                foreach (var associated in pinContainer.AssociatedContainers)
                {
                    connected |= associated.GetPluginIO().IsConnected;
                }
                return connected;
            }
            catch (InvalidComObjectException)
            {
                // [Import]s not yet ready. try another time.
                // its safe to assume that no pins have been created yet.
                FLogger.Log(LogType.Warning, "Not fully initialized [" + this.GetType().Name + "].");
                return false;
            }
            catch (Exception)
            {
                string nodePath = PluginHost.GetNodePath(false);
                FLogger.Log(LogType.Error, "Failed to protect a " + this.GetType().Name + " node: " + nodePath);
                return false;

            }
        }
        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;
            }
        }