mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Open a new scene when all scene editors are closed
This commit is contained in:
@@ -2138,9 +2138,19 @@ namespace Nuake {
|
||||
if (auto window = sceneEditors[i]; window->GetWindowName() == windowName)
|
||||
{
|
||||
sceneEditors.erase(std::begin(sceneEditors) + i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// When closing all editors, it should open a new scene
|
||||
if (sceneEditors.empty())
|
||||
{
|
||||
auto newScene = CreateRef<Scene>();
|
||||
newScene->SetName("New Scene");
|
||||
|
||||
Ref<SceneEditorWindow> sceneEditor = CreateRef<SceneEditorWindow>(newScene);
|
||||
sceneEditor->DockTo(SceneEditorDockspaceNodeID);
|
||||
sceneEditors.push_back(sceneEditor);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorInterface::OpenPrefabWindow(const std::string& prefabPath)
|
||||
|
||||
@@ -34,7 +34,7 @@ void SceneEditorWindow::Update(float ts)
|
||||
|
||||
void SceneEditorWindow::Draw()
|
||||
{
|
||||
const std::string sceneName = editorContext.GetScene()->Path;
|
||||
std::string sceneName = editorContext.GetScene()->Path.empty() ? "New Scene" : editorContext.GetScene()->Path;
|
||||
|
||||
ImGuiID editorDockspaceId = ImGui::GetID("SceneEditorDockSpace");
|
||||
if (!layoutInitialized)
|
||||
|
||||
Reference in New Issue
Block a user