Ejemplo n.º 1
0
        public virtual bool PEGI()
        {
            PlaytimePainter p = PlaytimePainter.inspectedPainter;

            if (p == null)
            {
                "No Painter Detected".nl(); return(false);
            }



            if ((p.skinnedMeshRendy != null) && (pegi.Click("Update Collider from Skinned Mesh")))
            {
                p.UpdateColliderForSkinnedMesh();
            }
            pegi.newLine();


            ImageData id = p.ImgData;

            bool changed = false;
            bool cpuBlit = id.destination == TexTarget.Texture2D;

            pegi.newLine();

            changed |= p.PreviewShaderToggle_PEGI();

            if ((PainterCamera.GotBuffers() || (id.renderTexture != null)) && (id.texture2D != null))
            {
                if ((cpuBlit ? icon.CPU : icon.GPU).Click(
                        cpuBlit ? "Switch to Render Texture" : "Switch to Texture2D", 45))
                {
                    p.UpdateOrSetTexTarget(cpuBlit ? TexTarget.RenderTexture : TexTarget.Texture2D);
                    SetSupportedFor(cpuBlit, id.renderTexture == null);
                    changed = true;
                }
            }


            if (cpuBlit)
            {
                bool smooth = _type(cpuBlit) != BrushTypePixel.Inst.index;

                if (pegi.toggle(ref smooth, icon.Round, icon.Square, "Smooth/Pixels Brush", 45))
                {
                    changed = true;
                    TypeSet(cpuBlit, smooth ? (BrushType)BrushTypeNormal.Inst : (BrushType)BrushTypePixel.Inst);
                }
            }

            pegi.newLine();
#if UNITY_EDITOR
            if (Tools.current != Tool.None)
            {
                Msg.LockToolToUseTransform.Get().writeWarning();
                if (Msg.HideTransformTool.Get().Click().nl())
                {
                    PlaytimePainter.HideUnityTool();
                }
            }
#endif

            if                    //(
            (!p.IsOriginalShader) // && (cfg.moreOptions))
            {
                changed |= pegi.toggle(ref Cfg.previewAlphaChanel, "Preview Enabled Chanels", 130);
            }



            if (Mode_Type_PEGI())
            {
                if (Type(cpuBlit) == BrushTypeDecal.Inst)
                {
                    MaskSet(BrushMask.A, true);
                }

                changed = true;
            }

            if (p.terrain != null)
            {
                if ((p.ImgData != null) && ((p.IsTerrainHeightTexture())) && (p.IsOriginalShader))
                {
                    pegi.writeWarning(" You need to use Preview Shader to see changes");
                }

                pegi.newLine();

                if ((p.terrain != null) && (pegi.Click("Update Terrain").nl()))
                {
                    p.UpdateShaderGlobals();
                }
            }

            return(changed);
        }