EditorAssetSystemComponent.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #pragma once
  9. #include <AzCore/Component/Component.h>
  10. #include "EditorAssetConversionBus.h"
  11. #include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
  12. #include <ScriptCanvas/Asset/AssetRegistry.h>
  13. #include <ScriptCanvas/Translation/Translation.h>
  14. namespace ScriptCanvasEditor
  15. {
  16. class EditorAssetSystemComponent
  17. : public AZ::Component
  18. , public EditorAssetConversionBus::Handler
  19. {
  20. public:
  21. AZ_COMPONENT(EditorAssetSystemComponent, "{2FB1C848-B863-4562-9C4B-01E18BD61583}");
  22. EditorAssetSystemComponent() = default;
  23. ~EditorAssetSystemComponent() override;
  24. static void Reflect(AZ::ReflectContext* context);
  25. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  26. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  27. ////////////////////////////////////////////////////////////////////////
  28. // AZ::Component...
  29. void Init() override;
  30. void Activate() override;
  31. void Deactivate() override;
  32. ////////////////////////////////////////////////////////////////////////
  33. //////////////////////////////////////////////////////////////////////////
  34. // EditorAssetConversionBus::Handler...
  35. AZ::Outcome<AZ::Data::Asset<ScriptCanvas::RuntimeAsset>, AZStd::string> CreateRuntimeAsset(const SourceHandle& editAsset) override;
  36. AZ::Outcome<ScriptCanvas::Translation::LuaAssetResult, AZStd::string> CreateLuaAsset(const SourceHandle& editAsset, AZStd::string_view graphPathForRawLuaFile) override;
  37. //////////////////////////////////////////////////////////////////////////
  38. ScriptCanvas::AssetRegistry& GetAssetRegistry();
  39. private:
  40. ScriptCanvas::AssetRegistry m_editorAssetRegistry;
  41. EditorAssetSystemComponent(const EditorAssetSystemComponent&) = delete;
  42. };
  43. }