Example #1
0
        public override bool MouseEventPointedVertex()
        {
            MeshManager m = MeshMGMT;

            BrushConfig bcf = GlobalBrush;

            //if (EditorInputManager.GetMouseButtonDown(1))
            //  m.pointedUV.vert.clearColor(cfg.brushConfig.mask);

            if ((EditorInputManager.GetMouseButtonDown(0)))
            {
                if (EditorInputManager.getControlKey())
                {
                    bcf.mask.Transfer(ref m.PointedUV._color, bcf.colorLinear.ToGamma());
                }

                else
                {
                    foreach (Vertex uvi in m.PointedUV.meshPoint.uvpoints)
                    {
                        bcf.mask.Transfer(ref uvi._color, Cfg.brushConfig.colorLinear.ToGamma());
                    }
                }

                m.edMesh.dirty_Color = true;
            }

            return(false);
        }
Example #2
0
        public override bool MouseEventPointedVertex()
        {
            if (EditorInputManager.GetMouseButtonDown(0))
            {
                MeshMGMT.AssignSelected(PointedUv); //pointedUV.editedUV = meshMGMT.selectedUV.editedUV;
                _lastCalculatedUv = PointedUv.EditedUv;
                MeshMGMT.Dragging = true;
            }

            /*
             * if (EditorInputManager.GetMouseButtonDown(0))
             * {
             *  if ((meshMGMT.selectedUV != null) && (meshMGMT.pointedUV != null))
             *  {
             *      meshMGMT.pointedUV.editedUV = meshMGMT.selectedUV.editedUV;
             *      mesh.dirty = true;
             *  }
             * }
             *
             * if ((EditorInputManager.GetMouseButtonDown(1)) && (meshMGMT.pointedUV != null) && (UVnavigator.inst() != null))
             *  UVnavigator.inst().CenterOnUV(meshMGMT.pointedUV.editedUV);
             */
            /*
             * if (ProjectionUV && EditorInputManager.GetMouseButton(0)) {
             * Vector3 trgPos = meshMGMT.target.transform.position;
             * float portion = 1f / Mathf.Max(0.01f, MeshUVprojectionSize);
             *
             * Vector2 nuv = PosToUV((vertex.worldPos - trgPos) * portion);
             *
             * for (int i = 0; i < vertex.shared_v2s.Count; i++)
             *  vertex.shared_v2s[i][meshMGMT.editedUV] = nuv;
             * }
             */
            return(false);
        }
Example #3
0
        public override bool MouseEventPointedTriangle()
        {
            var m = MeshMGMT;

            if (EditorInputManager.GetMouseButtonDown(0))
            {
                m.Dragging              = true;
                originalPosition        = GridNavigator.collisionPos;
                GridNavigator.onGridPos = GridNavigator.collisionPos;
                draggedVertices.Clear();
                foreach (var uv in PointedTris.vertexes)
                {
                    draggedVertices.Add(uv.meshPoint);
                }
            }

            if (addToTrianglesAndLines && EditorInputManager.GetMouseButtonUp(0) && m.dragDelay > 0 && draggedVertices.Contains(PointedTris))
            {
                if (Cfg.newVerticesUnique)
                {
                    m.edMesh.InsertIntoTriangleUniqueVerticles(m.PointedTris, m.collisionPosLocal);
                }
                else
                {
                    m.edMesh.InsertIntoTriangle(m.PointedTris, m.collisionPosLocal);
                }
            }



            return(false);
        }
Example #4
0
 public override void MouseEventPointedNothing()
 {
     if (EditorInputManager.GetMouseButtonDown(0))
     {
         MeshMGMT.AddPoint(MeshMGMT.onGridLocal);
     }
 }
Example #5
0
    public void FeedEvent(Event e)
    {
        if (!rendy || !rendy.enabled)
        {
            return;
        }

        if (e.isMouse)
        {
            UpdatePositions();
        }

        if (e.type == EventType.ScrollWheel)
        {
            ScrollsProcess(e.delta.y);
            UpdatePositions();
            e.Use();
        }

        if (EditorInputManager.GetMouseButtonDown(2))
        {
            RaycastHit hit;
            if (Physics.Raycast(EditorInputManager.GetScreenRay(), out hit))
            {
                onGridPos = hit.point;
            }
        }
    }
