3
0

SimulatedObjectNameHandler.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  11. #include <Editor/LineEditValidatable.h>
  12. #endif
  13. namespace EMotionFX
  14. {
  15. class SimulatedObject;
  16. class SimulatedObjectNameLineEdit
  17. : public EMStudio::LineEditValidatable
  18. {
  19. Q_OBJECT // AUTOMOC
  20. public:
  21. AZ_CLASS_ALLOCATOR_DECL
  22. SimulatedObjectNameLineEdit(QWidget* parent);
  23. ~SimulatedObjectNameLineEdit() = default;
  24. void SetSimulatedObject(SimulatedObject* simulatedObject);
  25. private:
  26. SimulatedObject* m_simulatedObject;
  27. };
  28. class SimulatedObjectNameHandler
  29. : public QObject
  30. , public AzToolsFramework::PropertyHandler<AZStd::string, SimulatedObjectNameLineEdit>
  31. {
  32. Q_OBJECT // AUTOMOC
  33. public:
  34. AZ_CLASS_ALLOCATOR_DECL
  35. SimulatedObjectNameHandler();
  36. ~SimulatedObjectNameHandler() = default;
  37. AZ::u32 GetHandlerName() const override;
  38. QWidget* CreateGUI(QWidget* parent) override;
  39. void ConsumeAttribute(SimulatedObjectNameLineEdit* widget, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
  40. void WriteGUIValuesIntoProperty(size_t index, SimulatedObjectNameLineEdit* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
  41. bool ReadValuesIntoGUI(size_t index, SimulatedObjectNameLineEdit* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
  42. protected:
  43. SimulatedObject* m_simulatedObject;
  44. };
  45. } // namespace EMotionFX