Merge pull request #839 from aws-lumberyard-dev/nvsickle/BootstrapFixes

Fix dummy rendering pipeline being created for the Editor
This commit is contained in:
Nicholas Van Sickle
2021-05-20 12:10:22 -07:00
committed by GitHub
3 changed files with 18 additions and 12 deletions
@@ -457,15 +457,6 @@ void EditorViewportWidget::Update()
return;
}
static bool sentOnWindowCreated = false;
if (!sentOnWindowCreated && windowHandle()->isActive())
{
sentOnWindowCreated = true;
AzFramework::WindowSystemNotificationBus::Broadcast(
&AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated,
reinterpret_cast<AzFramework::NativeWindowHandle>(winId()));
}
m_updatingCameraPosition = true;
if (!ed_useNewCameraSystem)
{
@@ -123,6 +123,12 @@ namespace AZ
m_windowHandle = m_nativeWindow->GetWindowHandle();
}
else
{
// Disable default scene creation for non-games projects
// This can be manually overridden via the DefaultWindowBus.
m_createDefaultScene = false;
}
AzFramework::AssetCatalogEventBus::Handler::BusConnect();
TickBus::Handler::BusConnect();
@@ -351,6 +357,17 @@ namespace AZ
scene->AddRenderPipeline(brdfTexturePipeline);
}
// Send notification when the scene and its pipeline are ready.
// Use the first created pipeline's scene as our default scene for now to allow
// consumers waiting on scene availability to initialize.
if (!m_defaultSceneReady)
{
m_defaultScene = scene;
Render::Bootstrap::NotificationBus::Broadcast(
&Render::Bootstrap::NotificationBus::Handler::OnBootstrapSceneReady, m_defaultScene.get());
m_defaultSceneReady = true;
}
return true;
}
@@ -364,9 +381,6 @@ namespace AZ
{
m_renderPipelineId = pipeline->GetId();
}
// Send notification when the scene and its pipeline are ready
Render::Bootstrap::NotificationBus::Broadcast(&Render::Bootstrap::NotificationBus::Handler::OnBootstrapSceneReady, m_defaultScene.get());
}
void BootstrapSystemComponent::DestroyDefaultScene()
@@ -125,6 +125,7 @@ namespace AZ
Data::Instance<RPI::AttachmentImage> m_brdfTexture;
bool m_createDefaultScene = true;
bool m_defaultSceneReady = false;
// Maps AZ scenes to RPI scene weak pointers to allow looking up a ScenePtr instead of a raw Scene*
AZStd::unordered_map<AzFramework::Scene*, AZStd::weak_ptr<AZ::RPI::Scene>> m_azSceneToAtomSceneMap;