Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
0
 public static void TexturesGeneratorEditor(TexturesOutput200 gen)
 {
     using (Cell.LinePx(20)) GeneratorDraw.DrawLayersAddRemove(gen, ref gen.layers, inversed: true);
     using (Cell.LinePx(0)) GeneratorDraw.DrawLayersThemselves(gen, gen.layers, inversed: true, layerEditor: DrawTexturesLayer);
 }