3
0

${Name}EditorModule.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // {BEGIN_LICENSE}
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. // {END_LICENSE}
  10. #include <${Name}/${Name}TypeIds.h>
  11. #include <${Name}ModuleInterface.h>
  12. #include "${Name}EditorSystemComponent.h"
  13. #include "Components/Editor${Name}Component.h"
  14. namespace ${SanitizedCppName}
  15. {
  16. class ${SanitizedCppName}EditorModule
  17. : public ${SanitizedCppName}ModuleInterface
  18. {
  19. public:
  20. AZ_RTTI(${SanitizedCppName}EditorModule, ${SanitizedCppName}EditorModuleTypeId, ${SanitizedCppName}ModuleInterface);
  21. AZ_CLASS_ALLOCATOR(${SanitizedCppName}EditorModule, AZ::SystemAllocator);
  22. ${SanitizedCppName}EditorModule()
  23. {
  24. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  25. // Add ALL components descriptors associated with this gem to m_descriptors.
  26. // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
  27. // This happens through the [MyComponent]::Reflect() function.
  28. m_descriptors.insert(m_descriptors.end(), {
  29. ${SanitizedCppName}EditorSystemComponent::CreateDescriptor(),
  30. ${SanitizedCppName}Component::CreateDescriptor(),
  31. Editor${SanitizedCppName}Component::CreateDescriptor(),
  32. });
  33. }
  34. /**
  35. * Add required SystemComponents to the SystemEntity.
  36. * Non-SystemComponents should not be added here
  37. */
  38. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  39. {
  40. return AZ::ComponentTypeList {
  41. azrtti_typeid<${SanitizedCppName}EditorSystemComponent>(),
  42. };
  43. }
  44. };
  45. }// namespace ${SanitizedCppName}
  46. #if defined(O3DE_GEM_NAME)
  47. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME, _Editor), ${SanitizedCppName}::${SanitizedCppName}EditorModule)
  48. #else
  49. AZ_DECLARE_MODULE_CLASS(Gem_${SanitizedCppName}_Editor, ${SanitizedCppName}::${SanitizedCppName}EditorModule)
  50. #endif