feat(new_editor): wire project, inspector, and viewport runtime
This commit is contained in:
@@ -1,21 +1,90 @@
|
||||
#include "EditorShellAssetBuilderInternal.h"
|
||||
|
||||
#include <XCEditor/App/EditorPanelIds.h>
|
||||
|
||||
namespace XCEngine::UI::Editor::App::CompositionInternal {
|
||||
|
||||
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
|
||||
|
||||
UIEditorPanelRegistry BuildEditorPanelRegistry() {
|
||||
UIEditorPanelRegistry registry = {};
|
||||
registry.panels = {
|
||||
{ "hierarchy", "Hierarchy", UIEditorPanelPresentationKind::HostedContent, true, false, false },
|
||||
{ "scene", "Scene", UIEditorPanelPresentationKind::ViewportShell, false, false, false },
|
||||
{ "game", "Game", UIEditorPanelPresentationKind::ViewportShell, false, false, false },
|
||||
{ "inspector", "Inspector", UIEditorPanelPresentationKind::HostedContent, true, false, false },
|
||||
{ "console", "Console", UIEditorPanelPresentationKind::HostedContent, true, false, false },
|
||||
{ "project", "Project", UIEditorPanelPresentationKind::HostedContent, false, false, false }
|
||||
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)
|
||||
};
|
||||
return registry;
|
||||
}
|
||||
|
||||
UIEditorWorkspaceModel BuildEditorWorkspaceModel() {
|
||||
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);
|
||||
|
||||
UIEditorWorkspaceModel workspace = {};
|
||||
workspace.root = BuildUIEditorWorkspaceSplit(
|
||||
"workspace-root",
|
||||
@@ -31,45 +100,45 @@ UIEditorWorkspaceModel BuildEditorWorkspaceModel() {
|
||||
0.19047619f,
|
||||
BuildUIEditorWorkspaceSingleTabStack(
|
||||
"hierarchy-panel",
|
||||
"hierarchy",
|
||||
"Hierarchy",
|
||||
true),
|
||||
std::string(kHierarchyPanelId),
|
||||
hierarchy.defaultTitle,
|
||||
hierarchy.placeholder),
|
||||
BuildUIEditorWorkspaceTabStack(
|
||||
"center-tabs",
|
||||
{
|
||||
BuildUIEditorWorkspacePanel(
|
||||
"scene-panel",
|
||||
"scene",
|
||||
"Scene",
|
||||
false),
|
||||
std::string(kScenePanelId),
|
||||
scene.defaultTitle,
|
||||
scene.placeholder),
|
||||
BuildUIEditorWorkspacePanel(
|
||||
"game-panel",
|
||||
"game",
|
||||
"Game",
|
||||
false)
|
||||
std::string(kGamePanelId),
|
||||
game.defaultTitle,
|
||||
game.placeholder)
|
||||
},
|
||||
0u)),
|
||||
BuildUIEditorWorkspaceSingleTabStack(
|
||||
"inspector-panel",
|
||||
"inspector",
|
||||
"Inspector",
|
||||
true)),
|
||||
std::string(kInspectorPanelId),
|
||||
inspector.defaultTitle,
|
||||
inspector.placeholder)),
|
||||
BuildUIEditorWorkspaceTabStack(
|
||||
"bottom-tabs",
|
||||
{
|
||||
BuildUIEditorWorkspacePanel(
|
||||
"console-panel",
|
||||
"console",
|
||||
"Console",
|
||||
true),
|
||||
std::string(kConsolePanelId),
|
||||
console.defaultTitle,
|
||||
console.placeholder),
|
||||
BuildUIEditorWorkspacePanel(
|
||||
"project-panel",
|
||||
"project",
|
||||
"Project",
|
||||
false)
|
||||
std::string(kProjectPanelId),
|
||||
project.defaultTitle,
|
||||
project.placeholder)
|
||||
},
|
||||
1u));
|
||||
workspace.activePanelId = "scene";
|
||||
workspace.activePanelId = std::string(kScenePanelId);
|
||||
return workspace;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user