diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/PostFxLayerComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/PostFxLayerComponentController.cpp index 29f7b56282..981eef159c 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/PostFxLayerComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/PostFxLayerComponentController.cpp @@ -79,7 +79,11 @@ namespace AZ // Add the current view which can potentially be the editor view auto atomViewportRequests = AZ::Interface::Get(); const AZ::Name contextName = atomViewportRequests->GetDefaultViewportContextName(); - allSceneViews.insert(atomViewportRequests->GetCurrentView(contextName).get()); + auto currentView = atomViewportRequests->GetCurrentView(contextName); + if (IsEditorView(currentView)) + { + allSceneViews.insert(currentView.get()); + } // calculate blend weights for all cameras PostProcessSettingsInterface::ViewBlendWeightMap perViewBlendWeights; @@ -146,6 +150,13 @@ namespace AZ { m_cameraEntities.insert(cameraId); } + + AZ::RPI::ViewPtr view = nullptr; + AZ::RPI::ViewProviderBus::EventResult(view, cameraId, &AZ::RPI::ViewProvider::GetView); + if (view != nullptr) + { + m_allCameraViews.insert(view.get()); + } } void PostFxLayerComponentController::OnCameraRemoved(const AZ::EntityId& cameraId) @@ -176,6 +187,11 @@ namespace AZ } } + bool PostFxLayerComponentController::IsEditorView(const AZ::RPI::ViewPtr view) + { + return m_allCameraViews.find(view.get()) == m_allCameraViews.end() ? true : false; + } + bool PostFxLayerComponentController::HasTags(const AZ::EntityId& entityId, const AZStd::vector& tags) const { bool hasTag = false; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/PostFxLayerComponentController.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/PostFxLayerComponentController.h index 6cfa1fe015..05825b4255 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/PostFxLayerComponentController.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/PostFxLayerComponentController.h @@ -73,13 +73,15 @@ namespace AZ void BusConnectToTags(); const AZStd::unordered_set& GetCameraEntityList() const; - + bool IsEditorView(const AZ::RPI::ViewPtr view); bool HasTags(const AZ::EntityId& entityId, const AZStd::vector& tags) const; // list of entities containing tags set in this component's property. AZStd::unordered_set m_taggedCameraEntities; // a list of cameras tracked by this component. This is used if no camera tags are specified. AZStd::unordered_set m_cameraEntities; + // a list of camera views in the scene. This is used to test if a view is an editor view. + AZStd::unordered_set m_allCameraViews; PostProcessFeatureProcessorInterface* m_featureProcessorInterface = nullptr; PostProcessSettingsInterface* m_postProcessInterface = nullptr;