FollowingCameraConfiguration.cpp 2.9 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 "FollowingCameraConfiguration.h"
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/EditContextConstants.inl>
  11. namespace ROS2
  12. {
  13. void FollowingCameraConfiguration::Reflect(AZ::ReflectContext* context)
  14. {
  15. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  16. {
  17. serialize->Class<FollowingCameraConfiguration>()
  18. ->Version(1)
  19. ->Field("PredefinedViews", &FollowingCameraConfiguration::m_predefinedViews)
  20. ->Field("SmoothingLength", &FollowingCameraConfiguration::m_smoothingBuffer)
  21. ->Field("ZoomSpeed", &FollowingCameraConfiguration::m_zoomSpeed)
  22. ->Field("RotationSpeed", &FollowingCameraConfiguration::m_rotationSpeed)
  23. ->Field("LockZAxis", &FollowingCameraConfiguration::m_lockZAxis)
  24. ->Field("DefaultView", &FollowingCameraConfiguration::m_defaultView);
  25. if (AZ::EditContext* ec = serialize->GetEditContext())
  26. {
  27. ec->Class<FollowingCameraConfiguration>("Follow Camera Configuration", "Configuration for the Following Camera Component")
  28. ->DataElement(
  29. AZ::Edit::UIHandlers::Default,
  30. &FollowingCameraConfiguration::m_smoothingBuffer,
  31. "Smoothing Length",
  32. "Number of past transforms used to smooth, larger value gives smoother result, but more lag")
  33. ->Attribute(AZ::Edit::Attributes::Min, 1)
  34. ->Attribute(AZ::Edit::Attributes::Max, 100)
  35. ->DataElement(
  36. AZ::Edit::UIHandlers::Default, &FollowingCameraConfiguration::m_zoomSpeed, "Zoom Speed", "Speed of zooming")
  37. ->DataElement(
  38. AZ::Edit::UIHandlers::Default,
  39. &FollowingCameraConfiguration::m_rotationSpeed,
  40. "Rotation Speed",
  41. "Rotation Speed around the target")
  42. ->DataElement(
  43. AZ::Edit::UIHandlers::Default, &FollowingCameraConfiguration::m_predefinedViews, "Views", "Views to follow")
  44. ->DataElement(AZ::Edit::UIHandlers::Default, &FollowingCameraConfiguration::m_lockZAxis, "Lock Z Axis", "Prevent camera from tilting")
  45. ->DataElement(
  46. AZ::Edit::UIHandlers::Default,
  47. &FollowingCameraConfiguration::m_defaultView,
  48. "Default View",
  49. "Default View to follow")
  50. ->Attribute(AZ::Edit::Attributes::Min, 0);
  51. }
  52. }
  53. }
  54. } // namespace ROS2