RuntimeAssetSystemComponent.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 <AzCore/Asset/AssetManager.h>
  9. #include <AzCore/Serialization/SerializeContext.h>
  10. #include <ScriptCanvas/Asset/RuntimeAsset.h>
  11. #include <ScriptCanvas/Asset/RuntimeAssetHandler.h>
  12. #include <ScriptCanvas/Asset/SubgraphInterfaceAsset.h>
  13. #include <Asset/RuntimeAssetSystemComponent.h>
  14. #include <Asset/SubgraphInterfaceAssetHandler.h>
  15. #include <Execution/ExecutionState.h>
  16. #include <ScriptCanvas/Execution/Executor.h>
  17. #include <ScriptCanvas/Execution/ExecutionContext.h>
  18. namespace ScriptCanvas
  19. {
  20. RuntimeAssetSystemComponent::~RuntimeAssetSystemComponent()
  21. {
  22. }
  23. void RuntimeAssetSystemComponent::Reflect(AZ::ReflectContext* context)
  24. {
  25. RuntimeData::Reflect(context);
  26. RuntimeDataOverrides::Reflect(context);
  27. SubgraphInterfaceData::Reflect(context);
  28. Executor::Reflect(context);
  29. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  30. {
  31. serializeContext->Class<RuntimeAssetSystemComponent, AZ::Component>()
  32. ->Version(0)
  33. ;
  34. }
  35. }
  36. void RuntimeAssetSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  37. {
  38. provided.push_back(AZ_CRC("ScriptCanvasRuntimeAssetService", 0x1a85bf2b));
  39. }
  40. void RuntimeAssetSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  41. {
  42. required.push_back(AZ_CRC("AssetDatabaseService", 0x3abf5601));
  43. required.push_back(AZ_CRC("ScriptCanvasService", 0x41fd58f3));
  44. }
  45. void RuntimeAssetSystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
  46. {
  47. dependent.push_back(AZ_CRC("AssetCatalogService", 0xc68ffc57));
  48. }
  49. void RuntimeAssetSystemComponent::Init()
  50. {
  51. }
  52. void RuntimeAssetSystemComponent::Activate()
  53. {
  54. m_runtimeAssetRegistry.Register<ScriptCanvas::RuntimeAsset, ScriptCanvas::RuntimeAssetHandler, ScriptCanvas::RuntimeAssetDescription>();
  55. m_runtimeAssetRegistry.Register<ScriptCanvas::SubgraphInterfaceAsset, ScriptCanvas::SubgraphInterfaceAssetHandler, ScriptCanvas::SubgraphInterfaceAssetDescription>();
  56. }
  57. void RuntimeAssetSystemComponent::Deactivate()
  58. {
  59. m_runtimeAssetRegistry.Unregister();
  60. }
  61. AssetRegistry& RuntimeAssetSystemComponent::GetAssetRegistry()
  62. {
  63. return m_runtimeAssetRegistry;
  64. }
  65. }