コード例 #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);
        }
コード例 #2
0
        public bool PEGI()
        {
            bool changed = false;

            EditableMesh.inspected = edMesh;

            pegi.newLine();

            if (edMesh != null)
            {
                if ("Mesh ".foldout(ref inspectMesh).nl())
                {
                    changed |= edMesh.Nested_Inspect().nl();
                }
            }
            pegi.Space();

            pegi.newLine();

            changed |= target.PreviewShaderToggle_PEGI();

            if ((!target.IsOriginalShader) && ("preview".select(45, ref meshSHaderMode.selected, meshSHaderMode.allModes).nl()))
            {
                meshSHaderMode.selected.Apply();
            }

            pegi.Space();

            pegi.newLine();

            var previousTool = MeshTool;

            if ("tool".select(70, ref Cfg._meshTool, MeshToolBase.AllTools).nl())
            {
                Grid.vertexPointMaterial.SetColor("_Color", MeshTool.VertColor);
                previousTool.OnDeSelectTool();
                MeshTool.OnSelectTool();
            }

            pegi.Space();

            pegi.newLine();

            "Mesh Name:".edit(70, ref target.meshNameHolder);

#if UNITY_EDITOR
            if (((AssetDatabase.GetAssetPath(target.GetMesh()).Length == 0) || (String.Compare(target.meshNameHolder, target.GetMesh().name) != 0)) &&
                (icon.Save.Click("Save Mesh As {0}".F(target.GenerateMeshSavePath()), 25).nl()))
            {
                target.SaveMesh();
            }
#endif

            pegi.newLine();

            pegi.nl();

            MeshTool.PEGI();

            pegi.newLine();

            if ("Hint".foldout(ref showTooltip).nl())
            {
                pegi.writeHint(MeshTool.Tooltip);
            }

            if ("Merge Meshes".foldout(ref showCopyOptions).nl())
            {
                if (!selectedPainters.Contains(target))
                {
                    if ("Copy Mesh".Click("Add Mesh to the list of meshes to be merged").nl())
                    {
                        selectedPainters.Add(target);
                    }

                    if (selectedPainters.Count > 0)
                    {
                        if (edMesh.UV2distributeRow < 2 && "Enable EV2 Distribution".toggleInt("Each mesh's UV2 will be modified to use a unique portion of a texture.", ref edMesh.UV2distributeRow).nl())
                        {
                            edMesh.UV2distributeRow = Mathf.Max(2, (int)Mathf.Sqrt(selectedPainters.Count));
                        }
                        else
                        {
                            if (edMesh.UV2distributeCurrent > 0)
                            {
                                ("All added meshes will be distributed in " + edMesh.UV2distributeRow + " by " + edMesh.UV2distributeRow + " grid. By cancelling this added" +
                                 "meshes will have UVs unchanged and may use the same portion of Texture (sampled with UV2) as other meshes.").writeHint();
                                if ("Cancel Distribution".Click().nl())
                                {
                                    edMesh.UV2distributeRow = 0;
                                }
                            }
                            else
                            {
                                "Row:".edit("Will change UV2 so that every mesh will have it's own portion of a texture.", 25, ref edMesh.UV2distributeRow, 2, 16).nl();
                                "Start from".edit(ref edMesh.UV2distributeCurrent).nl();
                            }
                            pegi.write("Using " + (edMesh.UV2distributeCurrent + selectedPainters.Count + 1) + " out of " + (edMesh.UV2distributeRow * edMesh.UV2distributeRow).ToString() + " spots");
                            pegi.newLine();
                        }

                        "Will Merge with the following:".nl();
                        for (int i = 0; i < selectedPainters.Count; i++)
                        {
                            if (selectedPainters[i] == null)
                            {
                                selectedPainters.RemoveAt(i);
                                i--;
                            }
                            else
                            {
                                if (icon.Delete.Click(25))
                                {
                                    selectedPainters.RemoveAt(i);
                                    i--;
                                }
                                else
                                {
                                    selectedPainters[i].gameObject.name.nl();
                                }
                            }
                        }

                        if ("Merge!".Click().nl())
                        {
                            foreach (var p in selectedPainters)
                            {
                                edMesh.MergeWith(p);
                            }

                            edMesh.Dirty = true;
                        }
                    }
                }
                else
                {
                    if ("Remove from Copy Selection".Click().nl())
                    {
                        selectedPainters.Remove(target);
                    }
                }
            }



            pegi.newLine();

            Grid.vertexPointMaterial.SetColor("_Color", MeshTool.VertColor);

            if ((!Application.isPlaying) && ("references".foldout(ref showReferences).nl()))
            {
                "vertexPointMaterial".write(Grid.vertexPointMaterial);
                pegi.newLine();

                "vertexPrefab".edit(ref Grid.vertPrefab).nl();
                "Max Vert Markers ".edit(ref vertsShowMax).nl();
                "pointedVertex".edit(ref Grid.pointedVertex.go).nl();
                "SelectedVertex".edit(ref Grid.selectedVertex.go).nl();
            }

            EditableMesh.inspected = null;

            return(changed);
        }