diff --git a/Source/Editor/Viewport/EditorViewport.cs b/Source/Editor/Viewport/EditorViewport.cs index 51b3a2d78..f83d9eb98 100644 --- a/Source/Editor/Viewport/EditorViewport.cs +++ b/Source/Editor/Viewport/EditorViewport.cs @@ -134,6 +134,11 @@ namespace FlaxEditor.Viewport /// protected ViewportWidgetButton _cameraButton; + /// + /// The orthographic mode widget button. + /// + protected ViewportWidgetButton _orthographicModeButton; + private readonly Editor _editor; private float _mouseSensitivity; @@ -524,6 +529,15 @@ namespace FlaxEditor.Viewport }; _cameraWidget.Parent = this; + // Toggle orthographic mode widget + _orthographicModeButton = new ViewportWidgetButton(string.Empty, Editor.Instance.Icons.CamSpeed32, null, true) + { + Checked = !_isOrtho, + TooltipText = "Toggle Orthographic/Perspective Mode", + Parent = _cameraWidget, + }; + _orthographicModeButton.Toggled += OnOrthographicModeToggled; + // Camera speed var camSpeedButton = cameraCM.AddButton("Camera Speed"); camSpeedButton.CloseMenuOnClick = false; @@ -942,6 +956,9 @@ namespace FlaxEditor.Viewport { _isOrtho = !_isOrtho; + if (_orthographicModeButton != null) + _orthographicModeButton.Checked = !_isOrtho; + if (_isOrtho) { var orient = ViewOrientation;