${Name}EditorModule.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. void Init${SanitizedCppName}Resources()
  14. {
  15. // We must register our Qt resources (.qrc file) since this is being loaded from a separate module (gem)
  16. Q_INIT_RESOURCE(${SanitizedCppName});
  17. }
  18. namespace ${SanitizedCppName}
  19. {
  20. class ${SanitizedCppName}EditorModule
  21. : public ${SanitizedCppName}ModuleInterface
  22. {
  23. public:
  24. AZ_RTTI(${SanitizedCppName}EditorModule, ${SanitizedCppName}EditorModuleTypeId, ${SanitizedCppName}ModuleInterface);
  25. AZ_CLASS_ALLOCATOR(${SanitizedCppName}EditorModule, AZ::SystemAllocator);
  26. ${SanitizedCppName}EditorModule()
  27. {
  28. Init${SanitizedCppName}Resources();
  29. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  30. // Add ALL components descriptors associated with this gem to m_descriptors.
  31. // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
  32. // This happens through the [MyComponent]::Reflect() function.
  33. m_descriptors.insert(m_descriptors.end(), {
  34. ${SanitizedCppName}EditorSystemComponent::CreateDescriptor(),
  35. });
  36. }
  37. /**
  38. * Add required SystemComponents to the SystemEntity.
  39. * Non-SystemComponents should not be added here
  40. */
  41. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  42. {
  43. return AZ::ComponentTypeList {
  44. azrtti_typeid<${SanitizedCppName}EditorSystemComponent>(),
  45. };
  46. }
  47. };
  48. }// namespace ${SanitizedCppName}
  49. #if defined(O3DE_GEM_NAME)
  50. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME, _Editor), ${SanitizedCppName}::${SanitizedCppName}EditorModule)
  51. #else
  52. AZ_DECLARE_MODULE_CLASS(Gem_${SanitizedCppName}_Editor, ${SanitizedCppName}::${SanitizedCppName}EditorModule)
  53. #endif