3
0

EditorCommonFeaturesSystemComponent.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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/Asset/AssetCommon.h>
  10. #include <AzCore/Component/Component.h>
  11. #include <AzFramework/Application/Application.h>
  12. #include <AzToolsFramework/API/EditorLevelNotificationBus.h>
  13. #include <AzToolsFramework/AssetBrowser/Previewer/PreviewerBus.h>
  14. #include <AzToolsFramework/Entity/SliceEditorEntityOwnershipServiceBus.h>
  15. #include <SharedPreview/SharedPreviewerFactory.h>
  16. #include <SharedPreview/SharedThumbnailRenderer.h>
  17. namespace AZ
  18. {
  19. namespace Render
  20. {
  21. class SkinnedMeshDebugDisplay;
  22. //! This is the editor-counterpart to this gem's main CommonSystemComponent class.
  23. class EditorCommonFeaturesSystemComponent
  24. : public AZ::Component
  25. , public AzToolsFramework::EditorLevelNotificationBus::Handler
  26. , public AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler
  27. , public AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler
  28. , public AzFramework::ApplicationLifecycleEvents::Bus::Handler
  29. {
  30. public:
  31. AZ_COMPONENT(EditorCommonFeaturesSystemComponent, "{D73D77CF-D5AF-428B-909B-324E96D3DEF5}");
  32. EditorCommonFeaturesSystemComponent();
  33. ~EditorCommonFeaturesSystemComponent();
  34. static void Reflect(AZ::ReflectContext* context);
  35. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  36. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  37. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  38. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  39. protected:
  40. // AZ::Component interface implementation
  41. void Init() override;
  42. void Activate() override;
  43. void Deactivate() override;
  44. // EditorLevelNotificationBus overrides ...
  45. void OnNewLevelCreated() override;
  46. // SliceEditorEntityOwnershipServiceBus overrides ...
  47. void OnSliceInstantiated(
  48. const AZ::Data::AssetId&, AZ::SliceComponent::SliceInstanceAddress&, const AzFramework::SliceInstantiationTicket&) override;
  49. void OnSliceInstantiationFailed(const AZ::Data::AssetId&, const AzFramework::SliceInstantiationTicket&) override;
  50. // AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler overrides...
  51. const AzToolsFramework::AssetBrowser::PreviewerFactory* GetPreviewerFactory(
  52. const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const override;
  53. // AzFramework::ApplicationLifecycleEvents overrides...
  54. void OnApplicationAboutToStop() override;
  55. void SetupThumbnails();
  56. void TeardownThumbnails();
  57. private:
  58. AZStd::unique_ptr<SkinnedMeshDebugDisplay> m_skinnedMeshDebugDisplay;
  59. AZ::Data::AssetId m_levelDefaultSliceAssetId;
  60. AZStd::string m_atomLevelDefaultAssetPath{ "LevelAssets/default.slice" };
  61. float m_envProbeHeight{ 200.0f };
  62. AZStd::unique_ptr<AZ::LyIntegration::SharedThumbnailRenderer> m_thumbnailRenderer;
  63. AZStd::unique_ptr<LyIntegration::SharedPreviewerFactory> m_previewerFactory;
  64. AZ::SettingsRegistryInterface::NotifyEventHandler m_criticalAssetsHandler;
  65. };
  66. } // namespace Render
  67. } // namespace AZ