ActorSystemComponent.cpp 2.1 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 <ActorSystemComponent.h>
  9. #include <AtomBackend.h>
  10. #include <Integration/Rendering/RenderBackendManager.h>
  11. #include <AzCore/Serialization/SerializeContext.h>
  12. namespace AZ
  13. {
  14. namespace Render
  15. {
  16. ActorSystemComponent::ActorSystemComponent() = default;
  17. ActorSystemComponent::~ActorSystemComponent() = default;
  18. void ActorSystemComponent::Reflect(ReflectContext* context)
  19. {
  20. if (SerializeContext* serialize = azrtti_cast<SerializeContext*>(context))
  21. {
  22. serialize->Class<ActorSystemComponent, Component>()
  23. ->Version(0)
  24. ;
  25. }
  26. }
  27. void ActorSystemComponent::GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided)
  28. {
  29. provided.push_back(AZ_CRC_CE("ActorSystemService"));
  30. }
  31. void ActorSystemComponent::GetIncompatibleServices(ComponentDescriptor::DependencyArrayType& incompatible)
  32. {
  33. incompatible.push_back(AZ_CRC_CE("ActorSystemService"));
  34. }
  35. void ActorSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  36. {
  37. required.push_back(AZ_CRC_CE("SkinnedMeshService"));
  38. required.push_back(AZ_CRC_CE("EMotionFXAnimationService"));
  39. }
  40. void ActorSystemComponent::Activate()
  41. {
  42. AZ_Assert(AZ::Interface<EMotionFX::Integration::RenderBackendManager>::Get(), "The EMotionFX RenderBackendManger must be initialized before a render backend can register itself.");
  43. // The RenderBackendManager will manage the lifetime of the AtomBackend
  44. AZ::Interface<EMotionFX::Integration::RenderBackendManager>::Get()->SetRenderBackend(aznew AtomBackend());
  45. }
  46. void ActorSystemComponent::Deactivate()
  47. {
  48. }
  49. } // End Render namespace
  50. } // End AZ namespace