EditorPreferencesPageViewportCamera.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "Include/IPreferencesPage.h"
  10. #include <AzCore/Math/Vector2.h>
  11. #include <AzCore/Math/Vector3.h>
  12. #include <AzCore/RTTI/TypeInfoSimple.h>
  13. #include <AzCore/RTTI/RTTIMacros.h>
  14. #include <QIcon>
  15. namespace AZ
  16. {
  17. class SerializeContext;
  18. }
  19. class CEditorPreferencesPage_ViewportCamera : public IPreferencesPage
  20. {
  21. public:
  22. AZ_RTTI(CEditorPreferencesPage_ViewportCamera, "{BC593332-7EAF-4171-8A35-1C5DE5B40909}", IPreferencesPage)
  23. static void Reflect(AZ::SerializeContext& serialize);
  24. CEditorPreferencesPage_ViewportCamera();
  25. virtual ~CEditorPreferencesPage_ViewportCamera() = default;
  26. const char* GetCategory() override;
  27. const char* GetTitle() override;
  28. QIcon& GetIcon() override;
  29. void OnApply() override;
  30. void OnCancel() override;
  31. bool OnQueryCancel() override;
  32. private:
  33. void InitializeSettings();
  34. struct CameraMovementSettings
  35. {
  36. AZ_TYPE_INFO(CameraMovementSettings, "{60B8C07E-5F48-4171-A50B-F45558B5CCA1}")
  37. static void Reflect(AZ::SerializeContext& serialize);
  38. AZ::Vector3 m_defaultPosition;
  39. AZ::Vector2 m_defaultPitchYaw;
  40. float m_speedScale;
  41. float m_translateSpeed;
  42. float m_rotateSpeed;
  43. float m_scrollSpeed;
  44. float m_dollySpeed;
  45. float m_panSpeed;
  46. float m_boostMultiplier;
  47. float m_rotateSmoothness;
  48. float m_translateSmoothness;
  49. float m_defaultOrbitDistance;
  50. float m_goToPositionDuration;
  51. bool m_captureCursorLook;
  52. bool m_orbitYawRotationInverted;
  53. bool m_panInvertedX;
  54. bool m_panInvertedY;
  55. bool m_rotateSmoothing;
  56. bool m_translateSmoothing;
  57. bool m_goToPositionInstantly;
  58. bool GoToPositionDurationReadOnly() const
  59. {
  60. return m_goToPositionInstantly;
  61. }
  62. bool RotateSmoothingReadOnly() const
  63. {
  64. return !m_rotateSmoothing;
  65. }
  66. bool TranslateSmoothingReadOnly() const
  67. {
  68. return !m_translateSmoothing;
  69. }
  70. void Reset();
  71. void Initialize();
  72. private:
  73. bool m_resetButton = false; // required for positioning in edit context, otherwise unused
  74. };
  75. struct CameraInputSettings
  76. {
  77. AZ_TYPE_INFO(struct CameraInputSettings, "{A250FAD4-662E-4896-B030-D4ED03679377}")
  78. static void Reflect(AZ::SerializeContext& serialize);
  79. AZStd::string m_translateForwardChannelId;
  80. AZStd::string m_translateBackwardChannelId;
  81. AZStd::string m_translateLeftChannelId;
  82. AZStd::string m_translateRightChannelId;
  83. AZStd::string m_translateUpChannelId;
  84. AZStd::string m_translateDownChannelId;
  85. AZStd::string m_boostChannelId;
  86. AZStd::string m_orbitChannelId;
  87. AZStd::string m_freeLookChannelId;
  88. AZStd::string m_freePanChannelId;
  89. AZStd::string m_orbitLookChannelId;
  90. AZStd::string m_orbitDollyChannelId;
  91. AZStd::string m_orbitPanChannelId;
  92. AZStd::string m_focusChannelId;
  93. void Reset();
  94. void Initialize();
  95. private:
  96. bool m_resetButton = false; // required for positioning in edit context, otherwise unused
  97. };
  98. CameraMovementSettings m_cameraMovementSettings;
  99. CameraInputSettings m_cameraInputSettings;
  100. QIcon m_icon;
  101. };