StartingPointMovementGem.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 <AzFramework/Metrics/MetricsPlainTextNameRegistration.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. namespace StartingPointMovement
  12. {
  13. // Dummy component to get reflect function
  14. class StartingPointMovementDummyComponent
  15. : public AZ::Component
  16. {
  17. public:
  18. AZ_COMPONENT(StartingPointMovementDummyComponent, "{6C9DA3DD-A0B3-4DCB-B77B-E93C4AF89134}");
  19. static void Reflect(AZ::ReflectContext* context)
  20. {
  21. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  22. {
  23. serializeContext->ClassDeprecate("Event Action Bindings", AZ::Uuid("{2BB79CFC-7EBC-4EF4-A62E-5D64CB45CDBD}"));
  24. serializeContext->Class<StartingPointMovementDummyComponent, AZ::Component>()
  25. ->Version(0)
  26. ;
  27. }
  28. }
  29. void Activate() override { }
  30. void Deactivate() override { }
  31. };
  32. class StartingPointMovementModule
  33. : public AZ::Module
  34. {
  35. public:
  36. AZ_RTTI(StartingPointMovementModule, "{AE406AE3-77AE-4CA6-84AD-842224EE2188}", AZ::Module);
  37. StartingPointMovementModule()
  38. : AZ::Module()
  39. {
  40. m_descriptors.insert(m_descriptors.end(), {
  41. StartingPointMovementDummyComponent::CreateDescriptor(),
  42. });
  43. // 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.
  44. // IF YOU ARE A THIRDPARTY WRITING A GEM, DO NOT REGISTER YOUR COMPONENTS WITH EditorMetricsComponentRegistrationBus
  45. AZStd::vector<AZ::Uuid> typeIds;
  46. typeIds.reserve(m_descriptors.size());
  47. for (AZ::ComponentDescriptor* descriptor : m_descriptors)
  48. {
  49. typeIds.emplace_back(descriptor->GetUuid());
  50. }
  51. AzFramework::MetricsPlainTextNameRegistrationBus::Broadcast(
  52. &AzFramework::MetricsPlainTextNameRegistrationBus::Events::RegisterForNameSending, typeIds);
  53. }
  54. };
  55. }
  56. #if defined(O3DE_GEM_NAME)
  57. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME), StartingPointMovement::StartingPointMovementModule)
  58. #else
  59. AZ_DECLARE_MODULE_CLASS(Gem_StartingPointMovement, StartingPointMovement::StartingPointMovementModule)
  60. #endif