3
0

AnimationModule.cpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 <Integration/System/SystemComponent.h>
  9. #include <Integration/Components/ActorComponent.h>
  10. #include <Integration/Components/AnimAudioComponent.h>
  11. #include <Integration/Components/AnimGraphComponent.h>
  12. #include <Integration/Components/SimpleMotionComponent.h>
  13. #include <Integration/Components/SimpleLODComponent.h>
  14. #include <AzCore/Module/DynamicModuleHandle.h>
  15. #include <IGem.h>
  16. #if defined (EMOTIONFXANIMATION_EDITOR)
  17. # include <Integration/System/PipelineComponent.h>
  18. # include <Integration/Editor/Components/EditorActorComponent.h>
  19. # include <Integration/Editor/Components/EditorAnimAudioComponent.h>
  20. # include <Integration/Editor/Components/EditorAnimGraphComponent.h>
  21. # include <Integration/Editor/Components/EditorSimpleMotionComponent.h>
  22. # include <Integration/Editor/Components/EditorSimpleLODComponent.h>
  23. # include <SceneAPIExt/Behaviors/ActorGroupBehavior.h>
  24. # include <SceneAPIExt/Behaviors/MotionGroupBehavior.h>
  25. # include <SceneAPIExt/Behaviors/MotionRangeRuleBehavior.h>
  26. # include <SceneAPIExt/Behaviors/MorphTargetRuleBehavior.h>
  27. # include <SceneAPIExt/Behaviors/LodRuleBehavior.h>
  28. # include <SceneAPIExt/Behaviors/SkeletonOptimizationRuleBehavior.h>
  29. # include <SceneAPIExt/Behaviors/RootMotionExtractionRuleBehavior.h>
  30. # include <RCExt/Actor/ActorExporter.h>
  31. # include <RCExt/Actor/ActorGroupExporter.h>
  32. # include <RCExt/Actor/ActorBuilder.h>
  33. # include <RCExt/Actor/MorphTargetExporter.h>
  34. # include <RCExt/Motion/MotionExporter.h>
  35. # include <RCExt/Motion/MotionGroupExporter.h>
  36. # include <RCExt/Motion/MotionDataBuilder.h>
  37. # include <EMotionFXBuilder/EMotionFXBuilderComponent.h>
  38. #endif // EMOTIONFXANIMATION_EDITOR
  39. namespace EMotionFX
  40. {
  41. namespace Integration
  42. {
  43. /**
  44. * Animation module class for EMotion FX animation gem.
  45. */
  46. class EMotionFXIntegrationModule
  47. : public CryHooksModule
  48. {
  49. public:
  50. AZ_CLASS_ALLOCATOR(EMotionFXIntegrationModule, AZ::SystemAllocator)
  51. AZ_RTTI(EMotionFXIntegrationModule, "{02533EDC-F2AA-4076-86E9-5E3702202E15}", CryHooksModule);
  52. EMotionFXIntegrationModule()
  53. : CryHooksModule()
  54. {
  55. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  56. m_descriptors.insert(m_descriptors.end(), {
  57. // System components
  58. SystemComponent::CreateDescriptor(),
  59. // Runtime components
  60. ActorComponent::CreateDescriptor(),
  61. AnimAudioComponent::CreateDescriptor(),
  62. AnimGraphComponent::CreateDescriptor(),
  63. SimpleMotionComponent::CreateDescriptor(),
  64. SimpleLODComponent::CreateDescriptor(),
  65. #if defined(EMOTIONFXANIMATION_EDITOR)
  66. // Pipeline components
  67. EMotionFX::Pipeline::PipelineComponent::CreateDescriptor(),
  68. // Editor components
  69. EditorActorComponent::CreateDescriptor(),
  70. EditorAnimAudioComponent::CreateDescriptor(),
  71. EditorAnimGraphComponent::CreateDescriptor(),
  72. EditorSimpleMotionComponent::CreateDescriptor(),
  73. EditorSimpleLODComponent::CreateDescriptor(),
  74. // EmotionFX asset builder
  75. EMotionFXBuilder::EMotionFXBuilderComponent::CreateDescriptor(),
  76. // Actor
  77. EMotionFX::Pipeline::Behavior::ActorGroupBehavior::CreateDescriptor(),
  78. EMotionFX::Pipeline::Behavior::MorphTargetRuleBehavior::CreateDescriptor(),
  79. EMotionFX::Pipeline::Behavior::LodRuleBehavior::CreateDescriptor(),
  80. EMotionFX::Pipeline::Behavior::SkeletonOptimizationRuleBehavior::CreateDescriptor(),
  81. EMotionFX::Pipeline::ActorExporter::CreateDescriptor(),
  82. EMotionFX::Pipeline::ActorGroupExporter::CreateDescriptor(),
  83. EMotionFX::Pipeline::ActorBuilder::CreateDescriptor(),
  84. EMotionFX::Pipeline::MorphTargetExporter::CreateDescriptor(),
  85. // Motion
  86. EMotionFX::Pipeline::Behavior::MotionGroupBehavior::CreateDescriptor(),
  87. EMotionFX::Pipeline::Behavior::MotionRangeRuleBehavior::CreateDescriptor(),
  88. EMotionFX::Pipeline::Behavior::RootMotionExtractionRuleBehavior::CreateDescriptor(),
  89. EMotionFX::Pipeline::MotionExporter::CreateDescriptor(),
  90. EMotionFX::Pipeline::MotionGroupExporter::CreateDescriptor(),
  91. EMotionFX::Pipeline::MotionDataBuilder::CreateDescriptor()
  92. #endif // EMOTIONFXANIMATION_EDITOR
  93. });
  94. }
  95. ~EMotionFXIntegrationModule()
  96. {
  97. }
  98. /**
  99. * Add required SystemComponents to the SystemEntity.
  100. */
  101. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  102. {
  103. return AZ::ComponentTypeList{
  104. azrtti_typeid<SystemComponent>(),
  105. };
  106. }
  107. };
  108. }
  109. }
  110. #if defined(EMOTIONFXANIMATION_EDITOR)
  111. #include <QDir>
  112. // Qt resources are defined in the EMotionFX.Editor static library, so we must
  113. // initialize them manually
  114. extern int qInitResources_Resources();
  115. extern int qCleanupResources_Resources();
  116. namespace {
  117. struct initializer {
  118. initializer() { qInitResources_Resources(); }
  119. ~initializer() { qCleanupResources_Resources(); }
  120. } dummy;
  121. } // namespace
  122. #endif
  123. #if defined(O3DE_GEM_NAME)
  124. AZ_DECLARE_MODULE_CLASS(AZ_JOIN(Gem_, O3DE_GEM_NAME), EMotionFX::Integration::EMotionFXIntegrationModule)
  125. #else
  126. AZ_DECLARE_MODULE_CLASS(Gem_EMotionFX, EMotionFX::Integration::EMotionFXIntegrationModule)
  127. #endif