FollowingCameraConfiguration.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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("DefaultView", &FollowingCameraConfiguration::m_defaultView);
  24. if (AZ::EditContext* ec = serialize->GetEditContext())
  25. {
  26. ec->Class<FollowingCameraConfiguration>("Follow Camera Configuration", "Configuration for the Following Camera Component")
  27. ->DataElement(
  28. AZ::Edit::UIHandlers::Default,
  29. &FollowingCameraConfiguration::m_smoothingBuffer,
  30. "Smoothing Length",
  31. "Number of past transforms used to smooth, larger value gives smoother result, but more lag")
  32. ->Attribute(AZ::Edit::Attributes::Min, 1)
  33. ->Attribute(AZ::Edit::Attributes::Max, 100)
  34. ->DataElement(
  35. AZ::Edit::UIHandlers::Default, &FollowingCameraConfiguration::m_zoomSpeed, "Zoom Speed", "Speed of zooming")
  36. ->DataElement(
  37. AZ::Edit::UIHandlers::Default,
  38. &FollowingCameraConfiguration::m_rotationSpeed,
  39. "Rotation Speed",
  40. "Rotation Speed around the target")
  41. ->DataElement(
  42. AZ::Edit::UIHandlers::Default, &FollowingCameraConfiguration::m_predefinedViews, "Views", "Views to follow")
  43. ->DataElement(
  44. AZ::Edit::UIHandlers::Default,
  45. &FollowingCameraConfiguration::m_defaultView,
  46. "Default View",
  47. "Default View to follow")
  48. ->Attribute(AZ::Edit::Attributes::Min, 0);
  49. }
  50. }
  51. }
  52. } // namespace ROS2