Beispiel #1
0
            public bool ComponentInspector()
            {
                if (!InspectedPainter)
                {
                    "No inspected Painter found".writeWarning();
                    return(false);
                }

                var vt = InspectedPainter.GetModule <VolumeTextureComponentModule>().volumeTexture;

                if (!vt)
                {
                    return(false);
                }

                var id = vt.ImageMeta;

                if (id == null)
                {
                    "Volume has no texture".writeWarning();
                    return(false);
                }

                return(true);
            }
Beispiel #2
0
            public override bool Inspect()
            {
                var changed = false;

                var br = InspectedBrush;

                if (InspectAdvanced || Cfg.useGridForBrush)
                {
                    "Paint On Grid".toggleIcon(ref Cfg.useGridForBrush, true).nl();
                }

                if (!br.useAlphaBuffer && (br.worldSpaceBrushPixelJitter || InspectAdvanced))
                {
                    "One Pixel Jitter".toggleIcon(ref br.worldSpaceBrushPixelJitter).changes(ref changed);
                    "Will provide a single pixel jitter which can help fix seams not being painted properly"
                    .fullWindowDocumentationClickOpen("Why use one pixel jitter?");
                    pegi.nl();
                }

                if (InspectedPainter && !InspectedPainter.GetMesh())
                {
                    "No mesh for sphere painting detected.".writeWarning();
                }

                base.Inspect().nl(ref changed);

                return(changed);
            }
Beispiel #3
0
            public override bool Inspect()
            {
                var changed = false;

                var br = InspectedBrush;

                bool suggestGrid = false;

                if (InspectedPainter && !InspectedPainter.GetMesh())
                {
                    if (!Cfg.useGridForBrush)
                    {
                        "No mesh for sphere painting detected.".writeWarning();
                        suggestGrid = true;
                    }
                }

                if (InspectAdvanced || Cfg.useGridForBrush || suggestGrid)
                {
                    (Cfg.useGridForBrush
                        ? ("Grid: Z, X - change plane " + Environment.NewLine + " Ctrl+LMB - reposition GRID")
                        : "Paint On Grid").toggleIcon(ref Cfg.useGridForBrush).nl();

                    pegi.line();
                    pegi.nl();
                }

                if (!br.useAlphaBuffer && (br.worldSpaceBrushPixelJitter || InspectAdvanced))
                {
                    "One Pixel Jitter".toggleIcon(ref br.worldSpaceBrushPixelJitter).changes(ref changed);
                    "Will provide a single pixel jitter which can help fix seams not being painted properly"
                    .fullWindowDocumentationClickOpen("Why use one pixel jitter?");
                    pegi.nl();
                }



                base.Inspect().nl(ref changed);

                return(changed);
            }
        public bool Component_PEGI()
        {
            bool changed = false;

            if (buffers.Count > 0)
            {
                if ((pauseBuffers ? icon.Play : icon.Pause).Click("Stop/Start ALL"))
                {
                    pauseBuffers = !pauseBuffers;
                }

                int cur = -1;
                if ("Buffers".select(60, ref cur, buffers, (x) => x.CanBeAssignedToPainter).nl())
                {
                    changed = true;
                    InspectedPainter.SetTextureOnMaterial(buffers.TryGet(cur).GetTextureDisplay());
                }
            }

            return(changed);
        }
Beispiel #5
0
            protected override bool Inspect()
            {
                bool changed = base.Inspect();

                if (!InspectedPainter)
                {
                    return(changed);
                }

                pegi.newLine();

                "Mask Size: ".edit(60, ref Cfg.samplingMaskSize).nl(ref changed);

                Cfg.samplingMaskSize.Clamp(1, 512);

                "Color Set On".editEnum(ref method).nl(ref changed);

                if (method == ColorSetMethod.Manual)
                {
                    "CurrentPixel".edit(80, ref currentPixel).nl(ref changed);

                    currentPixel.Clamp(-Cfg.samplingMaskSize.Max, Cfg.samplingMaskSize.Max * 2);
                }

                var id = InspectedImageMeta;

                if (id != null)
                {
                    if ("Set Tiling Offset".Click(ref changed))
                    {
                        id.tiling = Vector2.one * 1.5f;
                        id.offset = -Vector2.one * 0.25f;
                        InspectedPainter.UpdateTilingToMaterial();
                    }

                    if (InspectedPainter != null && "Generate Default".Click().nl(ref changed))
                    {
                        var pix = id.Pixels;

                        int dx = id.width / Cfg.samplingMaskSize.x;
                        int dy = id.height / Cfg.samplingMaskSize.y;

                        for (currentPixel.x = 0; currentPixel.x < Cfg.samplingMaskSize.x; currentPixel.x++)
                        {
                            for (currentPixel.y = 0; currentPixel.y < Cfg.samplingMaskSize.y; currentPixel.y++)
                            {
                                float center_uv_x = ((float)currentPixel.x + 0.5f) / (float)Cfg.samplingMaskSize.x;
                                float center_uv_y = ((float)currentPixel.y + 0.5f) / (float)Cfg.samplingMaskSize.y;

                                int startX = currentPixel.x * dx;

                                for (int suby = 0; suby < dy; suby++)
                                {
                                    int y     = (currentPixel.y * dy + suby);
                                    int start = y * id.width + startX;

                                    float offy = (center_uv_y - ((float)y / (float)id.height)) / 2f + 0.5f;

                                    for (int subx = 0; subx < dx; subx++)
                                    {
                                        int ind = start + subx;

                                        float offx = (center_uv_x - ((float)(startX + subx) / (float)id.width)) / 2f +
                                                     0.5f;

                                        pix[ind].r = offx;
                                        pix[ind].g = offy;
                                    }
                                }
                            }
                        }

                        id.SetAndApply();
                        if (!id.TargetIsTexture2D())
                        {
                            id.Texture2D_To_RenderTexture();
                        }
                    }
                }

                pegi.newLine();

                return(changed);
            }
