TransformRowWidget.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 <QPointer>
  11. #include <QString>
  12. #include <QLineEdit>
  13. #include <AzCore/Math/Transform.h>
  14. #include <AzCore/Math/Vector3.h>
  15. #include <AzCore/Math/Vector3.h>
  16. #include <AzCore/Math/Uuid.h>
  17. #include <AzCore/Memory/SystemAllocator.h>
  18. #include <SceneAPI/SceneUI/SceneUIConfiguration.h>
  19. #endif
  20. namespace AzQtComponents
  21. {
  22. class VectorInput;
  23. }
  24. namespace AzToolsFramework
  25. {
  26. class PropertyDoubleSpinCtrl;
  27. }
  28. namespace AZ
  29. {
  30. namespace SceneAPI
  31. {
  32. namespace SceneUI
  33. {
  34. class SCENE_UI_API ExpandedTransform
  35. {
  36. public:
  37. AZ_CLASS_ALLOCATOR_DECL;
  38. ExpandedTransform();
  39. explicit ExpandedTransform(const Transform& transform);
  40. void GetTransform(AZ::Transform& transform) const;
  41. void SetTransform(const AZ::Transform& transform);
  42. const AZ::Vector3& GetTranslation() const;
  43. void SetTranslation(const AZ::Vector3& translation);
  44. const AZ::Vector3& GetRotation() const;
  45. void SetRotation(const AZ::Vector3& translation);
  46. const float GetScale() const;
  47. void SetScale(const float scale);
  48. private:
  49. AZ::Vector3 m_translation;
  50. AZ::Vector3 m_rotation;
  51. float m_scale;
  52. };
  53. class TransformRowWidget : public QWidget
  54. {
  55. Q_OBJECT
  56. public:
  57. AZ_CLASS_ALLOCATOR_DECL;
  58. explicit TransformRowWidget(QWidget* parent = nullptr);
  59. ~TransformRowWidget();
  60. void SetEnableEdit(bool enableEdit);
  61. void SetTransform(const AZ::Transform& transform);
  62. void GetTransform(AZ::Transform& transform) const;
  63. const ExpandedTransform& GetExpandedTransform() const;
  64. AzQtComponents::VectorInput* GetTranslationWidget();
  65. AzQtComponents::VectorInput* GetRotationWidget();
  66. AzToolsFramework::PropertyDoubleSpinCtrl* GetScaleWidget();
  67. protected:
  68. ExpandedTransform m_transform;
  69. bool m_expanded = true;
  70. QPointer<QWidget> m_containerWidget;
  71. AzQtComponents::VectorInput* m_translationWidget;
  72. AzQtComponents::VectorInput* m_rotationWidget;
  73. AzToolsFramework::PropertyDoubleSpinCtrl* m_scaleWidget;
  74. };
  75. } // namespace SceneUI
  76. } // namespace SceneAPI
  77. } // namespace AZ