3
0

EventDataHandler.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 <QComboBox>
  11. #include <QVBoxLayout>
  12. #include <QWidget>
  13. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  14. #include <EMotionFX/Source/EventData.h>
  15. #endif
  16. namespace EMotionFX
  17. {
  18. class EventDataTypeSelectionWidget
  19. : public QWidget
  20. {
  21. Q_OBJECT
  22. public:
  23. AZ_CLASS_ALLOCATOR_DECL
  24. EventDataTypeSelectionWidget(QWidget* parent=nullptr);
  25. const AZ::Uuid GetSelectedClass() const;
  26. void SetSelectedClass(const AZ::Uuid& classId);
  27. signals:
  28. void currentIndexChanged(int);
  29. private:
  30. QComboBox* m_comboBox = nullptr;
  31. class EventDataTypesModel;
  32. AZStd::shared_ptr<EventDataTypesModel> m_model = nullptr;
  33. };
  34. class EventDataHandler
  35. : public QObject
  36. , public AzToolsFramework::PropertyHandler<AZStd::shared_ptr<const EMotionFX::EventData>, EventDataTypeSelectionWidget>
  37. {
  38. Q_OBJECT
  39. public:
  40. AZ_CLASS_ALLOCATOR_DECL
  41. AZ::u32 GetHandlerName() const override;
  42. QWidget* CreateGUI(QWidget* parent) override;
  43. bool AutoDelete() const override { return false; }
  44. void ConsumeAttribute(EventDataTypeSelectionWidget* widget, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
  45. void WriteGUIValuesIntoProperty(size_t index, EventDataTypeSelectionWidget* GUI, AZStd::shared_ptr<const EventData>& instance, AzToolsFramework::InstanceDataNode* node) override;
  46. bool ReadValuesIntoGUI(size_t index, EventDataTypeSelectionWidget* GUI, const AZStd::shared_ptr<const EventData>& instance, AzToolsFramework::InstanceDataNode* node) override;
  47. };
  48. } // namespace EMotionFX