public PluginInterfaces.V2.IIOContainer CreateIOContainer(PluginInterfaces.V2.IIOFactory factory, PluginInterfaces.V2.IOBuildContext context)
        {
            if (context.Direction == PinDirection.Input)
            {
                var t = context.DataType;
                var attribute = context.IOAttribute;
                var container = factory.CreateIOContainer(context.ReplaceIOType(typeof(INodeIn)));

                Type restype = t.GetGenericArguments()[0];
                Type fulltype = typeof(DX11Resource<>).MakeGenericType(restype);
                var stream = Activator.CreateInstance(typeof(DX11ResourceInputStream<,>).MakeGenericType(fulltype, restype), container.RawIOObject) as IInStream;
                IPluginIO io = container.GetPluginIO();

                ResourceListener rl = new ResourceListener(io);

                this.pinconnections.Add(rl.pin, rl);
                return IOContainer.Create(context, stream, container);
            }

            if (context.Direction == PinDirection.Output)
            {
                var t = context.DataType;
                var attribute = context.IOAttribute;
                var container = factory.CreateIOContainer(context.ReplaceIOType(typeof(INodeOut)));

                Type restype = t.GetGenericArguments()[0];
                Type fulltype = typeof(DX11Resource<>).MakeGenericType(restype);
                var stream = Activator.CreateInstance(typeof(DX11ResourceOutputStream<,>).MakeGenericType(fulltype,restype), container.RawIOObject, false) as IOutStream;
                return IOContainer.Create(context, stream, container);
            }

            return null;
        }
示例#2
0
        public PluginInterfaces.V2.IIOContainer CreateIOContainer(PluginInterfaces.V2.IIOFactory factory, PluginInterfaces.V2.IOBuildContext context)
        {
            if (context.Direction == PinDirection.Input)
            {
                var t         = context.DataType;
                var attribute = context.IOAttribute;
                var container = factory.CreateIOContainer(context.ReplaceIOType(typeof(INodeIn)));

                Type      restype  = t.GetGenericArguments()[0];
                Type      fulltype = typeof(DX11Resource <>).MakeGenericType(restype);
                var       stream   = Activator.CreateInstance(typeof(DX11ResourceInputStream <,>).MakeGenericType(fulltype, restype), container.RawIOObject) as IInStream;
                IPluginIO io       = container.GetPluginIO();

                ResourceListener rl = new ResourceListener(io);

                this.pinconnections.Add(rl.pin, rl);
                return(IOContainer.Create(context, stream, container));
            }

            if (context.Direction == PinDirection.Output)
            {
                var t         = context.DataType;
                var attribute = context.IOAttribute;
                var container = factory.CreateIOContainer(context.ReplaceIOType(typeof(INodeOut)));

                Type restype  = t.GetGenericArguments()[0];
                Type fulltype = typeof(DX11Resource <>).MakeGenericType(restype);
                var  stream   = Activator.CreateInstance(typeof(DX11ResourceOutputStream <,>).MakeGenericType(fulltype, restype), container.RawIOObject, false) as IOutStream;
                return(IOContainer.Create(context, stream, container));
            }

            return(null);
        }
示例#3
0
        public PluginInterfaces.V2.IIOContainer CreateIOContainer(PluginInterfaces.V2.IIOFactory factory, PluginInterfaces.V2.IOBuildContext context)
        {
            if (context.Direction == PinDirection.Input)
            {
                var t         = context.DataType;
                var attribute = context.IOAttribute;
                var container = factory.CreateIOContainer(context.ReplaceIOType(typeof(INodeIn)));

                Type      restype  = t.GetGenericArguments()[0];
                Type      fulltype = typeof(DX11Resource <>).MakeGenericType(restype);
                var       stream   = Activator.CreateInstance(typeof(DX11ResourceInputStream <,>).MakeGenericType(fulltype, restype), container.RawIOObject) as IInStream;
                IPluginIO io       = container.GetPluginIO();

                ResourceListener rl = new ResourceListener(io, stream);

                this.pinconnections.Add(rl.Pin, rl);
                return(IOContainer.Create(context, stream, container));
            }

            if (context.Direction == PinDirection.Output)
            {
                var t         = context.DataType;
                var attribute = context.IOAttribute;
                var container = factory.CreateIOContainer(context.ReplaceIOType(typeof(INodeOut)));

                Type restype  = t.GetGenericArguments()[0];
                Type fulltype = typeof(DX11Resource <>).MakeGenericType(restype);

                //Check if resource type should only be a single output
                bool shouldBeSingle = restype.GetCustomAttributes(typeof(SingleOutputAttribute), true).Length > 0;

                var stream = Activator.CreateInstance(typeof(DX11ResourceOutputStream <,>).MakeGenericType(fulltype, restype), container.RawIOObject, shouldBeSingle) as IOutStream;
                return(IOContainer.Create(context, stream, container));
            }

            return(null);
        }