Пример #1
0
    void Update()
    {
        debugForm.Logic();

        if (keyboard.KeyReleased(Key.F1))
        {
            debugForm.Visible = !debugForm.Visible;
        }
        if (keyboard.KeyReleased(Key.F2))
        {
            layerForm.Visible = !layerForm.Visible;
        }
        if (keyboard.KeyReleased(Key.F3))
        {
            textureForm.Visible = !textureForm.Visible;
        }
        if (keyboard.KeyReleased(Key.F4))
        {
            meshDesigner.Visible = !meshDesigner.Visible;
        }
        if (keyboard.KeyReleased(Key.F5))
        {
            outlinerForm.Visible = !outlinerForm.Visible;
        }

        if (keyboard.KeyReleased(Key.F12))
        {
            new OptionsForm().Show();
        }
    }
Пример #2
0
    public void Update()
    {
        mouse.PlaneDistance = editorCamera.Position.Z;

        cameraControl.Logic();
        editorCamera.Position = CameraControl.Position;
        editorCamera.Target   = CameraControl.Position * new Vector3(1, 1, 0);

        if (keyboard.KeyPressed(Key.Tab))
        {
            SwitchSelectMode();
        }

        if (keyboard.KeyReleased(Key.Delete))
        {
            List <EMesh> meshes = new List <EMesh>();
            foreach (EMesh m in SelectedMeshes)
            {
                meshes.Add(m);
            }

            if (meshes.Count > 0)
            {
                ActiveHistory.Add(new RemoveAction(meshes, ActiveHistory));

                foreach (EMesh m in meshes)
                {
                    m.Remove();
                }

                DeselectAll();
            }
        }

        /*
         * if (manipulatorMode == ManipulatorMode.Paint)
         * {
         *      form.CursorVisible = false;
         * }
         * else
         *      form.CursorVisible = true;
         */

        foreach (Manipulator m in manipulators)
        {
            m.UpdatePivot();
        }

        //SOME HOTKEYS
        if (form.Focused && !Manipulator.Active)
        {
            if (keyboard[Key.LControl])
            {
                //OPTIONS
                if (keyboard[Key.LShift])
                {
                    if (keyboard.KeyPressed(Key.G))
                    {
                        OptionsForm.options.ShowGrid = !OptionsForm.options.ShowGrid;
                    }
                    if (keyboard.KeyPressed(Key.L))
                    {
                        OptionsForm.options.FocusLayer = !OptionsForm.options.FocusLayer;
                    }
                    if (keyboard.KeyPressed(Key.B))
                    {
                        OptionsForm.options.MeshBorders = !OptionsForm.options.MeshBorders;
                    }
                }
                else                 //OTHER EDITOR HOTKEYS
                {
                    if (keyboard.KeyPressed(Key.D))
                    {
                        CopySelected();
                        PasteSelected();
                    }

                    if (keyboard.KeyPressed(Key.C))
                    {
                        CopySelected();
                    }
                    if (keyboard.KeyPressed(Key.V))
                    {
                        PasteSelected();
                    }

                    if (keyboard.KeyPressed(Key.Z) && ActiveLayers.Count > 0)
                    {
                        ActiveLayers[0].History.Undo();
                    }
                    if (keyboard.KeyPressed(Key.Y) && ActiveLayers.Count > 0)
                    {
                        ActiveLayers[0].History.Redo();
                    }

                    if (keyboard.KeyPressed(Key.B))
                    {
                        (manipulators[(int)ManipulatorMode.Paint] as VertexPen).ShowPalette();
                    }
                }
            }
            else
            {
                //MANIPULATOR CONTROL
                if (keyboard.KeyPressed(Key.Q))
                {
                    manipulatorMode = ManipulatorMode.None;
                }
                if (keyboard.KeyPressed(Key.W))
                {
                    manipulatorMode = ManipulatorMode.Translate;
                }
                if (keyboard.KeyPressed(Key.E))
                {
                    manipulatorMode = ManipulatorMode.Rotate;
                }
                if (keyboard.KeyPressed(Key.R))
                {
                    manipulatorMode = ManipulatorMode.Scale;
                }
                if (keyboard.KeyPressed(Key.B))
                {
                    manipulatorMode = ManipulatorMode.Paint;
                }
            }
        }

        selectionBox.Logic();
        meshCreator.Logic();

        foreach (EMesh m in Meshes)
        {
            m.Logic();
        }

        Manipulator.Logic();
    }