Beispiel #6
0
        public override bool ConfigTab_PEGI()
        {
            bool changed = false;

            if (InspectedPainter.IsAtlased())
            {
                "***** Selected Material Atlased *****".nl();
#if UNITY_EDITOR
                var m = InspectedPainter.GetMesh();
                if (m != null && AssetDatabase.GetAssetPath(m).Length == 0)
                {
                    "Atlased Mesh is not saved".nl();
                    var n = m.name;
                    if ("Mesh Name".edit(80, ref n))
                    {
                        m.name = n;
                    }
                    if (icon.Save.Click().nl())
                    {
                        InspectedPainter.SaveMesh();
                    }
                }
#endif


                var atlPlug = InspectedPainter.GetPlugin <TileableAtlasingPainterPlugin>();

                if ("Undo Atlasing".Click())
                {
                    InspectedPainter.meshRenderer.sharedMaterials = atlPlug.preAtlasingMaterials;

                    if (atlPlug.preAtlasingMesh != null)
                    {
                        InspectedPainter.meshFilter.mesh = atlPlug.preAtlasingMesh;
                    }
                    InspectedPainter.SavedEditableMesh = atlPlug.preAtlasingSavedMesh;

                    atlPlug.preAtlasingMaterials = null;
                    atlPlug.preAtlasingMesh      = null;
                    InspectedPainter.meshRenderer.sharedMaterial.DisableKeyword(PainterDataAndConfig.UV_ATLASED);
                }

                if ("Not Atlased".Click().nl())
                {
                    atlPlug.preAtlasingMaterials = null;
                    InspectedPainter.meshRenderer.sharedMaterial.DisableKeyword(PainterDataAndConfig.UV_ATLASED);
                }

                pegi.newLine();
            }
            else if ("Atlased Materials".foldout(ref showAtlasedMaterial).nl())
            {
                showAtlases = false;
                changed    |= atlasedMaterials.edit_List(ref InspectedPainter.selectedAtlasedMaterial, true).nl();
            }

            if ("Atlases".foldout(ref showAtlases))
            {
                if ((browsedAtlas > -1) && (browsedAtlas >= atlases.Count))
                {
                    browsedAtlas = -1;
                }

                pegi.newLine();

                atlases.edit_List(ref browsedAtlas, true);
            }

            return(changed);
        }
Beispiel #7
0
        public virtual bool PEGI()
        {
            bool change = false;

            pegi.newLine();

            if (BrushConfig.InspectedIsCPUbrush)
            {
                return(change);
            }

            if (TexMGMTdata.masks.Count > 0)
            {
                pegi.Space();
                pegi.newLine();

                change |= pegi.toggle(ref InspectedBrush.useMask, "Mask", "Multiply Brush Speed By Mask Texture's alpha", 40);

                if (InspectedBrush.useMask)
                {
                    pegi.selectOrAdd(ref InspectedBrush.selectedSourceMask, ref TexMGMTdata.masks);

                    pegi.newLine();

                    if (!InspectedBrush.randomMaskOffset)
                    {
                        pegi.write("Mask Offset: ", 70);

                        change |= pegi.edit(ref InspectedBrush.maskOffset);

                        pegi.newLine();
                    }

                    pegi.write("Random Mask Offset");

                    change |= pegi.toggle(ref InspectedBrush.randomMaskOffset);

                    pegi.newLine();

                    pegi.write("Mask Tiling: ", 70);

                    if (pegi.edit(ref InspectedBrush.maskTiling, 1, 8))
                    {
                        InspectedBrush.maskTiling = Mathf.Clamp(InspectedBrush.maskTiling, 0.1f, 64);
                        change = true;
                    }

                    pegi.newLine();

                    change |= pegi.toggle(ref InspectedBrush.flipMaskAlpha, "Flip Mask Alpha", "Alpha = 1-Alpha");

                    pegi.newLine();
                }
            }
            //   else { pegi.writeHint("Assign some Masks to Painter Camera"); pegi.newLine(); }

            if (InspectedPainter.NeedsGrid() && "Center Grid".Click().nl())
            {
                GridNavigator.onGridPos = InspectedPainter.transform.position;
            }

            return(change);
        }