Fix dummy rendering pipeline being created for the Editor
-This ensures OnBootstrapSceneReady still fires even if the bootstrap system component doesn't create a default scene -This also disables default scene creation for non-game projects by default to ease tools development Tested with the Editor, AtomSampleViewer, the Material Editor, and the AtomTest launcher
This commit is contained in:
@@ -456,15 +456,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;
|
||||
|
||||
Reference in New Issue
Block a user