ActorModule.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 <ActorSystemComponent.h>
  9. #include <AzCore/Memory/SystemAllocator.h>
  10. #include <AzCore/RTTI/RTTI.h>
  11. #include <AzCore/Module/Module.h>
  12. #ifdef EMOTIONFXATOM_EDITOR
  13. #include <Editor/EditorSystemComponent.h>
  14. #endif
  15. namespace AZ
  16. {
  17. namespace Render
  18. {
  19. //! Some Atom projects will not include EMotionFX, and some projects using EMotionFX will not include Atom. This module exists to prevent creating a hard dependency in either direction.
  20. class ActorModule
  21. : public Module
  22. {
  23. public:
  24. AZ_RTTI(ActorModule, "{84DCA4A9-39A1-4A04-A7DE-66FF62A3B7AD}", Module);
  25. AZ_CLASS_ALLOCATOR(ActorModule, SystemAllocator);
  26. ActorModule()
  27. : Module()
  28. {
  29. m_descriptors.insert(m_descriptors.end(), {
  30. ActorSystemComponent::CreateDescriptor(),
  31. #ifdef EMOTIONFXATOM_EDITOR
  32. EMotionFXAtom::EditorSystemComponent::CreateDescriptor(),
  33. #endif
  34. });
  35. }
  36. //!
  37. //! Add required SystemComponents to the SystemEntity.
  38. //!
  39. ComponentTypeList GetRequiredSystemComponents() const override
  40. {
  41. return ComponentTypeList{
  42. azrtti_typeid<ActorSystemComponent>(),
  43. #ifdef EMOTIONFXATOM_EDITOR
  44. azrtti_typeid<EMotionFXAtom::EditorSystemComponent>(),
  45. #endif
  46. };
  47. }
  48. };
  49. } // end Render namespace
  50. } // end AZ namespace
  51. #if defined(O3DE_GEM_NAME)
  52. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME), AZ::Render::ActorModule)
  53. #else
  54. AZ_DECLARE_MODULE_CLASS(Gem_EMotionFX_Atom, AZ::Render::ActorModule)
  55. #endif