CameraGem.cpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/Module/Module.h>
  9. #include "CameraComponent.h"
  10. #include "CameraSystemComponent.h"
  11. #if defined(CAMERA_EDITOR)
  12. #include "CameraEditorSystemComponent.h"
  13. #include "EditorCameraComponent.h"
  14. #endif // CAMERA_EDITOR
  15. #include <AzFramework/Metrics/MetricsPlainTextNameRegistration.h>
  16. namespace Camera
  17. {
  18. class CameraModule
  19. : public AZ::Module
  20. {
  21. public:
  22. AZ_RTTI(CameraModule, "{C2E72B0D-BCEF-452A-9BFA-03833015258C}", AZ::Module);
  23. CameraModule()
  24. : AZ::Module()
  25. {
  26. m_descriptors.insert(m_descriptors.end(), {
  27. Camera::CameraComponent::CreateDescriptor(),
  28. Camera::CameraSystemComponent::CreateDescriptor(),
  29. #if defined(CAMERA_EDITOR)
  30. CameraEditorSystemComponent::CreateDescriptor(),
  31. EditorCameraComponent::CreateDescriptor(),
  32. #endif // CAMERA_EDITOR
  33. });
  34. // This is an internal Amazon gem, so register it's components for metrics tracking, otherwise the name of the component won't get sent back.
  35. // IF YOU ARE A THIRDPARTY WRITING A GEM, DO NOT REGISTER YOUR COMPONENTS WITH EditorMetricsComponentRegistrationBus
  36. AZStd::vector<AZ::Uuid> typeIds;
  37. typeIds.reserve(m_descriptors.size());
  38. for (AZ::ComponentDescriptor* descriptor : m_descriptors)
  39. {
  40. typeIds.emplace_back(descriptor->GetUuid());
  41. }
  42. AzFramework::MetricsPlainTextNameRegistrationBus::Broadcast(
  43. &AzFramework::MetricsPlainTextNameRegistrationBus::Events::RegisterForNameSending, typeIds);
  44. }
  45. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  46. {
  47. return AZ::ComponentTypeList {
  48. azrtti_typeid<Camera::CameraSystemComponent>(),
  49. #if defined(CAMERA_EDITOR)
  50. azrtti_typeid<CameraEditorSystemComponent>(),
  51. #endif // CAMERA_EDITOR
  52. };
  53. }
  54. };
  55. }
  56. #if defined(O3DE_GEM_NAME)
  57. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME), Camera::CameraModule)
  58. #else
  59. AZ_DECLARE_MODULE_CLASS(Gem_Camera, Camera::CameraModule)
  60. #endif