Example #6
0
        public override bool MouseEventPointedLine()
        {
            var m = MeshMGMT;

            if (EditorInputManager.GetMouseButtonDown(0))
            {
                m.Dragging              = true;
                originalPosition        = GridNavigator.collisionPos;
                GridNavigator.onGridPos = GridNavigator.collisionPos;
                draggedVertices.Clear();
                foreach (var uv in PointedLine.pnts)
                {
                    draggedVertices.Add(uv.meshPoint);
                }
            }

            if (EditorInputManager.GetMouseButtonUp(0))
            {
                if (addToTrianglesAndLines && m.dragDelay > 0 && draggedVertices.Contains(PointedLine))
                {
                    MeshMGMT.edMesh.InsertIntoLine(MeshMGMT.PointedLine.pnts[0].meshPoint, MeshMGMT.PointedLine.pnts[1].meshPoint, MeshMGMT.collisionPosLocal);
                }
            }

            return(false);
        }
Example #7
0
 public override void MouseEventPointedNothing()
 {
     if (_addToTrianglesAndLines && EditorInputManager.GetMouseButtonDown(0))
     {
         MeshMGMT.CreatePointAndFocus(MeshMGMT.onGridLocal);
     }
 }
Example #8
0
        public override bool MouseEventPointedTriangle()
        {
            if (EditorInputManager.GetMouseButtonDown(0) && EditorInputManager.Control)
            {
                _curSubMesh = MeshMGMT.PointedTriangle.subMeshIndex;
#if PEGI
                ("SubMesh " + _curSubMesh).showNotificationIn3D_Views();
#endif
            }

            if (!EditorInputManager.GetMouseButton(0) || EditorInputManager.Control ||
                (MeshMGMT.PointedTriangle.subMeshIndex == _curSubMesh))
            {
                return(false);
            }

            if (PointedTriangle.SameAsLastFrame)
            {
                return(true);
            }

            MeshMGMT.PointedTriangle.subMeshIndex = _curSubMesh;
            EditedMesh.subMeshCount = Mathf.Max(MeshMGMT.PointedTriangle.subMeshIndex + 1, EditedMesh.subMeshCount);
            EditedMesh.Dirty        = true;

            return(true);
        }
Example #9
0
        public override bool MouseEventPointedVertex()
        {
            var m = MeshMGMT;

            var bcf = GlobalBrush;

            //if (EditorInputManager.GetMouseButtonDown(1))
            //  m.pointedUV.vert.clearColor(cfg.brushConfig.mask);

            if ((EditorInputManager.GetMouseButtonDown(0)))
            {
                if (EditorInputManager.Control)
                {
                    bcf.mask.SetValuesOn(ref m.PointedUv.color, bcf.Color);
                }

                else
                {
                    foreach (var uvi in m.PointedUv.meshPoint.vertices)
                    {
                        bcf.mask.SetValuesOn(ref uvi.color, Cfg.brushConfig.Color);
                    }
                }

                EditedMesh.dirtyColor = true;
            }

            return(false);
        }
Example #10
0
        public void FeedEvent(Event e)
        {
            if (!rendy || !rendy.enabled)
            {
                return;
            }

            if (e.isMouse)
            {
                UpdatePositions();
            }


            if (e.type == EventType.KeyDown)
            {
                bool isHorisontal = e.keyCode == verticalPlanesKey;

                if (isHorisontal || e.keyCode == horisontalPlaneKey)
                {
                    ScrollsProcess(isHorisontal ? 1 : -1);
                    UpdatePositions();
                    e.Use();
                }
            }

            if (EditorInputManager.GetMouseButtonDown(2))
            {
                RaycastHit hit;
                if (Physics.Raycast(EditorInputManager.GetScreenMousePositionRay(TexMGMT.MainCamera), out hit))
                {
                    onGridPos = hit.point;
                }
            }
        }
