예제 #1
0
    public void EndSelection()
    {
        if (isSelecting)
        {
            isSelecting   = false;
            image.enabled = false;

            foreach (ISelectable point in MeshEdit.selMesh.GetAllPoints())
            {
                Vector2 screenPos = Camera.main.WorldToScreenPoint(point.Pos);
                Rect    test      = CornersToRect();
                if (test.Contains(screenPos))
                {
                    point.Selected = true;
                }
            }
            transformGizmo.SetPositionAuto();
            transformGizmo.OnSelectionChange();
            MeshEdit.SaveUndoState();
        }
    }
예제 #2
0
    void Update()
    {
        //Handle Box Selection Input:
        bool boxSelectArmedFinal = Input.GetKey(KeyCode.LeftAlt) || boxSelectArmed;

        ui.RECT_BOXSELECT.gameObject.SetActive(boxSelectArmedFinal);
        if (boxSelectArmedFinal)
        {
            ui.RECT_BOXSELECT.position = Input.mousePosition;
        }
        if (Input.GetMouseButtonDown(0) && !boxSelect.isSelecting && boxSelectArmedFinal)
        {
            boxSelect.BeginSelection();
            boxSelectArmed = false;
        }
        else if (Input.GetMouseButtonUp(0) && boxSelect.isSelecting)
        {
            boxSelect.EndSelection();
        }


        if (Input.GetButtonDown("Select All"))
        {
            ToggleSelectAll();
        }
        else if (Input.GetButtonDown("Extrude") && selMesh.GetSelectedPoints().Any())
        {
            if (selectionMode == 0)
            {
                selMesh.BeginExtrude(selMesh.selVerts);
            }
            else
            {
                selMesh.BeginExtrude(selMesh.selFaces);
            }
            transformGizmo.SetPositionAuto();
        }
        else if (Input.GetKeyDown(KeyCode.Z) && Input.GetKey(KeyCode.LeftControl))
        {
            UndoEdit();
        }
        else if (Input.GetKeyDown(KeyCode.Y) && Input.GetKey(KeyCode.LeftControl))
        {
            RedoEdit();
        }
        else if (Input.GetButtonDown("Delete"))
        {
            DeleteSelected();
        }
        else if (Input.GetButtonDown("Fill"))
        {
            TryCreateFace();
        }
        else if (Input.GetButtonDown("Select Linked"))
        {
            BeginSelectLinked();
        }
        else if (Input.GetKeyDown(KeyCode.Home))
        {
            FocusOnSelected();
        }
    }