public static void DrawNormalizeLayer (MatrixGenerators.Normalize200.NormalizeLayer layer, object[] arguments)
		{
			int num = (int)arguments[0];
			MatrixGenerators.Normalize200 gen = (MatrixGenerators.Normalize200)arguments[1];

			if (layer == null) return;

			using (Cell.LinePx(20))
			{
				if (num!=0) 
					using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
				else 
					//disconnecting last layer inlet
					if (GraphWindow.current.graph.IsLinked(layer))
						GraphWindow.current.graph.UnlinkInlet(layer);

				Cell.EmptyRowPx(10);

				using (Cell.RowPx(80))
				{
					if (num==0) Draw.Label("Background");
					else Draw.Label("Layer " + num);
				}

				using (Cell.RowPx(10)) Draw.Icon(UI.current.textures.GetTexture("DPUI/Icons/Opacity"));
				using (Cell.Row) layer.Opacity = Draw.Field(layer.Opacity);

				Cell.EmptyRowPx(10);
				using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
			}
		}
Esempio n. 2
0
        private static void DrawCustomShaderLayer(Generator tgen, int num)
        {
            CustomShaderOutput200 gen = (CustomShaderOutput200)tgen;

            CustomShaderOutput200.CustomShaderLayer layer = gen.layers[num];
            if (layer == null)
            {
                return;
            }

            using (Cell.LinePx(32))
            {
                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                using (Cell.Row) Draw.PopupSelector(ref layer.channelNum, MatrixGenerators.CustomShaderOutput200.controlTextureNames, null);

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
        }
Esempio n. 3
0
        public static void DrawCustomShaderLayer(MatrixGenerators.CustomShaderOutput200.CustomShaderLayer layer, object[] arguments)
        {
            MatrixGenerators.CustomShaderOutput200 texturesOut = (MatrixGenerators.CustomShaderOutput200)arguments[1];
            int num = (int)arguments[0];

            if (layer == null)
            {
                return;
            }

            using (Cell.LinePx(32))
            {
                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, texturesOut);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                using (Cell.Row) Draw.PopupSelector(ref layer.channelNum, MatrixGenerators.CustomShaderOutput200.controlTextureNames, null);

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
        }
Esempio n. 4
0
        private static void DrawNormalizeLayer(Generator tgen, int num)
        {
            Normalize200 gen = (Normalize200)tgen;

            Normalize200.NormalizeLayer layer = gen.layers[num];

            if (layer == null)
            {
                return;
            }

            using (Cell.LinePx(20))
            {
                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                using (Cell.RowPx(73))
                {
                    if (num == 0)
                    {
                        Draw.Label("Background");
                    }
                    else
                    {
                        Draw.Label("Layer " + num);
                    }
                }

                using (Cell.RowPx(10)) Draw.Icon(UI.current.textures.GetTexture("DPUI/Icons/Opacity"));
                using (Cell.Row) layer.Opacity = Draw.Field(layer.Opacity);

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
        }
		public static void DrawRTPLayer (MatrixGenerators.RTPOutput200.RTPLayer layer, object[] arguments)
		{
			int num = (int)arguments[0];
			MatrixGenerators.RTPOutput200 gen = (MatrixGenerators.RTPOutput200)arguments[1];
			if (layer == null) return;

			using (Cell.LinePx(32))
			{
				//Cell.current.margins = new Padding(0,0,0,1); //1-pixel more padding from the bottom since layers are 1 pixel overlayed

				if (num!=0) 
					using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
				else 
					//disconnecting last layer inlet
					if (GraphWindow.current.graph.IsLinked(layer))
						GraphWindow.current.graph.UnlinkInlet(layer);

				Cell.EmptyRowPx(10);

				//icon
				#if RTP
				Texture2D icon = null;
				if (rtp != null)
				{
					if (layer.channelNum < rtp.globalSettingsHolder.splats.Length)
						icon = rtp.globalSettingsHolder.splats[layer.channelNum];
				}
				Draw.TextureIcon(icon, cell:UI.Empty(Size.RowPixels(32))); 

				//channel selector
				UI.Empty(Size.RowPixels(3));
				UI.PopupSelector(ref layer.channelNum, textureNames, null);
				#else
				using (Cell.LineStd) Draw.Field(ref layer.channelNum, "Channel");
				#endif

				Cell.EmptyRowPx(10);
				using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
			}
		}
Esempio n. 6
0
        private static void DrawMicroSplatLayer(Generator tgen, int num)
        {
            MicroSplatOutput200 gen = (MicroSplatOutput200)tgen;

            MicroSplatOutput200.MicroSplatLayer layer = gen.layers[num];
            if (layer == null)
            {
                return;
            }

            Material microSplatMat = null;

            if (GraphWindow.current.mapMagic != null)
            {
                microSplatMat = GraphWindow.current.mapMagic.terrainSettings.material;
            }

            Cell.EmptyLinePx(3);
            using (Cell.LinePx(28))
            {
                //Cell.current.margins = new Padding(0,0,0,1); //1-pixel more padding from the bottom since layers are 1 pixel overlayed

                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                //icon
                Texture2DArray icon = null;
                if (microSplatMat != null && microSplatMat.HasProperty("_Diffuse"))
                {
                    icon = (Texture2DArray)microSplatMat?.GetTexture("_Diffuse");
                }

                using (Cell.RowPx(28))
                {
                    if (icon != null)
                    {
                        Draw.TextureIcon(icon, layer.channelNum);
                    }
                }

                //index
                using (Cell.Row)
                {
                    Cell.EmptyLine();
                    using (Cell.LineStd)
                    {
                        int newIndex = Draw.Field(layer.channelNum, "Index");
                        if (newIndex >= 0 && (icon == null || newIndex < icon.depth))
                        {
                            layer.channelNum = newIndex;
                        }
                    }
                    Cell.EmptyLine();
                }

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
            Cell.EmptyLinePx(3);
        }
Esempio n. 7
0
        private static void DrawRTPLayer(Generator tgen, int num)
        {
            RTPOutput200 gen = (RTPOutput200)tgen;

            RTPOutput200.RTPLayer layer = gen.layers[num];
            if (layer == null)
            {
                return;
            }

            using (Cell.LinePx(32))
            {
                //Cell.current.margins = new Padding(0,0,0,1); //1-pixel more padding from the bottom since layers are 1 pixel overlayed

                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                //icon
                                #if RTP
                Texture2D icon = null;
                if (gen.rtp != null)
                {
                    if (layer.channelNum < gen.rtp.globalSettingsHolder.splats.Length)
                    {
                        icon = gen.rtp.globalSettingsHolder.splats[layer.channelNum];
                    }

                    using (Cell.RowPx(28))
                    {
                        Cell.EmptyLinePx(2);
                        using (Cell.Line) Draw.TextureIcon(icon);
                        Cell.EmptyLinePx(2);
                    }

                    //channel selector
                    Cell.EmptyRowPx(3);
                    using (Cell.Row)
                    {
                        Cell.EmptyLine();
                        using (Cell.LineStd) Draw.PopupSelector(ref layer.channelNum, textureNames);
                        Cell.EmptyLine();
                    }
                }
                else
                                #endif
                using (Cell.Row)
                {
                    Cell.EmptyLine();
                    using (Cell.LineStd) Draw.Field(ref layer.channelNum, "Channel");
                    Cell.EmptyLine();
                }

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
        }
Esempio n. 8
0
        private static void DrawTexturesLayer(Generator tgen, int num)
        {
            TexturesOutput200 texOut = (TexturesOutput200)tgen;

            TexturesOutput200.TextureLayer layer = texOut.layers[num];
            if (layer == null)
            {
                return;
            }

            Cell.EmptyLinePx(3);
            using (Cell.LinePx(28))
            {
                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, texOut);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                Texture2D tex = layer.prototype != null ? layer.prototype.diffuseTexture : UI.current.textures.GetTexture("DPUI/Backgrounds/Empty");
                using (Cell.RowPx(28)) Draw.TextureIcon(tex);

                using (Cell.Row)
                {
                    Cell.current.trackChange = false;
                    Draw.EditableLabel(ref layer.name);
                }

                using (Cell.RowPx(20))
                {
                    Cell.current.trackChange = false;
                    Draw.LayerChevron(num, ref texOut.guiExpanded);
                }

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
            Cell.EmptyLinePx(2);

            if (texOut.guiExpanded == num)
            {
                using (Cell.Line)
                {
                    Cell.EmptyRowPx(2);

                    using (Cell.Row)
                    {
                        using (Cell.LinePx(0))
                            using (Cell.Padded(1, 0, 0, 0))
                            {
                                //using (Cell.LineStd) layer.Opacity = Draw.Field(layer.Opacity, "Opacity");
                                //using (Cell.LineStd) Draw.ObjectField(ref layer.prototype, "Layer");

                                Draw.Class(layer, "Layer", addFieldsToCellObjs: true);
                                //this will add terrainlayer to exposed

                                if (layer.name == "Layer" && layer.prototype != null)
                                {
                                    layer.name = layer.prototype.name;
                                }
                            }

                        if (layer.prototype != null)
                        {
                            Cell.EmptyLinePx(2);

                            using (Cell.LineStd)
                                using (new Draw.FoldoutGroup(ref layer.guiProperties, "Properties"))
                                    if (layer.guiProperties)
                                    {
                                        //textures
                                        using (Cell.LineStd)
                                        {
                                            Texture2D tex = layer.prototype.diffuseTexture;
                                            Draw.Field(ref tex, "Diffuse");
                                            if (Cell.current.valChanged)
                                            {
                                                if (layer.prototype.diffuseTexture.name == "WrColorPlaceholder2x2")
                                                {
                                                    GameObject.DestroyImmediate(layer.prototype.diffuseTexture);                             // removing temporary color texture if assigned
                                                }
                                                layer.prototype.diffuseTexture = tex;
                                            }
                                        }

                                        using (Cell.LineStd)
                                        {
                                            Texture2D tex = layer.prototype.normalMapTexture;
                                            Draw.Field(ref tex, "Normal");
                                            if (Cell.current.valChanged)
                                            {
                                                layer.prototype.normalMapTexture = tex;
                                            }
                                        }

                                        using (Cell.LineStd)
                                        {
                                            Texture2D tex = layer.prototype.maskMapTexture;
                                            Draw.Field(ref tex, "Mask");
                                            if (Cell.current.valChanged)
                                            {
                                                layer.prototype.maskMapTexture = tex;
                                            }
                                        }

                                        //color (after texture)
                                        if (layer.prototype.diffuseTexture == null)
                                        {
                                            layer.prototype.diffuseTexture      = TextureExtensions.ColorTexture(2, 2, layer.color);
                                            layer.prototype.diffuseTexture.name = "WrColorPlaceholder2x2";
                                        }

                                        if (layer.prototype.diffuseTexture.name == "WrColorPlaceholder2x2")
                                        {
                                            using (Cell.LineStd)
                                            {
                                                using (Cell.LineStd) Draw.Field(ref layer.color, "Color");
                                                if (Cell.current.valChanged)
                                                {
                                                    layer.prototype.diffuseTexture.Colorize(layer.color);
                                                }
                                            }
                                        }


                                        using (Cell.LineStd) layer.prototype.specular = Draw.Field(layer.prototype.specular, "Specular");
                                        using (Cell.LineStd) layer.prototype.smoothness = Draw.Field(layer.prototype.smoothness, "Smooth");
                                        using (Cell.LineStd) layer.prototype.metallic = Draw.Field(layer.prototype.metallic, "Metallic");
                                        using (Cell.LineStd) layer.prototype.normalScale = Draw.Field(layer.prototype.normalScale, "N. Scale");
                                    }

                            using (Cell.LineStd)
                                using (new Draw.FoldoutGroup(ref layer.guiTileSettings, "Tile Settings"))
                                    if (layer.guiTileSettings)
                                    {
                                        using (Cell.LineStd) layer.prototype.tileSize = Draw.Field(layer.prototype.tileSize, "Size");
                                        using (Cell.LineStd) layer.prototype.tileOffset = Draw.Field(layer.prototype.tileOffset, "Offset");
                                    }

                            if (layer.guiTileSettings)
                            {
                                Cell.EmptyLinePx(3);
                            }
                        }
                    }

                    /*using (UI.FoldoutGroup(ref layer.guiRemapping, "Remapping", inspectorOffset:0, margins:0))
                     * if (layer.guiTileSettings)
                     * {
                     *      using (Cell.LineStd)
                     *      {
                     *              Draw.Label("Red", cell:UI.Empty(Size.row));
                     *              layer.prototype.diffuseRemapMin.x = Draw.Field(layer.prototype.diffuseRemapMin.x, cell:UI.Empty(Size.row));
                     *      }
                     * }*/

                    Cell.EmptyRowPx(2);
                }
            }
        }
Esempio n. 9
0
        private static void DrawCTSLayer(Generator tgen, int num)
        {
            MegaSplatOutput200 gen = (MegaSplatOutput200)tgen;

            MegaSplatOutput200.MegaSplatLayer layer = gen.layers[num];
            if (layer == null)
            {
                return;
            }

                        #if __MEGASPLAT__
            MegaSplatTextureList textureList = GraphWindow.current.mapMagic?.globals.megaSplatTexList as MegaSplatTextureList;
                        #endif

            Cell.EmptyLinePx(3);
            using (Cell.LinePx(28))
            {
                //Cell.current.margins = new Padding(0,0,0,1); //1-pixel more padding from the bottom since layers are 1 pixel overlayed

                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                //icon
                Texture2DArray icon  = null;
                int            index = -2;

                Material material = null;
                if (GraphWindow.current.mapMagic != null)
                {
                    material = GraphWindow.current.mapMagic.terrainSettings.material;
                }

                if (material != null && material.HasProperty("_Diffuse"))
                {
                    icon = (Texture2DArray)material?.GetTexture("_Diffuse");
                }

                                #if __MEGASPLAT__
                if (textureList != null)
                {
                    //icon = textureList.clusters[num].previewTex; //preview textures doesnt seem to be working in recent versions
                    index = textureList.clusters[num].indexes[0];
                }
                                #endif

                using (Cell.RowPx(28))
                {
                    if (icon != null && index >= 0)
                    {
                        Draw.TextureIcon(icon, index);
                    }
                }

                //channel
                Cell.EmptyRowPx(3);
                using (Cell.Row)
                {
                    Cell.EmptyLine();
                    using (Cell.LineStd)
                    {
                        Cell.current.fieldWidth = 0.4f;
                                                #if __MEGASPLAT__
                        if (textureList != null)
                        {
                            Draw.PopupSelector(ref layer.channelNum, textureList.textureNames);
                        }
                        else
                        {
                            Draw.Field(ref layer.channelNum, "Channel");
                        }
                                                #else
                        Draw.Field(ref layer.channelNum, "Channel");
                                                #endif
                    }
                    Cell.EmptyLine();
                }

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
            Cell.EmptyLinePx(3);
        }
Esempio n. 10
0
        private static void DrawMicroSplatLayer(Generator tgen, int num)
        {
            MicroSplatOutput200 gen = (MicroSplatOutput200)tgen;

            MicroSplatOutput200.MicroSplatLayer layer = gen.layers[num];
            if (layer == null)
            {
                return;
            }

            Material microSplatMat = null;

            if (GraphWindow.current.mapMagic != null)
            {
                microSplatMat = GraphWindow.current.mapMagic.terrainSettings.material;
            }

            Cell.EmptyLinePx(3);
            using (Cell.LinePx(28))
            {
                //Cell.current.margins = new Padding(0,0,0,1); //1-pixel more padding from the bottom since layers are 1 pixel overlayed

                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                //icon
                Texture2DArray iconsArr = null;
                if (microSplatMat != null && microSplatMat.HasProperty("_Diffuse"))
                {
                    iconsArr = (Texture2DArray)microSplatMat?.GetTexture("_Diffuse");
                }

                using (Cell.RowPx(28))
                {
                    if (iconsArr != null)
                    {
                        Draw.TextureIcon(iconsArr, layer.channelNum);
                    }
                }

                Cell.EmptyRowPx(10);

                //index
                using (Cell.Row)
                {
                    Cell.EmptyLine();
                    using (Cell.LineStd)
                    {
                        int newIndex = Draw.Field(layer.channelNum, "Index");
                        if (newIndex >= 0 && (iconsArr == null || newIndex < iconsArr.depth))
                        {
                            layer.channelNum = newIndex;
                            layer.prototype  = null;
                        }
                    }
                    Cell.EmptyLine();
                }

                //terrain layer (if enabled)
                if (GraphWindow.current.mapMagic != null && GraphWindow.current.mapMagic.globals.microSplatApplyType != Globals.MicroSplatApplyType.Textures)               //no need to create layers for textures-only mode
                {
                    TerrainLayer tlayer = layer.prototype;
                    if (tlayer == null)
                    {
                        tlayer = new TerrainLayer(); layer.prototype = tlayer;
                    }
                    if (tlayer.diffuseTexture == null)
                    {
                        tlayer.diffuseTexture = iconsArr.GetTexture(num);
                    }
                }

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
            Cell.EmptyLinePx(3);
        }
Esempio n. 11
0
        public static void DrawCTSLayer(MatrixGenerators.CTSOutput200.CTSLayer layer, object[] arguments)
        {
            int num = (int)arguments[0];

            MatrixGenerators.CTSOutput200 gen = (MatrixGenerators.CTSOutput200)arguments[1];
            if (layer == null)
            {
                return;
            }

                        #if CTS_PRESENT
            CTS.CTSProfile profile = (CTS.CTSProfile)GraphWindow.current.mapMagic?.globals.ctsProfile;
                        #endif

            Cell.EmptyLinePx(3);
            using (Cell.LinePx(28))
            {
                //Cell.current.margins = new Padding(0,0,0,1); //1-pixel more padding from the bottom since layers are 1 pixel overlayed

                if (num != 0)
                {
                    using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen);
                }
                else
                //disconnecting last layer inlet
                if (GraphWindow.current.graph.IsLinked(layer))
                {
                    GraphWindow.current.graph.UnlinkInlet(layer);
                }

                Cell.EmptyRowPx(10);

                                #if CTS_PRESENT
                //icon
                using (Cell.RowPx(28))
                {
                    Texture2D icon = null;
                    if (profile != null)
                    {
                        List <CTS.CTSTerrainTextureDetails> textureDetails = profile.TerrainTextures;
                        if (layer.channelNum < textureDetails.Count)
                        {
                            icon = textureDetails[layer.channelNum].Albedo;
                        }
                    }
                    Draw.TextureIcon(icon);
                }

                //channel selector
                Cell.EmptyRowPx(5);
                using (Cell.Row)
                {
                    Cell.EmptyLine();
                    using (Cell.LineStd)
                    {
                        if (textureNames != null)
                        {
                            Draw.PopupSelector(ref layer.channelNum, textureNames);
                        }
                        else
                        {
                            Draw.Field(ref layer.channelNum, "Channel");
                        }
                    }
                    Cell.EmptyLine();
                }
                                #else
                using (Cell.Row) Draw.Field(ref layer.channelNum, "Channel");
                                #endif

                Cell.EmptyRowPx(10);
                using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer);
            }
            Cell.EmptyLinePx(3);
        }