Example #11
0
        void ProcessPointOnALine(Vertex a, Vertex b, Triangle t)
        {
            if (EditorInputManager.GetMouseButtonDown(1))
            {
                SelectedLine = new LineData(t, a, b);
                UpdateLocalSpaceV3s();
            }

            PointedLine = new LineData(t, new Vertex[] { a, b });
        }
Example #12
0
        private void ProcessPointOnALine(PainterMesh.Vertex a, PainterMesh.Vertex b, PainterMesh.Triangle t)
        {
            if (EditorInputManager.GetMouseButtonDown(1))
            {
                SelectedLine = new PainterMesh.LineData(t, a, b);
                UpdateLocalSpaceMousePosition();
            }

            PointedLine = new PainterMesh.LineData(t, new[] { a, b });
        }
Example #13
0
        void ProcessPointOnALine(Vertex a, Vertex b, Triangle t)
        {
            if (EditorInputManager.GetMouseButtonDown(1))
            {
                updated = false;

                if (QuickMeshFunctions.Path.Selected())
                {
                    SetPathStart();
                }
            }
        }
Example #14
0
        public override bool MouseEventPointedVertex()
        {
            if (EditorInputManager.GetMouseButtonDown(0))
            {
                var m = MeshMGMT;

                m.Dragging = true;
                m.AssignSelected(m.PointedUV);
                originalPosition = PointedUV.meshPoint.WorldPos;
                draggedVertices.Clear();
                draggedVertices.Add(PointedUV.meshPoint);
            }

            return(false);
        }
Example #15
0
        private void GetPointedTriangleOrLine()
        {
            editedMesh.TagTrianglesUnprocessed();

            UpdateLocalSpaceMousePosition();

            foreach (var t1 in editedMesh.meshPoints)
            {
                foreach (var uv in t1.vertices)
                {
                    foreach (var t in uv.triangles)
                    {
                        if (!t.wasProcessed)
                        {
                            t.wasProcessed = true;

                            if (!t.PointOnTriangle())
                            {
                                continue;
                            }

                            if (EditorInputManager.GetMouseButtonDown(0))
                            {
                                SelectedTriangle = t;
                                AssignSelected(t.GetClosestTo(collisionPosLocal));
                            }

                            PointedTriangle = t;

                            if (MeshTool.ShowLines)
                            {
                                ProcessLinesOnTriangle(PointedTriangle);
                            }

                            return;
                        }
                    }
                }
            }
        }
Example #16
0
        void GetPointedTRIANGLESorLINE()
        {
            edMesh.TagTrianglesUnprocessed();

            UpdateLocalSpaceV3s();

            for (int i = 0; i < edMesh.meshPoints.Count; i++)
            {
                foreach (Vertex uv in edMesh.meshPoints[i].uvpoints)
                {
                    foreach (Triangle t in uv.tris)
                    {
                        if (!t.wasProcessed)
                        {
                            //	Debug.Log ("Browsing");
                            t.wasProcessed = true;
                            if (t.PointOnTriangle())
                            {
                                if (EditorInputManager.GetMouseButtonDown(0))
                                {
                                    SelectedTris = t;
                                    AssignSelected(t.GetClosestTo(collisionPosLocal));
                                }

                                PointedTris = t;

                                if (MeshTool.ShowLines)
                                {
                                    ProcessLinesOnTriangle(PointedTris);
                                }

                                return;
                            }
                        }
                    }
                }
            }
        }
Example #17
0
        public override bool MouseEventPointedTriangle()
        {
            if (EditorInputManager.GetMouseButtonDown(0) && EditorInputManager.getControlKey())
            {
                curSubmesh = (int)MeshMGMT.PointedTris.submeshIndex;
#if !NO_PEGI
                ("Submesh " + curSubmesh).showNotification();
#endif
            }

            if (EditorInputManager.GetMouseButton(0) && !EditorInputManager.getControlKey() && (MeshMGMT.PointedTris.submeshIndex != curSubmesh))
            {
                if (PointedTris.SameAsLastFrame)
                {
                    return(true);
                }
                MeshMGMT.PointedTris.submeshIndex = curSubmesh;
                EditedMesh.submeshCount           = Mathf.Max(MeshMGMT.PointedTris.submeshIndex + 1, EditedMesh.submeshCount);
                EditedMesh.Dirty = true;
                return(true);
            }
            return(false);
        }
