2026-04-15 22:47:42 +08:00
|
|
|
#include "EditorShellAssetBuilderInternal.h"
|
2026-04-15 08:24:06 +08:00
|
|
|
|
2026-04-19 00:03:25 +08:00
|
|
|
#include <XCEditor/App/EditorPanelIds.h>
|
|
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
namespace XCEngine::UI::Editor::App::CompositionInternal {
|
2026-04-15 08:24:06 +08:00
|
|
|
|
2026-04-19 00:03:25 +08:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
UIEditorPanelDescriptor BuildHostedContentPanelDescriptor(
|
|
|
|
|
std::string_view panelId,
|
|
|
|
|
std::string_view title,
|
|
|
|
|
bool placeholder,
|
|
|
|
|
bool canHide,
|
|
|
|
|
bool canClose) {
|
|
|
|
|
UIEditorPanelDescriptor descriptor = {};
|
|
|
|
|
descriptor.panelId = std::string(panelId);
|
|
|
|
|
descriptor.defaultTitle = std::string(title);
|
|
|
|
|
descriptor.presentationKind = UIEditorPanelPresentationKind::HostedContent;
|
|
|
|
|
descriptor.placeholder = placeholder;
|
|
|
|
|
descriptor.canHide = canHide;
|
|
|
|
|
descriptor.canClose = canClose;
|
|
|
|
|
return descriptor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UIEditorPanelDescriptor BuildViewportPanelDescriptor(
|
|
|
|
|
std::string_view panelId,
|
|
|
|
|
std::string_view title,
|
|
|
|
|
bool canHide,
|
|
|
|
|
bool canClose,
|
|
|
|
|
bool showTopBar,
|
|
|
|
|
bool showBottomBar) {
|
|
|
|
|
UIEditorPanelDescriptor descriptor = {};
|
|
|
|
|
descriptor.panelId = std::string(panelId);
|
|
|
|
|
descriptor.defaultTitle = std::string(title);
|
|
|
|
|
descriptor.presentationKind = UIEditorPanelPresentationKind::ViewportShell;
|
|
|
|
|
descriptor.placeholder = false;
|
|
|
|
|
descriptor.canHide = canHide;
|
|
|
|
|
descriptor.canClose = canClose;
|
|
|
|
|
descriptor.viewportShellSpec.chrome.title = descriptor.defaultTitle;
|
|
|
|
|
descriptor.viewportShellSpec.chrome.showTopBar = showTopBar;
|
|
|
|
|
descriptor.viewportShellSpec.chrome.showBottomBar = showBottomBar;
|
|
|
|
|
return descriptor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const UIEditorPanelDescriptor& RequirePanelDescriptor(
|
|
|
|
|
const UIEditorPanelRegistry& registry,
|
|
|
|
|
std::string_view panelId) {
|
|
|
|
|
if (const UIEditorPanelDescriptor* descriptor =
|
|
|
|
|
FindUIEditorPanelDescriptor(registry, panelId);
|
|
|
|
|
descriptor != nullptr) {
|
|
|
|
|
return *descriptor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const UIEditorPanelDescriptor fallback = {};
|
|
|
|
|
return fallback;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
UIEditorPanelRegistry BuildEditorPanelRegistry() {
|
|
|
|
|
UIEditorPanelRegistry registry = {};
|
|
|
|
|
registry.panels = {
|
2026-04-19 00:03:25 +08:00
|
|
|
BuildHostedContentPanelDescriptor(kHierarchyPanelId, kHierarchyPanelTitle, true, false, false),
|
|
|
|
|
BuildViewportPanelDescriptor(kScenePanelId, kScenePanelTitle, false, false, false, false),
|
|
|
|
|
BuildViewportPanelDescriptor(kGamePanelId, kGamePanelTitle, false, false, false, false),
|
|
|
|
|
BuildHostedContentPanelDescriptor(kInspectorPanelId, kInspectorPanelTitle, true, false, false),
|
|
|
|
|
BuildHostedContentPanelDescriptor(kConsolePanelId, kConsolePanelTitle, true, false, false),
|
|
|
|
|
BuildHostedContentPanelDescriptor(kProjectPanelId, kProjectPanelTitle, false, false, false)
|
2026-04-15 08:24:06 +08:00
|
|
|
};
|
|
|
|
|
return registry;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-19 00:03:25 +08:00
|
|
|
UIEditorWorkspaceModel BuildEditorWorkspaceModel(
|
|
|
|
|
const UIEditorPanelRegistry& panelRegistry) {
|
|
|
|
|
const UIEditorPanelDescriptor& hierarchy =
|
|
|
|
|
RequirePanelDescriptor(panelRegistry, kHierarchyPanelId);
|
|
|
|
|
const UIEditorPanelDescriptor& scene =
|
|
|
|
|
RequirePanelDescriptor(panelRegistry, kScenePanelId);
|
|
|
|
|
const UIEditorPanelDescriptor& game =
|
|
|
|
|
RequirePanelDescriptor(panelRegistry, kGamePanelId);
|
|
|
|
|
const UIEditorPanelDescriptor& inspector =
|
|
|
|
|
RequirePanelDescriptor(panelRegistry, kInspectorPanelId);
|
|
|
|
|
const UIEditorPanelDescriptor& console =
|
|
|
|
|
RequirePanelDescriptor(panelRegistry, kConsolePanelId);
|
|
|
|
|
const UIEditorPanelDescriptor& project =
|
|
|
|
|
RequirePanelDescriptor(panelRegistry, kProjectPanelId);
|
|
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
UIEditorWorkspaceModel workspace = {};
|
|
|
|
|
workspace.root = BuildUIEditorWorkspaceSplit(
|
|
|
|
|
"workspace-root",
|
|
|
|
|
UIEditorWorkspaceSplitAxis::Vertical,
|
|
|
|
|
0.75f,
|
|
|
|
|
BuildUIEditorWorkspaceSplit(
|
|
|
|
|
"workspace-top",
|
|
|
|
|
UIEditorWorkspaceSplitAxis::Horizontal,
|
|
|
|
|
0.7875f,
|
|
|
|
|
BuildUIEditorWorkspaceSplit(
|
|
|
|
|
"workspace-main",
|
|
|
|
|
UIEditorWorkspaceSplitAxis::Horizontal,
|
|
|
|
|
0.19047619f,
|
|
|
|
|
BuildUIEditorWorkspaceSingleTabStack(
|
|
|
|
|
"hierarchy-panel",
|
2026-04-19 00:03:25 +08:00
|
|
|
std::string(kHierarchyPanelId),
|
|
|
|
|
hierarchy.defaultTitle,
|
|
|
|
|
hierarchy.placeholder),
|
2026-04-15 08:24:06 +08:00
|
|
|
BuildUIEditorWorkspaceTabStack(
|
|
|
|
|
"center-tabs",
|
|
|
|
|
{
|
|
|
|
|
BuildUIEditorWorkspacePanel(
|
|
|
|
|
"scene-panel",
|
2026-04-19 00:03:25 +08:00
|
|
|
std::string(kScenePanelId),
|
|
|
|
|
scene.defaultTitle,
|
|
|
|
|
scene.placeholder),
|
2026-04-15 08:24:06 +08:00
|
|
|
BuildUIEditorWorkspacePanel(
|
|
|
|
|
"game-panel",
|
2026-04-19 00:03:25 +08:00
|
|
|
std::string(kGamePanelId),
|
|
|
|
|
game.defaultTitle,
|
|
|
|
|
game.placeholder)
|
2026-04-15 08:24:06 +08:00
|
|
|
},
|
|
|
|
|
0u)),
|
|
|
|
|
BuildUIEditorWorkspaceSingleTabStack(
|
|
|
|
|
"inspector-panel",
|
2026-04-19 00:03:25 +08:00
|
|
|
std::string(kInspectorPanelId),
|
|
|
|
|
inspector.defaultTitle,
|
|
|
|
|
inspector.placeholder)),
|
2026-04-15 08:24:06 +08:00
|
|
|
BuildUIEditorWorkspaceTabStack(
|
|
|
|
|
"bottom-tabs",
|
|
|
|
|
{
|
|
|
|
|
BuildUIEditorWorkspacePanel(
|
|
|
|
|
"console-panel",
|
2026-04-19 00:03:25 +08:00
|
|
|
std::string(kConsolePanelId),
|
|
|
|
|
console.defaultTitle,
|
|
|
|
|
console.placeholder),
|
2026-04-15 08:24:06 +08:00
|
|
|
BuildUIEditorWorkspacePanel(
|
|
|
|
|
"project-panel",
|
2026-04-19 00:03:25 +08:00
|
|
|
std::string(kProjectPanelId),
|
|
|
|
|
project.defaultTitle,
|
|
|
|
|
project.placeholder)
|
2026-04-15 08:24:06 +08:00
|
|
|
},
|
|
|
|
|
1u));
|
2026-04-19 00:03:25 +08:00
|
|
|
workspace.activePanelId = std::string(kScenePanelId);
|
2026-04-15 08:24:06 +08:00
|
|
|
return workspace;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
} // namespace XCEngine::UI::Editor::App::CompositionInternal
|