Esempio n. 1
0
            public bool Inspect(IPainterManagerModuleBrush module)
            {
                var changed = false;

                Inspect();

                if (AllSetUp)
                {
                    var id          = InspectedImageMeta;
                    var cpuBlit     = id == null ? InspectedBrush.targetIsTex2D : id.destination == TexTarget.Texture2D;
                    var brushType   = InspectedBrush.GetBrushType(cpuBlit);
                    var blitMode    = InspectedBrush.GetBlitMode(cpuBlit);
                    var usingDecals = (!cpuBlit) && brushType.IsUsingDecals;

                    pegi.nl();

                    if (!cpuBlit)
                    {
                        MsgPainter.Hardness.GetText()
                        .edit("Makes edges more rough.", 70, ref InspectedBrush.hardness, 1f, 22f).nl(ref changed);
                    }

                    var txt = (usingDecals ? "Tint alpha" : MsgPainter.Speed.GetText());

                    txt.write(txt.ApproximateLengthUnsafe());

                    InspectedBrush._dSpeed.Inspect().nl(ref changed);

                    MsgPainter.Scale.Write();

                    if (InspectedBrush.IsA3DBrush(InspectedPainter))
                    {
                        var m = PlaytimePainter.inspected.GetMesh();

                        var maxScale = (m ? m.bounds.max.magnitude : 1) * (!PlaytimePainter.inspected
                                           ? 1
                                           : PlaytimePainter.inspected.transform.lossyScale.magnitude);

                        pegi.edit(ref InspectedBrush.brush3DRadius, 0.001f * maxScale, maxScale * 0.5f)
                        .changes(ref changed);
                    }
                    else
                    {
                        if (!brushType.IsPixelPerfect)
                        {
                            pegi.edit(ref InspectedBrush.brush2DRadius, cpuBlit ? 1 : 0.1f,
                                      usingDecals ? 128 : id?.width * 0.5f ?? 256).changes(ref changed);
                        }
                        else
                        {
                            var val = (int)InspectedBrush.brush2DRadius;
                            pegi.edit(ref val, (int)(cpuBlit ? 1 : 0.1f),
                                      (int)(usingDecals ? 128 : id?.width * 0.5f ?? 256)).changes(ref changed);
                            InspectedBrush.brush2DRadius = val;
                        }
                    }

                    pegi.nl();

                    if (blitMode.UsingSourceTexture && (id == null || id.TargetIsRenderTexture()))
                    {
                        MsgPainter.CopyFrom.GetText().selectOrAdd(70, ref InspectedBrush.selectedSourceTexture,
                                                                  ref TexMGMTdata.sourceTextures)
                        .nl(ref changed);
                    }
                }


                pegi.newLine();

                return(changed);
            }
Esempio n. 2
0
        public virtual bool PEGI()
        {
            ImageData id = InspectedImageData;

            bool      cpuBlit     = id == null ? InspectedBrush.TargetIsTex2D : id.destination == TexTarget.Texture2D;
            BrushType brushType   = InspectedBrush.Type(cpuBlit);
            bool      usingDecals = (!cpuBlit) && brushType.IsUsingDecals;

            bool changed = false;

            pegi.newLine();

            if ((!cpuBlit) && (!usingDecals))
            {
                changed |= "Hardness:".edit("Makes edges more rough.", 70, ref InspectedBrush.Hardness, 1f, 512f).nl();
            }

            changed |= (usingDecals ? "Tint alpha" : "Speed").edit(usingDecals ? 70 : 40, ref InspectedBrush.speed, 0.01f, 20).nl();

            pegi.write("Scale:", 40);

            if (InspectedBrush.IsA3Dbrush(InspectedPainter))
            {
                Mesh m = PlaytimePainter.inspectedPainter.GetMesh();

                float maxScale = (m != null ? m.bounds.max.magnitude : 1) * (PlaytimePainter.inspectedPainter == null ? 1 : PlaytimePainter.inspectedPainter.transform.lossyScale.magnitude);

                changed |= pegi.edit(ref InspectedBrush.Brush3D_Radius, 0.001f * maxScale, maxScale * 0.5f);
            }
            else
            {
                if (!brushType.IsPixelPerfect)
                {
                    changed |= pegi.edit(ref InspectedBrush.Brush2D_Radius, cpuBlit ? 1 : 0.1f, usingDecals ? 128 : (id != null ? id.width * 0.5f : 256));
                }
                else
                {
                    int val = (int)InspectedBrush.Brush2D_Radius;
                    changed |= pegi.edit(ref val, (int)(cpuBlit ? 1 : 0.1f), (int)(usingDecals ? 128 : (id != null ? id.width * 0.5f : 256)));
                    InspectedBrush.Brush2D_Radius = val;
                }
            }

            pegi.newLine();

            if ((InspectedBrush.BlitMode.UsingSourceTexture) && (id == null || id.TargetIsRenderTexture()))
            {
                if (TexMGMTdata.sourceTextures.Count > 0)
                {
                    pegi.write("Copy From:", 70);
                    changed |= pegi.selectOrAdd(ref InspectedBrush.selectedSourceTexture, ref TexMGMTdata.sourceTextures);
                }
                else
                {
                    "Add Textures to Render Camera to copy from".nl();
                }
            }

            pegi.newLine();

            return(changed);
        }