Example #18
0
        private void ProcessMouseActions()
        {
            PointedTriangle = null;
            PointedLine     = null;

            var pointingUv = RayCastVertexIsPointed();

            if (_dragging)
            {
                MeshTool.ManageDragging();
            }

            if (!_dragging)
            {
                if (pointingUv && _currentUv <= editedMesh.meshPoints[0].vertices.Count)
                {
                    var pointedVx = editedMesh.meshPoints[0];

                    if (_currentUv == pointedVx.vertices.Count)
                    {
                        _currentUv--;
                    }

                    if ((SelectedUv != null) && (SelectedUv.meshPoint == pointedVx) && (!_selectingUVbyNumber))
                    {
                        PointedUv = SelectedUv;
                    }
                    else
                    {
                        PointedUv = pointedVx.vertices[_currentUv];
                    }

                    if (EditorInputManager.GetMouseButtonDown(0))
                    {
                        AssignSelected(PointedUv);
                    }
                }

                var t = MeshTool;

                if (t.ShowVertices && PointedUv != null)
                {
                    if (t.MouseEventPointedVertex())
                    {
                        EditedMesh.SetLastPointed(PointedUv);
                    }
                    else
                    {
                        EditedMesh.ClearLastPointed();
                    }
                }
                else if (t.ShowLines && PointedLine != null)
                {
                    if (t.MouseEventPointedLine())
                    {
                        EditedMesh.SetLastPointed(PointedLine);
                    }
                    else
                    {
                        EditedMesh.ClearLastPointed();
                    }
                }
                else if (t.ShowTriangles && PointedTriangle != null)
                {
                    if (t.MouseEventPointedTriangle())
                    {
                        EditedMesh.SetLastPointed(PointedTriangle);
                    }
                    else
                    {
                        EditedMesh.ClearLastPointed();
                    }
                }
                else
                {
                    t.MouseEventPointedNothing();
                    EditedMesh.ClearLastPointed();
                }
            }
        }
Example #19
0
        void RAYCAST_SELECT_MOUSEedit()
        {
            PointedTris = null;
            PointedLine = null;

            bool pointingUV = Raycast_VertexIsPointed();

            if (_dragging)
            {
                MeshTool.ManageDragging();
            }

            if (!_dragging)
            {
                if ((pointingUV) && (currentUV <= edMesh.meshPoints[0].uvpoints.Count))
                {
                    var pointedVX = edMesh.meshPoints[0];

                    if (currentUV == pointedVX.uvpoints.Count)
                    {
                        currentUV--;
                    }

                    if ((SelectedUV != null) && (SelectedUV.meshPoint == pointedVX) && (!SelectingUVbyNumber))
                    {
                        PointedUV = SelectedUV;
                    }
                    else
                    {
                        PointedUV = pointedVX.uvpoints[currentUV];
                    }

                    if (EditorInputManager.GetMouseButtonDown(0))
                    {
                        AssignSelected(PointedUV);
                    }
                }

                MeshToolBase t = MeshTool;

                if ((t.ShowVertices) && (PointedUV != null))
                {
                    if (t.MouseEventPointedVertex())
                    {
                        EditedMesh.SetLastPointed(PointedUV);
                    }
                    else
                    {
                        EditedMesh.ClearLastPointed();
                    }
                }
                else if ((t.ShowLines) && (PointedLine != null))
                {
                    if (t.MouseEventPointedLine())
                    {
                        EditedMesh.SetLastPointed(PointedLine);
                    }
                    else
                    {
                        EditedMesh.ClearLastPointed();
                    }
                }
                else if ((t.ShowTriangles) && (PointedTris != null))
                {
                    if (t.MouseEventPointedTriangle())
                    {
                        EditedMesh.SetLastPointed(PointedTris);
                    }
                    else
                    {
                        EditedMesh.ClearLastPointed();
                    }
                }
                else
                {
                    t.MouseEventPointedNothing();
                    EditedMesh.ClearLastPointed();
                }
            }
        }