BlendSpaceEvaluatorHandler.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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/RTTI/RTTI.h>
  11. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  12. #include <QComboBox>
  13. #endif
  14. namespace EMotionFX
  15. {
  16. class BlendSpaceEvaluatorPicker
  17. : public QComboBox
  18. {
  19. Q_OBJECT
  20. public:
  21. AZ_CLASS_ALLOCATOR_DECL
  22. BlendSpaceEvaluatorPicker(QWidget* parent);
  23. void SetEvaluatorType(AZ::TypeId type);
  24. AZ::TypeId GetEvaluatorType() const;
  25. signals:
  26. void EvaluatorChanged();
  27. private slots:
  28. void OnCurrentIndexChanged(int index);
  29. private:
  30. AZ::TypeId GetTypeId(int index) const;
  31. };
  32. class BlendSpaceEvaluatorHandler
  33. : public QObject
  34. , public AzToolsFramework::PropertyHandler<AZ::TypeId, BlendSpaceEvaluatorPicker>
  35. {
  36. Q_OBJECT
  37. public:
  38. AZ_CLASS_ALLOCATOR_DECL
  39. BlendSpaceEvaluatorHandler();
  40. AZ::u32 GetHandlerName() const override;
  41. QWidget* CreateGUI(QWidget* parent) override;
  42. bool AutoDelete() const override { return false; }
  43. void ConsumeAttribute(BlendSpaceEvaluatorPicker* widget, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
  44. void WriteGUIValuesIntoProperty(size_t index, BlendSpaceEvaluatorPicker* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
  45. bool ReadValuesIntoGUI(size_t index, BlendSpaceEvaluatorPicker* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
  46. };
  47. } // namespace EMotionFX