SceneLoggingExampleModule.cpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 <IGem.h>
  9. #include <AzCore/Module/DynamicModuleHandle.h>
  10. #include <Behaviors/LoggingGroupBehavior.h>
  11. #include <Processors/LoadingTrackingProcessor.h>
  12. #include <Processors/ExportTrackingProcessor.h>
  13. namespace SceneLoggingExample
  14. {
  15. // The SceneLoggingExampleModule is the entry point for gems. To extend the SceneAPI, the
  16. // logging, loading, and export components must be registered here.
  17. //
  18. // NOTE: The gem system currently does not support registering file extensions through the
  19. // AssetImportRequest EBus.
  20. class SceneLoggingExampleModule
  21. : public CryHooksModule
  22. {
  23. public:
  24. AZ_CLASS_ALLOCATOR(SceneLoggingExampleModule, AZ::SystemAllocator)
  25. AZ_RTTI(SceneLoggingExampleModule, "{36AA9C0F-7976-40C7-AF54-C492AC5B16F6}", CryHooksModule);
  26. SceneLoggingExampleModule()
  27. : CryHooksModule()
  28. {
  29. // The SceneAPI libraries require specialized initialization. As early as possible, be
  30. // sure to repeat the following two lines for any SceneAPI you want to use. Omitting these
  31. // calls or making them too late can cause problems such as missing EBus events.
  32. m_sceneCoreModule = AZ::DynamicModuleHandle::Create("SceneCore");
  33. m_sceneCoreModule->Load(AZ::DynamicModuleHandle::LoadFlags::InitFuncRequired);
  34. m_descriptors.insert(m_descriptors.end(),
  35. {
  36. LoggingGroupBehavior::CreateDescriptor(),
  37. LoadingTrackingProcessor::CreateDescriptor(),
  38. ExportTrackingProcessor::CreateDescriptor()
  39. });
  40. }
  41. // In this example, no system components are added. You can use system components
  42. // to set global settings for this gem.
  43. // For functionality that should always be available to the SceneAPI, we recommend
  44. // that you use a BehaviorComponent instead.
  45. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  46. {
  47. return AZ::ComponentTypeList {};
  48. }
  49. private:
  50. AZStd::unique_ptr<AZ::DynamicModuleHandle> m_sceneCoreModule;
  51. };
  52. } // namespace SceneLoggingExample
  53. #if defined(O3DE_GEM_NAME)
  54. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME), SceneLoggingExample::SceneLoggingExampleModule)
  55. #else
  56. AZ_DECLARE_MODULE_CLASS(Gem_SceneLoggingExample, SceneLoggingExample::SceneLoggingExampleModule)
  57. #endif