ATOM-16747 RPISystemInterface::GetDefaultScene returns the scene crea… (#5153) (#5389)

* ATOM-16747 RPISystemInterface::GetDefaultScene returns the scene created by PreviewRenderer but not the Main Scene
Deprecate GetDefaultScene() function.
Update all the places which use GetDefaultScene to use Scene::GetFeatureProcessorFromEntityId or GetMainScene.
Tested with Editor, UI Editor, Material Editor, game launcher.

Signed-off-by: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com>
(cherry picked from commit 8da6bea073)
This commit is contained in:
Qing Tao
2021-11-08 07:49:30 -08:00
committed by GitHub
parent c0d36399db
commit 5a39361f77
27 changed files with 133 additions and 91 deletions
@@ -108,7 +108,7 @@ namespace AZ
{
m_dynamicDrawManager.reset();
AZ::RPI::ViewportContextManagerNotificationsBus::Handler::BusDisconnect();
RPI::Scene* scene = RPI::RPISystemInterface::Get()->GetDefaultScene().get();
RPI::Scene* scene = AZ::RPI::Scene::GetSceneForEntityContextId(m_entityContextId);
// Check if scene is emptry since scene might be released already when running AtomSampleViewer
if (scene)
{
@@ -157,9 +157,9 @@ namespace AZ
void AtomBridgeSystemComponent::OnBootstrapSceneReady(AZ::RPI::Scene* bootstrapScene)
{
AZ_UNUSED(bootstrapScene);
// Make default AtomDebugDisplayViewportInterface
AZStd::shared_ptr<AtomDebugDisplayViewportInterface> mainEntityDebugDisplay = AZStd::make_shared<AtomDebugDisplayViewportInterface>(AzFramework::g_defaultSceneEntityDebugDisplayId);
AZStd::shared_ptr<AtomDebugDisplayViewportInterface> mainEntityDebugDisplay =
AZStd::make_shared<AtomDebugDisplayViewportInterface>(AzFramework::g_defaultSceneEntityDebugDisplayId, bootstrapScene);
m_activeViewportsList[AzFramework::g_defaultSceneEntityDebugDisplayId] = mainEntityDebugDisplay;
}