SimulatedObjectColliderWidget.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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/SkeletonModelJointWidget.h>
  11. #include <Editor/Plugins/SimulatedObject/SimulatedObjectActionManager.h>
  12. #endif
  13. #include <AzCore/std/smart_ptr/unique_ptr.h>
  14. #include <QPushButton>
  15. namespace Physics
  16. {
  17. class CharacterColliderNodeConfiguration;
  18. }
  19. namespace EMotionFX
  20. {
  21. class AddColliderButton;
  22. class ColliderContainerWidget;
  23. class NotificationWidget;
  24. class SimulatedObjectColliderWidget
  25. : public SkeletonModelJointWidget
  26. {
  27. Q_OBJECT //AUTOMOC
  28. public:
  29. SimulatedObjectColliderWidget(QWidget* parent = nullptr);
  30. QString GetCardTitle() const override { return "Object Collider "; }
  31. QColor GetColor() const override { return QColor{"#1ad092"}; }
  32. int WidgetCount() const override;
  33. public slots:
  34. void OnAddCollider(const AZ::TypeId& colliderType);
  35. void OnCopyCollider(size_t colliderIndex);
  36. void OnPasteCollider(size_t colliderIndex, bool replace);
  37. void OnRemoveCollider(size_t colliderIndex);
  38. private:
  39. // SkeletonModelJointWidget
  40. QWidget* CreateContentWidget(QWidget* parent) override;
  41. void InternalReinit() override;
  42. void UpdateOwnershipLabel();
  43. void UpdateColliderNotification();
  44. Physics::CharacterColliderNodeConfiguration* GetNodeConfig() const;
  45. ColliderContainerWidget* m_collidersWidget = nullptr;
  46. QLabel* m_ownershipLabel = nullptr;
  47. QWidget* m_ownershipWidget = nullptr;
  48. QLabel* m_collideWithLabel = nullptr;
  49. QWidget* m_collideWithWidget = nullptr;
  50. NotificationWidget* m_colliderNotif = nullptr;
  51. int m_widgetCount = 0;
  52. };
  53. class AddToSimulatedObjectButton
  54. : public QPushButton
  55. {
  56. Q_OBJECT //AUTOMOC
  57. public:
  58. AddToSimulatedObjectButton(const QString& text, QWidget* parent = nullptr);
  59. signals:
  60. void AddToSimulatedObject();
  61. private slots:
  62. void OnCreateContextMenu();
  63. void OnAddJointsToObjectActionTriggered(bool checked);
  64. void OnCreateObjectAndAddJointsActionTriggered();
  65. private:
  66. AZStd::unique_ptr<EMStudio::SimulatedObjectActionManager> m_actionManager;
  67. };
  68. } // namespace EMotionFX