D6JointLimitConfiguration.cpp 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #include <AzCore/Serialization/EditContext.h>
  9. #include <Tests/D6JointLimitConfiguration.h>
  10. namespace EMotionFX
  11. {
  12. void D6JointLimitConfiguration::Reflect(AZ::ReflectContext* context)
  13. {
  14. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  15. {
  16. serializeContext->Class<D6JointLimitConfiguration, AzPhysics::JointConfiguration>()
  17. ->Version(1)
  18. ->Field("SwingLimitY", &D6JointLimitConfiguration::m_swingLimitY)
  19. ->Field("SwingLimitZ", &D6JointLimitConfiguration::m_swingLimitZ)
  20. ->Field("TwistLowerLimit", &D6JointLimitConfiguration::m_twistLimitLower)
  21. ->Field("TwistUpperLimit", &D6JointLimitConfiguration::m_twistLimitUpper)
  22. ;
  23. AZ::EditContext* editContext = serializeContext->GetEditContext();
  24. if (editContext)
  25. {
  26. editContext->Class<D6JointLimitConfiguration>(
  27. "PhysX D6 Joint Configuration", "")
  28. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  29. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  30. ->DataElement(AZ::Edit::UIHandlers::Default, &D6JointLimitConfiguration::m_swingLimitY, "Swing limit Y",
  31. "Maximum angle from the Y axis of the joint frame")
  32. ->Attribute(AZ::Edit::Attributes::Suffix, " degrees")
  33. ->Attribute(AZ::Edit::Attributes::Min, 1.0f)
  34. ->Attribute(AZ::Edit::Attributes::Max, 180.0f)
  35. ->DataElement(AZ::Edit::UIHandlers::Default, &D6JointLimitConfiguration::m_swingLimitZ, "Swing limit Z",
  36. "Maximum angle from the Z axis of the joint frame")
  37. ->Attribute(AZ::Edit::Attributes::Suffix, " degrees")
  38. ->Attribute(AZ::Edit::Attributes::Min, 1.0f)
  39. ->Attribute(AZ::Edit::Attributes::Max, 180.0f)
  40. ->DataElement(AZ::Edit::UIHandlers::Default, &D6JointLimitConfiguration::m_twistLimitLower, "Twist lower limit",
  41. "Lower limit for rotation about the X axis of the joint frame")
  42. ->Attribute(AZ::Edit::Attributes::Suffix, " degrees")
  43. ->Attribute(AZ::Edit::Attributes::Min, -180.0f)
  44. ->Attribute(AZ::Edit::Attributes::Max, 180.0f)
  45. ->DataElement(AZ::Edit::UIHandlers::Default, &D6JointLimitConfiguration::m_twistLimitUpper, "Twist upper limit",
  46. "Upper limit for rotation about the X axis of the joint frame")
  47. ->Attribute(AZ::Edit::Attributes::Suffix, " degrees")
  48. ->Attribute(AZ::Edit::Attributes::Min, -180.0f)
  49. ->Attribute(AZ::Edit::Attributes::Max, 180.0f)
  50. ;
  51. }
  52. }
  53. }
  54. } // namespace EMotionFX