Ejemplo n.º 1
0
 public SharpFacesTool()
 {
     inst = this;
 }
Ejemplo n.º 2
0
        public override string NameForDisplayPEGI() => MsgPainter.MeshPointPositionTool.GetText(); // "ADD & MOVE";

        public override bool Inspect()
        {
            var changed = false;

            var mgm = MeshMGMT;

            var sd = Cfg;

            var em = EditedMesh;

            "Mode".editEnum(40, ref _detectionMode).nl(ref changed);

            if (MeshEditorManager.MeshTool.ShowGrid)
            {
                "Snap to grid:".toggleIcon(ref sd.snapToGrid).nl(ref changed);

                if (sd.snapToGrid)
                {
                    "size:".edit(40, ref sd.gridSize).changes(ref changed);
                }
            }

            pegi.nl();

            "Pixel-Perfect".toggleIcon("New vertex will have UV coordinate rounded to half a pixel.", ref Cfg.pixelPerfectMeshEditing).nl(ref changed);

            "Insert vertices".toggleIcon("Will split triangles and edges by inserting vertices", ref _addToTrianglesAndLines).nl(ref changed);

            "Add Smooth:".toggleIcon(ref Cfg.newVerticesSmooth).nl(ref changed);

            if ("Sharp All".Click(ref changed))
            {
                foreach (var vr in EditedMesh.meshPoints)
                {
                    vr.smoothNormal = false;
                }

                EditedMesh.Dirty      = true;
                Cfg.newVerticesSmooth = false;
            }

            if ("Smooth All".Click().nl())
            {
                foreach (var vr in EditedMesh.meshPoints)
                {
                    vr.smoothNormal = true;
                }
                EditedMesh.Dirty      = true;
                Cfg.newVerticesSmooth = true;
            }

            "Add Unique:".toggleIcon(ref Cfg.newVerticesUnique).nl();

            if ("All shared if same UV".Click("Will only merge vertices if they have same UV").nl())
            {
                em.AllVerticesSharedIfSameUV();
                em.Dirty = true;
            }

            if ("All shared".Click())
            {
                em.AllVerticesShared();
                em.Dirty = true;
                Cfg.newVerticesUnique = false;
            }

            if ("All unique".Click().nl())
            {
                foreach (var t in EditedMesh.triangles)
                {
                    em.GiveTriangleUniqueVertices(t);
                }

                Cfg.newVerticesUnique = true;
            }

            if ("Auto Bevel".Click())
            {
                SharpFacesTool.AutoAssignDominantNormalsForBeveling();
            }
            "Sensitivity".edit(60, ref Cfg.bevelDetectionSensitivity, 3, 30).nl();

            pegi.nl();

            return(changed);
        }