JointPropertyWidget.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 <Editor/Plugins/ColliderWidgets/ClothJointWidget.h>
  11. #include <Editor/Plugins/ColliderWidgets/HitDetectionJointWidget.h>
  12. #include <UI/PropertyEditor/ReflectedPropertyEditor.hxx>
  13. #include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.h>
  14. #include <Editor/Plugins/SkeletonOutliner/SkeletonOutlinerBus.h>
  15. #include <AtomToolsFramework/Inspector/InspectorWidget.h>
  16. #include <Editor/Plugins/ColliderWidgets/RagdollNodeWidget.h>
  17. #include <QPushButton>
  18. #endif
  19. #include <QTreeWidget>
  20. #include <QStandardItem>
  21. namespace EMStudio
  22. {
  23. class ActorInfo;
  24. class NodeInfo;
  25. }
  26. namespace EMotionFX
  27. {
  28. class SimulatedObjectColliderWidget;
  29. class AddCollidersButton;
  30. //! A Widget in the Inspector Pane displaying Attributes of selected Nodes in a Skeleton
  31. class JointPropertyWidget
  32. : public QWidget
  33. {
  34. Q_OBJECT
  35. public:
  36. JointPropertyWidget(QWidget* parent = nullptr);
  37. ~JointPropertyWidget();
  38. public slots:
  39. void Reset();
  40. private slots:
  41. void OnAddCollider(PhysicsSetup::ColliderConfigType configType, AZ::TypeId colliderType);
  42. void OnAddToRagdoll();
  43. void OnSearchTextChanged();
  44. private:
  45. AzToolsFramework::ReflectedPropertyEditor* m_propertyWidget = nullptr;
  46. AddCollidersButton* m_addCollidersButton = nullptr;
  47. ClothJointWidget* m_clothJointWidget = nullptr;
  48. HitDetectionJointWidget* m_hitDetectionJointWidget = nullptr;
  49. RagdollNodeWidget* m_ragdollJointWidget = nullptr;
  50. SimulatedObjectColliderWidget* m_simulatedJointWidget = nullptr;
  51. AZStd::unique_ptr<EMStudio::ActorInfo> m_actorInfo;
  52. AZStd::unique_ptr<EMStudio::NodeInfo> m_nodeInfo;
  53. QLineEdit* m_filterEntityBox = nullptr;
  54. QString m_filterString;
  55. };
  56. //! Button To Add different Colliders
  57. class AddCollidersButton : public QPushButton
  58. {
  59. Q_OBJECT
  60. public:
  61. AddCollidersButton(QWidget* parent=nullptr);
  62. AZStd::string GetNameForColliderType(AZ::TypeId colliderType) const;
  63. public slots:
  64. void OnAddColliderActionTriggered(const QModelIndex& index);
  65. signals:
  66. void AddCollider(PhysicsSetup::ColliderConfigType configType, AZ::TypeId colliderType);
  67. void AddToRagdoll();
  68. protected slots:
  69. void OnCreateContextMenu();
  70. protected:
  71. const AZStd::vector<AZ::TypeId> m_supportedColliderTypes = {
  72. azrtti_typeid<Physics::BoxShapeConfiguration>(),
  73. azrtti_typeid<Physics::CapsuleShapeConfiguration>(),
  74. azrtti_typeid<Physics::SphereShapeConfiguration>()};
  75. QStandardItemModel* model = nullptr;
  76. };
  77. } // namespace EMotionFX