ColliderHelpers.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #include <AzCore/RTTI/TypeInfo.h>
  10. #include <MCore/Source/CommandGroup.h>
  11. #include <EMotionFX/Source/PhysicsSetup.h>
  12. #include <QModelIndexList>
  13. QT_FORWARD_DECLARE_CLASS(QLayout)
  14. QT_FORWARD_DECLARE_CLASS(QMenu)
  15. QT_FORWARD_DECLARE_CLASS(QObject)
  16. namespace EMotionFX
  17. {
  18. class ColliderHelpers
  19. {
  20. public:
  21. static QString GetMimeTypeForColliderShape()
  22. {
  23. return QString("com.amazon.lumberyard/%1").arg(azrtti_typeid<AzPhysics::ShapeColliderPair>().ToFixedString().c_str());
  24. }
  25. static void AddCopyColliderCommandToGroup(const Actor* actor, const Node* joint, PhysicsSetup::ColliderConfigType copyFrom, PhysicsSetup::ColliderConfigType copyTo, MCore::CommandGroup& commandGroup);
  26. static void CopyColliders(const QModelIndexList& modelIndices, PhysicsSetup::ColliderConfigType copyFrom, PhysicsSetup::ColliderConfigType copyTo, bool removeExistingColliders = true);
  27. static void AddCollider(const QModelIndexList& modelIndices, PhysicsSetup::ColliderConfigType addTo, const AZ::TypeId& colliderType);
  28. static void AddToRagdoll(const QModelIndexList& modelIndices);
  29. static void RemoveFromRagdoll(const QModelIndexList &modelIndices);
  30. static void ClearColliders(const QModelIndexList& modelIndices, PhysicsSetup::ColliderConfigType removeFrom);
  31. static bool AreCollidersReflected();
  32. static bool CanCopyFrom(const QModelIndexList& modelIndices, PhysicsSetup::ColliderConfigType copyFrom);
  33. static void AddCopyFromMenu(QObject* parent, QMenu* parentMenu, PhysicsSetup::ColliderConfigType createForType, const QModelIndexList& modelIndices);
  34. static void AddCopyFromMenu(QObject* parent, QMenu* parentMenu, PhysicsSetup::ColliderConfigType createForType, const QModelIndexList& modelIndices,
  35. const AZStd::function<void(PhysicsSetup::ColliderConfigType copyFrom, PhysicsSetup::ColliderConfigType copyTo)>& copyFunc);
  36. static void CopyColliderToClipboard(const QModelIndex& modelIndex, size_t shapeIndex, PhysicsSetup::ColliderConfigType type);
  37. static void PasteColliderFromClipboard(const QModelIndex& modelIndex, size_t shapeIndex, PhysicsSetup::ColliderConfigType type, bool replace);
  38. static bool NodeHasRagdoll(const QModelIndex& modelIndex);
  39. static bool NodeHasClothCollider(const QModelIndex& modelIndex);
  40. static bool NodeHasHitDetection(const QModelIndex& modelIndex);
  41. };
  42. } // namespace EMotionFX