feat: add editor project switching workflow

This commit is contained in:
2026-03-28 16:19:15 +08:00
parent 359fe2adb3
commit 1fa97dc246
18 changed files with 983 additions and 101 deletions

View File

@@ -1,6 +1,7 @@
#include "SceneManager.h"
#include "Core/EventBus.h"
#include "Core/EditorEvents.h"
#include "Utils/ProjectFileUtils.h"
#include <XCEngine/Components/ComponentFactoryRegistry.h>
#include <XCEngine/Components/CameraComponent.h>
#include <XCEngine/Components/LightComponent.h>
@@ -387,6 +388,14 @@ std::string SceneManager::GetScenesDirectory(const std::string& projectPath) {
std::string SceneManager::ResolveDefaultScenePath(const std::string& projectPath) {
namespace fs = std::filesystem;
if (const auto descriptor = ProjectFileUtils::LoadProjectDescriptor(projectPath)) {
const std::string configuredScenePath =
ProjectFileUtils::ResolveProjectPath(projectPath, descriptor->startupScene);
if (IsSceneFileUsable(configuredScenePath)) {
return configuredScenePath;
}
}
const fs::path scenesDir = GetScenesDirectory(projectPath);
const fs::path mainXC = scenesDir / "Main.xc";
if (fs::exists(mainXC)) {