GotoPositionDlg.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #if !defined(Q_MOC_RUN)
  10. #include <QDialog>
  11. #endif
  12. #include <SandboxAPI.h>
  13. #include <AzCore/std/functional.h>
  14. namespace Ui
  15. {
  16. class GotoPositionDialog;
  17. }
  18. //! Utility to deal with ensuring camera pitch values are in the expected range.
  19. struct GoToPositionPitchConstraints
  20. {
  21. using AngleRangeConfigureFn = AZStd::function<void(float, float)>;
  22. //! Notify a callback with the min and max camera pitch constraints (no tolerance included).
  23. SANDBOX_API void DeterminePitchRange(const AngleRangeConfigureFn& configurePitchRangeFn) const;
  24. //! Returns the clamped pitch value (including tolerance with range extents).
  25. SANDBOX_API float PitchClampedRadians(float pitchDegrees) const;
  26. };
  27. //! GotoPositionDialog for setting camera position and rotation.
  28. class GotoPositionDialog : public QDialog
  29. {
  30. Q_OBJECT
  31. public:
  32. explicit GotoPositionDialog(QWidget* parent = nullptr);
  33. ~GotoPositionDialog();
  34. protected:
  35. void OnInitDialog();
  36. void accept() override;
  37. void OnUpdateNumbers();
  38. void OnChangeEdit();
  39. public:
  40. QString m_transform;
  41. private:
  42. GoToPositionPitchConstraints m_goToPositionPitchConstraints;
  43. QScopedPointer<Ui::GotoPositionDialog> m_ui;
  44. };