Example #1
0
        public static void DrawMegaSplat(MatrixGenerators.MegaSplatOutput200 gen)
        {
                        #if !__MEGASPLAT__
            using (Cell.LinePx(60))
                Draw.Helpbox("MicroSplat doesn't seem to be installed, or MicroSplat compatibility is not enabled in settings");
                        #endif
            if (GraphWindow.current.mapMagic != null)
            {
                using (Cell.LineStd)
                {
                    GeneratorDraw.DrawGlobalVar(ref GraphWindow.current.mapMagic.terrainSettings.material, "Material");

                    if (Cell.current.valChanged)
                    {
                        GraphWindow.current.mapMagic.ApplyTerrainSettings();
                    }
                }

                using (Cell.LineStd)
                {
                                        #if __MEGASPLAT__
                    MegaSplatTextureList texList = GraphWindow.current.mapMagic.globals.megaSplatTexList as MegaSplatTextureList;
                    GeneratorDraw.DrawGlobalVar(ref texList, "TexList");
                    GraphWindow.current.mapMagic.globals.megaSplatTexList = texList;
                                        #endif
                }
            }

            using (Cell.LinePx(0)) CheckShader(gen);
        }
Example #2
0
        public static void DrawMegaSplatLayer(MatrixGenerators.MegaSplatOutput200.MegaSplatLayer layer, object[] arguments)
        {
            int num = (int)arguments[0];

            MatrixGenerators.MegaSplatOutput200 gen = (MatrixGenerators.MegaSplatOutput200)arguments[1];
            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);
        }