checkpoint(new_editor): native d3d12 ui path

Key node 1: move main-window UI presentation onto the D3D12 render loop with native UI renderer, text system, and texture host.

Key node 2: wire frame timing/FPS display, window runtime, swapchain presentation, and native screenshot capture around the new path.

Key node 3: carry editor shell/workspace/viewport/panel interaction updates needed by the new renderer and detached window flow.

Key node 4: pump async resource loads and scene bridge follow-up needed for scene content visibility in new_editor.
This commit is contained in:
2026-04-21 20:49:18 +08:00
parent a779b04dba
commit 6e9265e92e
53 changed files with 5330 additions and 858 deletions

View File

@@ -1,5 +1,6 @@
#include "Scene/EditorSceneBridge.h"
#include <XCEditor/Foundation/UIEditorRuntimeTrace.h>
#include <XCEngine/Components/ComponentFactoryRegistry.h>
#include <XCEngine/Components/GameObject.h>
#include <XCEngine/Components/TransformComponent.h>
@@ -28,6 +29,10 @@ using ::XCEngine::Components::SceneManager;
using ::XCEngine::Components::TransformComponent;
using ::XCEngine::Resources::ResourceManager;
void TraceSceneStartup(std::string message) {
::XCEngine::UI::Editor::AppendUIEditorRuntimeTrace("startup", std::move(message));
}
struct ClipboardNode {
std::string name = {};
std::string transformPayload = {};
@@ -145,16 +150,19 @@ bool WouldCreateCycle(
EditorStartupSceneResult EnsureEditorStartupScene(
const std::filesystem::path& projectRoot) {
EditorStartupSceneResult result = {};
TraceSceneStartup("EnsureEditorStartupScene begin projectRoot=" + projectRoot.string());
if (projectRoot.empty()) {
return result;
}
ResourceManager::Get().SetResourceRoot(projectRoot.string().c_str());
TraceSceneStartup("ResourceManager::SetResourceRoot complete");
if (Scene* activeScene = ResolvePrimaryScene();
activeScene != nullptr) {
result.ready = true;
result.sceneName = activeScene->GetName();
TraceSceneStartup("EnsureEditorStartupScene reused active scene=" + result.sceneName);
return result;
}
@@ -164,7 +172,13 @@ EditorStartupSceneResult EnsureEditorStartupScene(
if (std::filesystem::exists(startupScenePath) &&
std::filesystem::is_regular_file(startupScenePath)) {
sceneManager.LoadScene(startupScenePath.string());
TraceSceneStartup("SceneManager::LoadScene begin path=" + startupScenePath.string());
{
ResourceManager::ScopedDeferredSceneLoad deferredSceneLoad(
ResourceManager::Get());
sceneManager.LoadScene(startupScenePath.string());
}
TraceSceneStartup("SceneManager::LoadScene end");
Scene* loadedScene = sceneManager.GetScene(startupScenePath.stem().string());
if (loadedScene == nullptr) {
loadedScene = ResolvePrimaryScene();
@@ -177,6 +191,7 @@ EditorStartupSceneResult EnsureEditorStartupScene(
result.loadedFromDisk = true;
result.scenePath = startupScenePath;
result.sceneName = loadedScene->GetName();
TraceSceneStartup("EnsureEditorStartupScene loaded scene=" + result.sceneName);
return result;
}
}
@@ -186,8 +201,12 @@ EditorStartupSceneResult EnsureEditorStartupScene(
sceneManager.SetActiveScene(scene);
result.ready = true;
result.sceneName = scene->GetName();
TraceSceneStartup("EnsureEditorStartupScene created scene=" + result.sceneName);
}
TraceSceneStartup(
std::string("EnsureEditorStartupScene end ready=") +
(result.ready ? "1" : "0"));
return result;
}
@@ -208,7 +227,11 @@ bool OpenEditorSceneAsset(const std::filesystem::path& scenePath) {
}
SceneManager& sceneManager = SceneManager::Get();
sceneManager.LoadScene(scenePath.string());
{
ResourceManager::ScopedDeferredSceneLoad deferredSceneLoad(
ResourceManager::Get());
sceneManager.LoadScene(scenePath.string());
}
Scene* loadedScene = sceneManager.GetScene(scenePath.stem().string());
if (loadedScene == nullptr) {
loadedScene = ResolvePrimaryScene();