3
0

EditorPostFxSystemComponent.h 2.3 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 <AzCore/Asset/AssetCommon.h>
  11. #include <AzFramework/Asset/AssetCatalogBus.h>
  12. #include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
  13. #include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerCategoriesProviderRequestBus.h>
  14. #include <Atom/Feature/PostProcess/PostFxLayerCategoriesConstants.h>
  15. #include <PostProcess/EditorPostFxLayerCategoriesAsset.h>
  16. #include <AzFramework/Asset/GenericAssetHandler.h>
  17. namespace AZ
  18. {
  19. namespace Render
  20. {
  21. class EditorPostFxSystemComponent
  22. : public AzToolsFramework::Components::EditorComponentBase
  23. , private PostFxLayerCategoriesProviderRequestBus::Handler
  24. , private AzFramework::AssetCatalogEventBus::Handler
  25. {
  26. public:
  27. AZ_EDITOR_COMPONENT(EditorPostFxSystemComponent, "{D86D2F88-ACDC-49B3-89D3-AE2EC5B8FEBC}");
  28. static void Reflect(AZ::ReflectContext* context);
  29. void Init() override;
  30. void Activate() override;
  31. void Deactivate() override;
  32. // PostFxLayerCategoriesProviderRequestBus Override
  33. void GetLayerCategories(PostFx::LayerCategoriesMap& layerCategories) const override;
  34. // AssetCatalogEventBus Overrides
  35. void OnCatalogLoaded(const char* catalogFile) override;
  36. void OnCatalogAssetChanged(const AZ::Data::AssetId& assetId) override;
  37. void OnCatalogAssetAdded(const AZ::Data::AssetId& assetId) override;
  38. void OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo& assetInfo) override;
  39. void UpdateLayerCategoriesAssetMap(const AZ::Data::AssetId& assetId);
  40. // Asset handler registration
  41. void RegisterAssethandlers();
  42. void UnregisterAssethandlers();
  43. AzFramework::GenericAssetHandler<EditorPostFxLayerCategoriesAsset>* m_postFxLayerCategoriesAsset = nullptr;
  44. AZStd::unordered_map<AZ::Data::AssetId, AZ::Data::Asset<EditorPostFxLayerCategoriesAsset>> m_layerCategoriesAssetMap;
  45. };
  46. }
  47. }