Fix postfx camera tags (#1417)

main
hershey5045 5 years ago committed by GitHub
parent c02345fd71
commit 85af8475a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -79,7 +79,11 @@ namespace AZ
// Add the current view which can potentially be the editor view
auto atomViewportRequests = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::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<AZStd::string>& tags) const
{
bool hasTag = false;

@ -73,13 +73,15 @@ namespace AZ
void BusConnectToTags();
const AZStd::unordered_set<AZ::EntityId>& GetCameraEntityList() const;
bool IsEditorView(const AZ::RPI::ViewPtr view);
bool HasTags(const AZ::EntityId& entityId, const AZStd::vector<AZStd::string>& tags) const;
// list of entities containing tags set in this component's property.
AZStd::unordered_set<AZ::EntityId> m_taggedCameraEntities;
// a list of cameras tracked by this component. This is used if no camera tags are specified.
AZStd::unordered_set<AZ::EntityId> 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<AZ::RPI::View*> m_allCameraViews;
PostProcessFeatureProcessorInterface* m_featureProcessorInterface = nullptr;
PostProcessSettingsInterface* m_postProcessInterface = nullptr;

Loading…
Cancel
Save