SceneLoggingExampleModule.cpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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_RTTI(SceneLoggingExampleModule, "{36AA9C0F-7976-40C7-AF54-C492AC5B16F6}", CryHooksModule);
  25. SceneLoggingExampleModule()
  26. : CryHooksModule()
  27. {
  28. // The SceneAPI libraries require specialized initialization. As early as possible, be
  29. // sure to repeat the following two lines for any SceneAPI you want to use. Omitting these
  30. // calls or making them too late can cause problems such as missing EBus events.
  31. m_sceneCoreModule = AZ::DynamicModuleHandle::Create("SceneCore");
  32. m_sceneCoreModule->Load(true);
  33. m_descriptors.insert(m_descriptors.end(),
  34. {
  35. LoggingGroupBehavior::CreateDescriptor(),
  36. LoadingTrackingProcessor::CreateDescriptor(),
  37. ExportTrackingProcessor::CreateDescriptor()
  38. });
  39. }
  40. // In this example, no system components are added. You can use system components
  41. // to set global settings for this gem.
  42. // For functionality that should always be available to the SceneAPI, we recommend
  43. // that you use a BehaviorComponent instead.
  44. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  45. {
  46. return AZ::ComponentTypeList {};
  47. }
  48. private:
  49. AZStd::unique_ptr<AZ::DynamicModuleHandle> m_sceneCoreModule;
  50. };
  51. } // namespace SceneLoggingExample
  52. // DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM.
  53. // The first parameter should be GemName_GemIdLower.
  54. // The second should be the fully qualified name of the class above.
  55. AZ_DECLARE_MODULE_CLASS(Gem_SceneLoggingExample, SceneLoggingExample::SceneLoggingExampleModule)