InertiaPropertyHandler.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 <AzQtComponents/Components/Widgets/VectorInput.h>
  11. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  12. #include <AzCore/Math/Matrix3x3.h>
  13. #endif
  14. namespace PhysX
  15. {
  16. namespace Editor
  17. {
  18. static const AZ::Crc32 InertiaHandler = AZ_CRC_CE("RigidBodyInertia");
  19. class InertiaPropertyHandler
  20. : public QObject
  21. , public AzToolsFramework::PropertyHandler<AZ::Matrix3x3, AzQtComponents::VectorInput>
  22. {
  23. Q_OBJECT //AUTOMOC
  24. public:
  25. AZ_CLASS_ALLOCATOR(InertiaPropertyHandler, AZ::SystemAllocator);
  26. AZ::u32 GetHandlerName(void) const override;
  27. QWidget* CreateGUI(QWidget* parent) override;
  28. void ConsumeAttribute(AzQtComponents::VectorInput* GUI, AZ::u32 attrib,
  29. AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
  30. void WriteGUIValuesIntoProperty(size_t index, AzQtComponents::VectorInput* GUI,
  31. AZ::Matrix3x3& instance, AzToolsFramework::InstanceDataNode* node) override;
  32. bool ReadValuesIntoGUI(size_t index, AzQtComponents::VectorInput* GUI,
  33. const AZ::Matrix3x3& instance, AzToolsFramework::InstanceDataNode* node) override;
  34. };
  35. } // namespace Editor
  36. } // namespace PhysX