From 58194b70c0e72675cd78cda101284af8ddf52c68 Mon Sep 17 00:00:00 2001 From: Guthrie Adams Date: Thu, 7 Oct 2021 13:27:14 -0500 Subject: [PATCH] Updated code to compile and reflect changes after renaming files Signed-off-by: Guthrie Adams --- ...=> PreviewerFeatureProcessorProviderBus.h} | 10 +- .../EditorCommonFeaturesSystemComponent.cpp | 2 +- .../EditorCommonFeaturesSystemComponent.h | 6 +- .../Code/Source/Material/MaterialThumbnail.h | 2 +- .../Rendering/CommonPreviewRenderer.cpp | 92 +++++++++---------- .../Rendering/CommonPreviewRenderer.h | 34 +++---- .../CommonPreviewRendererCaptureState.cpp | 16 ++-- .../CommonPreviewRendererCaptureState.h | 10 +- .../CommonPreviewRendererIdleState.cpp | 14 +-- .../CommonPreviewRendererIdleState.h | 10 +- .../CommonPreviewRendererLoadState.cpp | 16 ++-- .../CommonPreviewRendererLoadState.h | 11 ++- .../Rendering/CommonPreviewRendererState.h | 16 ++-- ...egration_commonfeatures_editor_files.cmake | 20 ++-- 14 files changed, 129 insertions(+), 130 deletions(-) rename Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/Thumbnails/{ThumbnailFeatureProcessorProviderBus.h => PreviewerFeatureProcessorProviderBus.h} (67%) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/Thumbnails/ThumbnailFeatureProcessorProviderBus.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/Thumbnails/PreviewerFeatureProcessorProviderBus.h similarity index 67% rename from Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/Thumbnails/ThumbnailFeatureProcessorProviderBus.h rename to Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/Thumbnails/PreviewerFeatureProcessorProviderBus.h index a4d76809ba..ef0e586348 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/Thumbnails/ThumbnailFeatureProcessorProviderBus.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/Thumbnails/PreviewerFeatureProcessorProviderBus.h @@ -16,18 +16,18 @@ namespace AZ { namespace Thumbnails { - //! ThumbnailFeatureProcessorProviderRequests allows registering custom Feature Processors for thumbnail generation + //! PreviewerFeatureProcessorProviderRequests allows registering custom Feature Processors for thumbnail generation //! Duplicates will be ignored - //! You can check minimal feature processors that are already registered in CommonThumbnailRenderer.cpp - class ThumbnailFeatureProcessorProviderRequests + //! You can check minimal feature processors that are already registered in CommonPreviewRenderer.cpp + class PreviewerFeatureProcessorProviderRequests : public AZ::EBusTraits { public: //! Get a list of custom feature processors to register with thumbnail renderer - virtual void GetCustomFeatureProcessors(AZStd::unordered_set& featureProcessors) const = 0; + virtual void GetRequiredFeatureProcessors(AZStd::unordered_set& featureProcessors) const = 0; }; - using ThumbnailFeatureProcessorProviderBus = AZ::EBus; + using PreviewerFeatureProcessorProviderBus = AZ::EBus; } // namespace Thumbnails } // namespace LyIntegration } // namespace AZ diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.cpp index 8be947ae26..0355351654 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.cpp @@ -194,7 +194,7 @@ namespace AZ void EditorCommonFeaturesSystemComponent::OnCatalogLoaded([[maybe_unused]] const char* catalogFile) { AZ::TickBus::QueueFunction([this](){ - m_renderer = AZStd::make_unique(); + m_renderer = AZStd::make_unique(); m_previewerFactory = AZStd::make_unique(); }); } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.h index d26886c4ae..90dc5fcf2e 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/EditorCommonFeaturesSystemComponent.h @@ -11,10 +11,10 @@ #include #include #include -#include #include -#include +#include #include +#include namespace AZ { @@ -73,7 +73,7 @@ namespace AZ AZStd::string m_atomLevelDefaultAssetPath{ "LevelAssets/default.slice" }; float m_envProbeHeight{ 200.0f }; - AZStd::unique_ptr m_renderer; + AZStd::unique_ptr m_renderer; AZStd::unique_ptr m_previewerFactory; }; } // namespace Render diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialThumbnail.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialThumbnail.h index dba922a1b2..d323a04a1f 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialThumbnail.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialThumbnail.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #endif namespace AZ diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRenderer.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRenderer.cpp index d12d9df892..b24de64b42 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRenderer.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRenderer.cpp @@ -37,10 +37,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace AZ @@ -49,13 +49,13 @@ namespace AZ { namespace Thumbnails { - CommonThumbnailRenderer::CommonThumbnailRenderer() + CommonPreviewRenderer::CommonPreviewRenderer() { - // CommonThumbnailRenderer supports both models and materials, but we connect on materialAssetType + // CommonPreviewRenderer supports both models and materials, but we connect on materialAssetType // since MaterialOrModelThumbnail dispatches event on materialAssetType address too AzToolsFramework::Thumbnailer::ThumbnailerRendererRequestBus::MultiHandler::BusConnect(RPI::MaterialAsset::RTTI_Type()); AzToolsFramework::Thumbnailer::ThumbnailerRendererRequestBus::MultiHandler::BusConnect(RPI::ModelAsset::RTTI_Type()); - ThumbnailFeatureProcessorProviderBus::Handler::BusConnect(); + PreviewerFeatureProcessorProviderBus::Handler::BusConnect(); SystemTickBus::Handler::BusConnect(); m_entityContext = AZStd::make_unique(); @@ -63,8 +63,8 @@ namespace AZ // Create and register a scene with all required feature processors AZStd::unordered_set featureProcessors; - ThumbnailFeatureProcessorProviderBus::Broadcast( - &ThumbnailFeatureProcessorProviderBus::Handler::GetCustomFeatureProcessors, featureProcessors); + PreviewerFeatureProcessorProviderBus::Broadcast( + &PreviewerFeatureProcessorProviderBus::Handler::GetRequiredFeatureProcessors, featureProcessors); RPI::SceneDescriptor sceneDesc; sceneDesc.m_featureProcessorNames.assign(featureProcessors.begin(), featureProcessors.end()); @@ -118,19 +118,19 @@ namespace AZ m_defaultMaterialAsset.Create(DefaultMaterialAssetId, true); m_defaultModelAsset.Create(DefaultModelAssetId, true); - m_steps[CommonThumbnailRenderer::Step::FindThumbnailToRender] = AZStd::make_shared(this); - m_steps[CommonThumbnailRenderer::Step::WaitForAssetsToLoad] = AZStd::make_shared(this); - m_steps[CommonThumbnailRenderer::Step::Capture] = AZStd::make_shared(this); - SetStep(CommonThumbnailRenderer::Step::FindThumbnailToRender); + m_steps[CommonPreviewRenderer::State::IdleState] = AZStd::make_shared(this); + m_steps[CommonPreviewRenderer::State::LoadState] = AZStd::make_shared(this); + m_steps[CommonPreviewRenderer::State::CaptureState] = AZStd::make_shared(this); + SetState(CommonPreviewRenderer::State::IdleState); } - CommonThumbnailRenderer::~CommonThumbnailRenderer() + CommonPreviewRenderer::~CommonPreviewRenderer() { AzToolsFramework::Thumbnailer::ThumbnailerRendererRequestBus::MultiHandler::BusDisconnect(); SystemTickBus::Handler::BusDisconnect(); - ThumbnailFeatureProcessorProviderBus::Handler::BusDisconnect(); + PreviewerFeatureProcessorProviderBus::Handler::BusDisconnect(); - SetStep(CommonThumbnailRenderer::Step::None); + SetState(CommonPreviewRenderer::State::None); if (m_modelEntity) { @@ -146,29 +146,29 @@ namespace AZ m_frameworkScene->UnsetSubsystem(m_entityContext.get()); } - void CommonThumbnailRenderer::SetStep(Step step) + void CommonPreviewRenderer::SetState(State state) { - auto stepItr = m_steps.find(m_currentStep); + auto stepItr = m_steps.find(m_currentState); if (stepItr != m_steps.end()) { stepItr->second->Stop(); } - m_currentStep = step; + m_currentState = state; - stepItr = m_steps.find(m_currentStep); + stepItr = m_steps.find(m_currentState); if (stepItr != m_steps.end()) { stepItr->second->Start(); } } - CommonThumbnailRenderer::Step CommonThumbnailRenderer::GetStep() const + CommonPreviewRenderer::State CommonPreviewRenderer::GetState() const { - return m_currentStep; + return m_currentState; } - void CommonThumbnailRenderer::SelectThumbnail() + void CommonPreviewRenderer::SelectThumbnail() { if (!m_thumbnailInfoQueue.empty()) { @@ -176,23 +176,23 @@ namespace AZ m_currentThubnailInfo = m_thumbnailInfoQueue.front(); m_thumbnailInfoQueue.pop(); - SetStep(CommonThumbnailRenderer::Step::WaitForAssetsToLoad); + SetState(CommonPreviewRenderer::State::LoadState); } } - void CommonThumbnailRenderer::CancelThumbnail() + void CommonPreviewRenderer::CancelThumbnail() { AzToolsFramework::Thumbnailer::ThumbnailerRendererNotificationBus::Event( m_currentThubnailInfo.m_key, &AzToolsFramework::Thumbnailer::ThumbnailerRendererNotifications::ThumbnailFailedToRender); - SetStep(CommonThumbnailRenderer::Step::FindThumbnailToRender); + SetState(CommonPreviewRenderer::State::IdleState); } - void CommonThumbnailRenderer::CompleteThumbnail() + void CommonPreviewRenderer::CompleteThumbnail() { - SetStep(CommonThumbnailRenderer::Step::FindThumbnailToRender); + SetState(CommonPreviewRenderer::State::IdleState); } - void CommonThumbnailRenderer::LoadAssets() + void CommonPreviewRenderer::LoadAssets() { // Determine if thumbnailkey contains a material asset or set a default material const Data::AssetId materialAssetId = GetAssetId(m_currentThubnailInfo.m_key, RPI::MaterialAsset::RTTI_Type()); @@ -207,11 +207,11 @@ namespace AZ m_lightingPresetAsset.Create(lightingPresetAssetId.IsValid() ? lightingPresetAssetId : DefaultLightingPresetAssetId, true); } - void CommonThumbnailRenderer::UpdateLoadAssets() + void CommonPreviewRenderer::UpdateLoadAssets() { if (m_materialAsset.IsReady() && m_modelAsset.IsReady() && m_lightingPresetAsset.IsReady()) { - SetStep(CommonThumbnailRenderer::Step::Capture); + SetState(CommonPreviewRenderer::State::CaptureState); return; } @@ -222,28 +222,28 @@ namespace AZ } } - void CommonThumbnailRenderer::CancelLoadAssets() + void CommonPreviewRenderer::CancelLoadAssets() { AZ_Warning( - "CommonThumbnailRenderer", m_materialAsset.IsReady(), "Asset failed to load in time: %s", + "CommonPreviewRenderer", m_materialAsset.IsReady(), "Asset failed to load in time: %s", m_materialAsset.ToString().c_str()); AZ_Warning( - "CommonThumbnailRenderer", m_modelAsset.IsReady(), "Asset failed to load in time: %s", + "CommonPreviewRenderer", m_modelAsset.IsReady(), "Asset failed to load in time: %s", m_modelAsset.ToString().c_str()); AZ_Warning( - "CommonThumbnailRenderer", m_lightingPresetAsset.IsReady(), "Asset failed to load in time: %s", + "CommonPreviewRenderer", m_lightingPresetAsset.IsReady(), "Asset failed to load in time: %s", m_lightingPresetAsset.ToString().c_str()); CancelThumbnail(); } - void CommonThumbnailRenderer::UpdateScene() + void CommonPreviewRenderer::UpdateScene() { UpdateModel(); UpdateLighting(); UpdateCamera(); } - void CommonThumbnailRenderer::UpdateModel() + void CommonPreviewRenderer::UpdateModel() { Render::MaterialComponentRequestBus::Event( m_modelEntity->GetId(), &Render::MaterialComponentRequestBus::Events::SetDefaultMaterialOverride, @@ -253,7 +253,7 @@ namespace AZ m_modelEntity->GetId(), &Render::MeshComponentRequestBus::Events::SetModelAsset, m_modelAsset); } - void CommonThumbnailRenderer::UpdateLighting() + void CommonPreviewRenderer::UpdateLighting() { auto preset = m_lightingPresetAsset->GetDataAs(); if (preset) @@ -283,7 +283,7 @@ namespace AZ } } - void CommonThumbnailRenderer::UpdateCamera() + void CommonPreviewRenderer::UpdateCamera() { // Get bounding sphere of the model asset and estimate how far the camera needs to be see all of it Vector3 center = {}; @@ -297,7 +297,7 @@ namespace AZ m_view->SetCameraTransform(Matrix3x4::CreateFromTransform(cameraTransform)); } - RPI::AttachmentReadback::CallbackFunction CommonThumbnailRenderer::GetCaptureCallback() + RPI::AttachmentReadback::CallbackFunction CommonPreviewRenderer::GetCaptureCallback() { return [this](const RPI::AttachmentReadback::ReadbackResult& result) { @@ -320,7 +320,7 @@ namespace AZ }; } - bool CommonThumbnailRenderer::StartCapture() + bool CommonPreviewRenderer::StartCapture() { if (auto renderToTexturePass = azrtti_cast(m_renderPipeline->GetRootPass().get())) { @@ -336,22 +336,22 @@ namespace AZ return startedCapture; } - void CommonThumbnailRenderer::EndCapture() + void CommonPreviewRenderer::EndCapture() { m_renderPipeline->RemoveFromRenderTick(); } - bool CommonThumbnailRenderer::Installed() const + bool CommonPreviewRenderer::Installed() const { return true; } - void CommonThumbnailRenderer::OnSystemTick() + void CommonPreviewRenderer::OnSystemTick() { AzToolsFramework::Thumbnailer::ThumbnailerRendererRequestBus::ExecuteQueuedEvents(); } - void CommonThumbnailRenderer::GetCustomFeatureProcessors(AZStd::unordered_set& featureProcessors) const + void CommonPreviewRenderer::GetRequiredFeatureProcessors(AZStd::unordered_set& featureProcessors) const { featureProcessors.insert({ "AZ::Render::TransformServiceFeatureProcessor", @@ -373,7 +373,7 @@ namespace AZ "AZ::Render::SkyBoxFeatureProcessor" }); } - void CommonThumbnailRenderer::RenderThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey thumbnailKey, int thumbnailSize) + void CommonPreviewRenderer::RenderThumbnail(AzToolsFramework::Thumbnailer::SharedThumbnailKey thumbnailKey, int thumbnailSize) { m_thumbnailInfoQueue.push({ thumbnailKey, thumbnailSize }); } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRenderer.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRenderer.h index 2b1ccbd4e6..259063cfdf 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRenderer.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRenderer.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,30 +37,30 @@ namespace AZ { namespace Thumbnails { - class ThumbnailRendererStep; + class CommonPreviewRendererState; //! Provides custom rendering of material and model thumbnails - class CommonThumbnailRenderer + class CommonPreviewRenderer : public AzToolsFramework::Thumbnailer::ThumbnailerRendererRequestBus::MultiHandler , public SystemTickBus::Handler - , public ThumbnailFeatureProcessorProviderBus::Handler + , public PreviewerFeatureProcessorProviderBus::Handler { public: - AZ_CLASS_ALLOCATOR(CommonThumbnailRenderer, AZ::SystemAllocator, 0) + AZ_CLASS_ALLOCATOR(CommonPreviewRenderer, AZ::SystemAllocator, 0) - CommonThumbnailRenderer(); - ~CommonThumbnailRenderer(); + CommonPreviewRenderer(); + ~CommonPreviewRenderer(); - enum class Step : AZ::s8 + enum class State : AZ::s8 { None, - FindThumbnailToRender, - WaitForAssetsToLoad, - Capture + IdleState, + LoadState, + CaptureState }; - void SetStep(Step step); - Step GetStep() const; + void SetState(State state); + State GetState() const; void SelectThumbnail(); void CancelThumbnail(); @@ -87,8 +87,8 @@ namespace AZ //! SystemTickBus::Handler interface overrides... void OnSystemTick() override; - //! Render::ThumbnailFeatureProcessorProviderBus::Handler interface overrides... - void GetCustomFeatureProcessors(AZStd::unordered_set& featureProcessors) const override; + //! Render::PreviewerFeatureProcessorProviderBus::Handler interface overrides... + void GetRequiredFeatureProcessors(AZStd::unordered_set& featureProcessors) const override; static constexpr float AspectRatio = 1.0f; static constexpr float NearDist = 0.001f; @@ -114,8 +114,8 @@ namespace AZ AZStd::queue m_thumbnailInfoQueue; ThumbnailInfo m_currentThubnailInfo; - AZStd::unordered_map> m_steps; - Step m_currentStep = CommonThumbnailRenderer::Step::None; + AZStd::unordered_map> m_steps; + State m_currentState = CommonPreviewRenderer::State::None; static constexpr const char* DefaultLightingPresetPath = "lightingpresets/thumbnail.lightingpreset.azasset"; const Data::AssetId DefaultLightingPresetAssetId = AZ::RPI::AssetUtils::GetAssetIdForProductPath(DefaultLightingPresetPath); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.cpp index 0686ffb971..e77b9709ac 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.cpp @@ -6,8 +6,8 @@ * */ -#include -#include +#include +#include namespace AZ { @@ -15,26 +15,26 @@ namespace AZ { namespace Thumbnails { - CaptureStep::CaptureStep(CommonThumbnailRenderer* renderer) - : ThumbnailRendererStep(renderer) + CommonPreviewRendererCaptureState::CommonPreviewRendererCaptureState(CommonPreviewRenderer* renderer) + : CommonPreviewRendererState(renderer) { } - void CaptureStep::Start() + void CommonPreviewRendererCaptureState::Start() { m_ticksToCapture = 1; m_renderer->UpdateScene(); TickBus::Handler::BusConnect(); } - void CaptureStep::Stop() + void CommonPreviewRendererCaptureState::Stop() { m_renderer->EndCapture(); TickBus::Handler::BusDisconnect(); Render::FrameCaptureNotificationBus::Handler::BusDisconnect(); } - void CaptureStep::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] ScriptTimePoint time) + void CommonPreviewRendererCaptureState::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] ScriptTimePoint time) { if (m_ticksToCapture-- <= 0) { @@ -47,7 +47,7 @@ namespace AZ } } - void CaptureStep::OnCaptureFinished( + void CommonPreviewRendererCaptureState::OnCaptureFinished( [[maybe_unused]] Render::FrameCaptureResult result, [[maybe_unused]] const AZStd::string& info) { m_renderer->CompleteThumbnail(); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.h index 46d642ce53..c19f12d9bb 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace AZ { @@ -18,14 +18,14 @@ namespace AZ { namespace Thumbnails { - //! CaptureStep renders a thumbnail to a pixmap and notifies MaterialOrModelThumbnail once finished - class CaptureStep - : public ThumbnailRendererStep + //! CommonPreviewRendererCaptureState renders a thumbnail to a pixmap and notifies MaterialOrModelThumbnail once finished + class CommonPreviewRendererCaptureState + : public CommonPreviewRendererState , private TickBus::Handler , private Render::FrameCaptureNotificationBus::Handler { public: - CaptureStep(CommonThumbnailRenderer* renderer); + CommonPreviewRendererCaptureState(CommonPreviewRenderer* renderer); void Start() override; void Stop() override; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.cpp index d9c978605a..b272faef30 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.cpp @@ -6,8 +6,8 @@ * */ -#include -#include +#include +#include namespace AZ { @@ -15,22 +15,22 @@ namespace AZ { namespace Thumbnails { - FindThumbnailToRenderStep::FindThumbnailToRenderStep(CommonThumbnailRenderer* renderer) - : ThumbnailRendererStep(renderer) + CommonPreviewRendererIdleState::CommonPreviewRendererIdleState(CommonPreviewRenderer* renderer) + : CommonPreviewRendererState(renderer) { } - void FindThumbnailToRenderStep::Start() + void CommonPreviewRendererIdleState::Start() { TickBus::Handler::BusConnect(); } - void FindThumbnailToRenderStep::Stop() + void CommonPreviewRendererIdleState::Stop() { TickBus::Handler::BusDisconnect(); } - void FindThumbnailToRenderStep::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] ScriptTimePoint time) + void CommonPreviewRendererIdleState::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] ScriptTimePoint time) { m_renderer->SelectThumbnail(); } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.h index 6ba9b974a1..3278149b98 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.h @@ -8,7 +8,7 @@ #pragma once -#include +#include namespace AZ { @@ -16,13 +16,13 @@ namespace AZ { namespace Thumbnails { - //! FindThumbnailToRenderStep checks whether there are any new thumbnails that need to be rendered every tick - class FindThumbnailToRenderStep - : public ThumbnailRendererStep + //! CommonPreviewRendererIdleState checks whether there are any new thumbnails that need to be rendered every tick + class CommonPreviewRendererIdleState + : public CommonPreviewRendererState , private TickBus::Handler { public: - FindThumbnailToRenderStep(CommonThumbnailRenderer* renderer); + CommonPreviewRendererIdleState(CommonPreviewRenderer* renderer); void Start() override; void Stop() override; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.cpp index 53a5b596d4..dcac673de2 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.cpp @@ -6,10 +6,8 @@ * */ -#include "Thumbnails/ThumbnailerBus.h" -#include -#include -#include +#include +#include namespace AZ { @@ -17,24 +15,24 @@ namespace AZ { namespace Thumbnails { - WaitForAssetsToLoadStep::WaitForAssetsToLoadStep(CommonThumbnailRenderer* renderer) - : ThumbnailRendererStep(renderer) + CommonPreviewRendererLoadState::CommonPreviewRendererLoadState(CommonPreviewRenderer* renderer) + : CommonPreviewRendererState(renderer) { } - void WaitForAssetsToLoadStep::Start() + void CommonPreviewRendererLoadState::Start() { m_renderer->LoadAssets(); m_timeRemainingS = TimeOutS; TickBus::Handler::BusConnect(); } - void WaitForAssetsToLoadStep::Stop() + void CommonPreviewRendererLoadState::Stop() { TickBus::Handler::BusDisconnect(); } - void WaitForAssetsToLoadStep::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) + void CommonPreviewRendererLoadState::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { m_timeRemainingS -= deltaTime; if (m_timeRemainingS > 0.0f) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.h index 0202ef1045..438fd774ca 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.h @@ -8,7 +8,8 @@ #pragma once -#include +#include +#include namespace AZ { @@ -16,13 +17,13 @@ namespace AZ { namespace Thumbnails { - //! WaitForAssetsToLoadStep pauses further rendering until all assets used for rendering a thumbnail have been loaded - class WaitForAssetsToLoadStep - : public ThumbnailRendererStep + //! CommonPreviewRendererLoadState pauses further rendering until all assets used for rendering a thumbnail have been loaded + class CommonPreviewRendererLoadState + : public CommonPreviewRendererState , private TickBus::Handler { public: - WaitForAssetsToLoadStep(CommonThumbnailRenderer* renderer); + CommonPreviewRendererLoadState(CommonPreviewRenderer* renderer); void Start() override; void Stop() override; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererState.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererState.h index 0a629e7e25..9dbf50ab0e 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererState.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Thumbnails/Rendering/CommonPreviewRendererState.h @@ -14,22 +14,22 @@ namespace AZ { namespace Thumbnails { - class CommonThumbnailRenderer; + class CommonPreviewRenderer; - //! ThumbnailRendererStep decouples CommonThumbnailRenderer logic into easy-to-understand and debug pieces - class ThumbnailRendererStep + //! CommonPreviewRendererState decouples CommonPreviewRenderer logic into easy-to-understand and debug pieces + class CommonPreviewRendererState { public: - explicit ThumbnailRendererStep(CommonThumbnailRenderer* renderer) : m_renderer(renderer) {} - virtual ~ThumbnailRendererStep() = default; + explicit CommonPreviewRendererState(CommonPreviewRenderer* renderer) : m_renderer(renderer) {} + virtual ~CommonPreviewRendererState() = default; - //! Start is called when step begins execution + //! Start is called when state begins execution virtual void Start() {} - //! Stop is called when step ends execution + //! Stop is called when state ends execution virtual void Stop() {} protected: - CommonThumbnailRenderer* m_renderer; + CommonPreviewRenderer* m_renderer; }; } // namespace Thumbnails } // namespace LyIntegration diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/atomlyintegration_commonfeatures_editor_files.cmake b/Gems/AtomLyIntegration/CommonFeatures/Code/atomlyintegration_commonfeatures_editor_files.cmake index ffc3f257b0..e96f199f5e 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/atomlyintegration_commonfeatures_editor_files.cmake +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/atomlyintegration_commonfeatures_editor_files.cmake @@ -9,7 +9,7 @@ set(FILES Include/AtomLyIntegration/CommonFeatures/Material/EditorMaterialSystemComponentRequestBus.h Include/AtomLyIntegration/CommonFeatures/ReflectionProbe/EditorReflectionProbeBus.h - Include/AtomLyIntegration/CommonFeatures/Thumbnails/ThumbnailFeatureProcessorProviderBus.h + Include/AtomLyIntegration/CommonFeatures/Thumbnails/PreviewerFeatureProcessorProviderBus.h Source/Module.cpp Source/Animation/EditorAttachmentComponent.h Source/Animation/EditorAttachmentComponent.cpp @@ -102,15 +102,15 @@ set(FILES Source/Thumbnails/Preview/CommonPreviewer.ui Source/Thumbnails/Preview/CommonPreviewerFactory.cpp Source/Thumbnails/Preview/CommonPreviewerFactory.h - Source/Thumbnails/Rendering/CommonThumbnailRenderer.cpp - Source/Thumbnails/Rendering/CommonThumbnailRenderer.h - Source/Thumbnails/Rendering/ThumbnailRendererSteps/ThumbnailRendererStep.h - Source/Thumbnails/Rendering/ThumbnailRendererSteps/FindThumbnailToRenderStep.cpp - Source/Thumbnails/Rendering/ThumbnailRendererSteps/FindThumbnailToRenderStep.h - Source/Thumbnails/Rendering/ThumbnailRendererSteps/WaitForAssetsToLoadStep.cpp - Source/Thumbnails/Rendering/ThumbnailRendererSteps/WaitForAssetsToLoadStep.h - Source/Thumbnails/Rendering/ThumbnailRendererSteps/CaptureStep.cpp - Source/Thumbnails/Rendering/ThumbnailRendererSteps/CaptureStep.h + Source/Thumbnails/Rendering/CommonPreviewRenderer.cpp + Source/Thumbnails/Rendering/CommonPreviewRenderer.h + Source/Thumbnails/Rendering/CommonPreviewRendererState.h + Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.cpp + Source/Thumbnails/Rendering/CommonPreviewRendererIdleState.h + Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.cpp + Source/Thumbnails/Rendering/CommonPreviewRendererLoadState.h + Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.cpp + Source/Thumbnails/Rendering/CommonPreviewRendererCaptureState.h Source/Scripting/EditorEntityReferenceComponent.cpp Source/Scripting/EditorEntityReferenceComponent.h Source/SurfaceData/EditorSurfaceDataMeshComponent.cpp