PropertyHandlerPivot.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 <AzCore/base.h>
  11. #include <AzCore/Memory/SystemAllocator.h>
  12. #include <AzToolsFramework/UI/PropertyEditor/PropertyVectorCtrl.hxx>
  13. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  14. #include <LyShine/UiBase.h>
  15. #include <LyShine/Bus/UiTransform2dBus.h>
  16. #endif
  17. class PivotPresetsWidget;
  18. class PropertyPivotCtrl
  19. : public QWidget
  20. {
  21. Q_OBJECT
  22. public:
  23. AZ_CLASS_ALLOCATOR(PropertyPivotCtrl, AZ::SystemAllocator);
  24. PropertyPivotCtrl(QWidget* parent = nullptr);
  25. void ConsumeAttribute(AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName);
  26. PivotPresetsWidget* GetPivotPresetsWidget();
  27. AzQtComponents::VectorInput* GetPropertyVectorCtrl();
  28. private:
  29. AzToolsFramework::VectorPropertyHandlerCommon m_common;
  30. AzQtComponents::VectorInput* m_propertyVectorCtrl;
  31. PivotPresetsWidget* m_pivotPresetsWidget;
  32. };
  33. //-------------------------------------------------------------------------------
  34. class PropertyHandlerPivot
  35. : public AzToolsFramework::PropertyHandler < AZ::Vector2, PropertyPivotCtrl >
  36. {
  37. public:
  38. AZ_CLASS_ALLOCATOR(PropertyHandlerPivot, AZ::SystemAllocator);
  39. AZ::u32 GetHandlerName(void) const override { return AZ_CRC_CE("Pivot"); }
  40. QWidget* CreateGUI(QWidget* pParent) override;
  41. void ConsumeAttribute(PropertyPivotCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
  42. void WriteGUIValuesIntoProperty(size_t index, PropertyPivotCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
  43. bool ReadValuesIntoGUI(size_t index, PropertyPivotCtrl* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
  44. AZ::EntityId GetParentEntityId(AzToolsFramework::InstanceDataNode* node, size_t index);
  45. static void Register();
  46. };