EditorViewportSettings.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 <SandboxAPI.h>
  10. #include <AzCore/Settings/SettingsRegistry.h>
  11. #include <AzCore/std/smart_ptr/unique_ptr.h>
  12. #include <AzCore/Math/Vector2.h>
  13. #include <AzCore/Math/Vector3.h>
  14. #include <AzFramework/Input/Channels/InputChannelId.h>
  15. namespace SandboxEditor
  16. {
  17. using AngleSnappingChangedEvent = AZ::Event<bool>;
  18. using CameraSpeedScaleChangedEvent = AZ::Event<float>;
  19. using GridShowingChangedEvent = AZ::Event<bool>;
  20. using GridSnappingChangedEvent = AZ::Event<bool>;
  21. using PerspectiveChangedEvent = AZ::Event<float>;
  22. using NearFarPlaneChangedEvent = AZ::Event<float>;
  23. //! Set callbacks to listen for editor settings change events.
  24. class EditorViewportSettingsCallbacks
  25. {
  26. public:
  27. virtual ~EditorViewportSettingsCallbacks() = default;
  28. virtual void SetAngleSnappingChangedEvent(AngleSnappingChangedEvent::Handler& handler) = 0;
  29. virtual void SetCameraSpeedScaleChangedEvent(CameraSpeedScaleChangedEvent::Handler& handler) = 0;
  30. virtual void SetGridShowingChangedEvent(GridShowingChangedEvent::Handler& handler) = 0;
  31. virtual void SetGridSnappingChangedEvent(GridSnappingChangedEvent::Handler& handler) = 0;
  32. virtual void SetFarPlaneDistanceChangedEvent(NearFarPlaneChangedEvent::Handler& handler) = 0;
  33. virtual void SetPerspectiveChangedEvent(PerspectiveChangedEvent::Handler& handler) = 0;
  34. virtual void SetNearPlaneDistanceChangedEvent(NearFarPlaneChangedEvent::Handler& handler) = 0;
  35. };
  36. //! Create an instance of EditorViewportSettingsCallbacks
  37. //! Note: EditorViewportSettingsCallbacks is implemented in EditorViewportSettings.cpp - a change
  38. //! event will fire when a value in the settings registry (editorpreferences.setreg) is modified.
  39. SANDBOX_API AZStd::unique_ptr<EditorViewportSettingsCallbacks> CreateEditorViewportSettingsCallbacks();
  40. SANDBOX_API AZ::u64 MaxItemsShownInAssetBrowserSearch();
  41. SANDBOX_API void SetMaxItemsShownInAssetBrowserSearch(AZ::u64 numberOfItemsShown);
  42. SANDBOX_API bool GridSnappingEnabled();
  43. SANDBOX_API void SetGridSnapping(bool enabled);
  44. SANDBOX_API float GridSnappingSize();
  45. SANDBOX_API void SetGridSnappingSize(float size);
  46. SANDBOX_API bool AngleSnappingEnabled();
  47. SANDBOX_API void SetAngleSnapping(bool enabled);
  48. SANDBOX_API float AngleSnappingSize();
  49. SANDBOX_API void SetAngleSnappingSize(float size);
  50. SANDBOX_API bool ShowingGrid();
  51. SANDBOX_API void SetShowingGrid(bool showing);
  52. SANDBOX_API bool StickySelectEnabled();
  53. SANDBOX_API void SetStickySelectEnabled(bool enabled);
  54. SANDBOX_API float ManipulatorLineBoundWidth();
  55. SANDBOX_API void SetManipulatorLineBoundWidth(float lineBoundWidth);
  56. SANDBOX_API float ManipulatorCircleBoundWidth();
  57. SANDBOX_API void SetManipulatorCircleBoundWidth(float circleBoundWidth);
  58. SANDBOX_API float CameraSpeedScale();
  59. SANDBOX_API void SetCameraSpeedScale(float speedScale);
  60. SANDBOX_API float CameraTranslateSpeed();
  61. SANDBOX_API float CameraTranslateSpeedScaled();
  62. SANDBOX_API void SetCameraTranslateSpeed(float speed);
  63. SANDBOX_API float CameraBoostMultiplier();
  64. SANDBOX_API void SetCameraBoostMultiplier(float multiplier);
  65. SANDBOX_API float CameraRotateSpeed();
  66. SANDBOX_API void SetCameraRotateSpeed(float speed);
  67. SANDBOX_API float CameraScrollSpeed();
  68. SANDBOX_API float CameraScrollSpeedScaled();
  69. SANDBOX_API void SetCameraScrollSpeed(float speed);
  70. SANDBOX_API float CameraDollyMotionSpeed();
  71. SANDBOX_API float CameraDollyMotionSpeedScaled();
  72. SANDBOX_API void SetCameraDollyMotionSpeed(float speed);
  73. SANDBOX_API bool CameraOrbitYawRotationInverted();
  74. SANDBOX_API void SetCameraOrbitYawRotationInverted(bool inverted);
  75. SANDBOX_API bool CameraPanInvertedX();
  76. SANDBOX_API void SetCameraPanInvertedX(bool inverted);
  77. SANDBOX_API bool CameraPanInvertedY();
  78. SANDBOX_API void SetCameraPanInvertedY(bool inverted);
  79. SANDBOX_API float CameraPanSpeed();
  80. SANDBOX_API float CameraPanSpeedScaled();
  81. SANDBOX_API void SetCameraPanSpeed(float speed);
  82. SANDBOX_API float CameraRotateSmoothness();
  83. SANDBOX_API void SetCameraRotateSmoothness(float smoothness);
  84. SANDBOX_API float CameraTranslateSmoothness();
  85. SANDBOX_API void SetCameraTranslateSmoothness(float smoothness);
  86. SANDBOX_API bool CameraRotateSmoothingEnabled();
  87. SANDBOX_API void SetCameraRotateSmoothingEnabled(bool enabled);
  88. SANDBOX_API bool CameraTranslateSmoothingEnabled();
  89. SANDBOX_API void SetCameraTranslateSmoothingEnabled(bool enabled);
  90. SANDBOX_API bool CameraCaptureCursorForLook();
  91. SANDBOX_API void SetCameraCaptureCursorForLook(bool capture);
  92. SANDBOX_API AZ::Vector3 CameraDefaultEditorPosition();
  93. SANDBOX_API void SetCameraDefaultEditorPosition(const AZ::Vector3& position);
  94. //! @return pitch/yaw value in x/y Vector2 component in degrees.
  95. SANDBOX_API AZ::Vector2 CameraDefaultEditorOrientation();
  96. //! @param pitchYaw pitch/yaw value in x/y Vector2 component in degrees.
  97. SANDBOX_API void SetCameraDefaultEditorOrientation(const AZ::Vector2& pitchYaw);
  98. SANDBOX_API float CameraDefaultOrbitDistance();
  99. SANDBOX_API void SetCameraDefaultOrbitDistance(float distance);
  100. SANDBOX_API bool CameraGoToPositionInstantlyEnabled();
  101. SANDBOX_API void SetCameraGoToPositionInstantlyEnabled(bool instant);
  102. SANDBOX_API float CameraGoToPositionDuration();
  103. SANDBOX_API void SetCameraGoToPositionDuration(float duration);
  104. SANDBOX_API AzFramework::InputChannelId CameraTranslateForwardChannelId();
  105. SANDBOX_API void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId);
  106. SANDBOX_API AzFramework::InputChannelId CameraTranslateBackwardChannelId();
  107. SANDBOX_API void SetCameraTranslateBackwardChannelId(AZStd::string_view cameraTranslateBackwardId);
  108. SANDBOX_API AzFramework::InputChannelId CameraTranslateLeftChannelId();
  109. SANDBOX_API void SetCameraTranslateLeftChannelId(AZStd::string_view cameraTranslateLeftId);
  110. SANDBOX_API AzFramework::InputChannelId CameraTranslateRightChannelId();
  111. SANDBOX_API void SetCameraTranslateRightChannelId(AZStd::string_view cameraTranslateRightId);
  112. SANDBOX_API AzFramework::InputChannelId CameraTranslateUpChannelId();
  113. SANDBOX_API void SetCameraTranslateUpChannelId(AZStd::string_view cameraTranslateUpId);
  114. SANDBOX_API AzFramework::InputChannelId CameraTranslateDownChannelId();
  115. SANDBOX_API void SetCameraTranslateDownChannelId(AZStd::string_view cameraTranslateDownId);
  116. SANDBOX_API AzFramework::InputChannelId CameraTranslateBoostChannelId();
  117. SANDBOX_API void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId);
  118. SANDBOX_API AzFramework::InputChannelId CameraOrbitChannelId();
  119. SANDBOX_API void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId);
  120. SANDBOX_API AzFramework::InputChannelId CameraFreeLookChannelId();
  121. SANDBOX_API void SetCameraFreeLookChannelId(AZStd::string_view cameraFreeLookId);
  122. SANDBOX_API AzFramework::InputChannelId CameraFreePanChannelId();
  123. SANDBOX_API void SetCameraFreePanChannelId(AZStd::string_view cameraFreePanId);
  124. SANDBOX_API AzFramework::InputChannelId CameraOrbitLookChannelId();
  125. SANDBOX_API void SetCameraOrbitLookChannelId(AZStd::string_view cameraOrbitLookId);
  126. SANDBOX_API AzFramework::InputChannelId CameraOrbitDollyChannelId();
  127. SANDBOX_API void SetCameraOrbitDollyChannelId(AZStd::string_view cameraOrbitDollyId);
  128. SANDBOX_API AzFramework::InputChannelId CameraOrbitPanChannelId();
  129. SANDBOX_API void SetCameraOrbitPanChannelId(AZStd::string_view cameraOrbitPanId);
  130. SANDBOX_API AzFramework::InputChannelId CameraFocusChannelId();
  131. SANDBOX_API void SetCameraFocusChannelId(AZStd::string_view cameraFocusId);
  132. SANDBOX_API float CameraDefaultNearPlaneDistance();
  133. SANDBOX_API void SetCameraDefaultNearPlaneDistance(float distance);
  134. SANDBOX_API float CameraDefaultFarPlaneDistance();
  135. SANDBOX_API void SetCameraDefaultFarPlaneDistance(float distance);
  136. SANDBOX_API float CameraDefaultFovRadians();
  137. SANDBOX_API void SetCameraDefaultFovRadians(float fovRadians);
  138. SANDBOX_API float CameraDefaultFovDegrees();
  139. SANDBOX_API void SetCameraDefaultFovDegrees(float fovDegrees);
  140. SANDBOX_API void ResetCameraSpeedScale();
  141. SANDBOX_API void ResetCameraTranslateSpeed();
  142. SANDBOX_API void ResetCameraRotateSpeed();
  143. SANDBOX_API void ResetCameraBoostMultiplier();
  144. SANDBOX_API void ResetCameraScrollSpeed();
  145. SANDBOX_API void ResetCameraDollyMotionSpeed();
  146. SANDBOX_API void ResetCameraPanSpeed();
  147. SANDBOX_API void ResetCameraRotateSmoothness();
  148. SANDBOX_API void ResetCameraRotateSmoothingEnabled();
  149. SANDBOX_API void ResetCameraTranslateSmoothness();
  150. SANDBOX_API void ResetCameraTranslateSmoothingEnabled();
  151. SANDBOX_API void ResetCameraCaptureCursorForLook();
  152. SANDBOX_API void ResetCameraOrbitYawRotationInverted();
  153. SANDBOX_API void ResetCameraPanInvertedX();
  154. SANDBOX_API void ResetCameraPanInvertedY();
  155. SANDBOX_API void ResetCameraDefaultEditorPosition();
  156. SANDBOX_API void ResetCameraDefaultOrbitDistance();
  157. SANDBOX_API void ResetCameraDefaultEditorOrientation();
  158. SANDBOX_API void ResetCameraGoToPositionInstantlyEnabled();
  159. SANDBOX_API void ResetCameraGoToPositionDuration();
  160. SANDBOX_API void ResetCameraTranslateForwardChannelId();
  161. SANDBOX_API void ResetCameraTranslateBackwardChannelId();
  162. SANDBOX_API void ResetCameraTranslateLeftChannelId();
  163. SANDBOX_API void ResetCameraTranslateRightChannelId();
  164. SANDBOX_API void ResetCameraTranslateUpChannelId();
  165. SANDBOX_API void ResetCameraTranslateDownChannelId();
  166. SANDBOX_API void ResetCameraTranslateBoostChannelId();
  167. SANDBOX_API void ResetCameraOrbitChannelId();
  168. SANDBOX_API void ResetCameraFreeLookChannelId();
  169. SANDBOX_API void ResetCameraFreePanChannelId();
  170. SANDBOX_API void ResetCameraOrbitLookChannelId();
  171. SANDBOX_API void ResetCameraOrbitDollyChannelId();
  172. SANDBOX_API void ResetCameraOrbitPanChannelId();
  173. SANDBOX_API void ResetCameraFocusChannelId();
  174. } // namespace SandboxEditor