Orthographic/perspective mode toggle

Note: missing dedicated icon!
This commit is contained in:
Christopher Rothert
2023-10-04 23:29:32 +02:00
parent 1f2d665654
commit 4b78d5e39e

View File

@@ -134,6 +134,11 @@ namespace FlaxEditor.Viewport
/// </summary>
protected ViewportWidgetButton _cameraButton;
/// <summary>
/// The orthographic mode widget button.
/// </summary>
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;