feat(new_editor): wire project, inspector, and viewport runtime

This commit is contained in:
2026-04-19 00:03:25 +08:00
parent 8257403036
commit a57b322bc7
168 changed files with 14829 additions and 2507 deletions

View File

@@ -16,31 +16,34 @@ UIEditorShellToolbarButton BuildToolbarButton(
return button;
}
UIEditorWorkspacePanelPresentationModel BuildHostedContentPresentation(
std::string panelId) {
UIEditorWorkspacePanelPresentationModel BuildViewportPresentation(
const UIEditorPanelDescriptor& descriptor) {
UIEditorWorkspacePanelPresentationModel presentation = {};
presentation.panelId = std::move(panelId);
presentation.kind = UIEditorPanelPresentationKind::HostedContent;
presentation.panelId = descriptor.panelId;
presentation.kind = descriptor.presentationKind;
presentation.viewportShellModel.spec = descriptor.viewportShellSpec;
if (presentation.viewportShellModel.spec.chrome.title.empty()) {
presentation.viewportShellModel.spec.chrome.title = descriptor.defaultTitle;
}
return presentation;
}
UIEditorWorkspacePanelPresentationModel BuildViewportPresentation(
std::string panelId,
std::string title) {
UIEditorWorkspacePanelPresentationModel BuildPanelPresentation(
const UIEditorPanelDescriptor& descriptor) {
if (descriptor.presentationKind == UIEditorPanelPresentationKind::ViewportShell) {
return BuildViewportPresentation(descriptor);
}
UIEditorWorkspacePanelPresentationModel presentation = {};
presentation.panelId = std::move(panelId);
presentation.kind = UIEditorPanelPresentationKind::ViewportShell;
presentation.viewportShellModel.spec.chrome.title = std::move(title);
presentation.viewportShellModel.spec.chrome.subtitle = {};
presentation.viewportShellModel.spec.chrome.showTopBar = false;
presentation.viewportShellModel.spec.chrome.showBottomBar = false;
presentation.viewportShellModel.frame.statusText.clear();
presentation.panelId = descriptor.panelId;
presentation.kind = descriptor.presentationKind;
return presentation;
}
} // namespace
UIEditorShellInteractionDefinition BuildBaseEditorShellDefinition() {
UIEditorShellInteractionDefinition BuildBaseEditorShellDefinition(
const UIEditorPanelRegistry& panelRegistry) {
UIEditorShellInteractionDefinition definition = {};
definition.menuModel = BuildEditorMenuModel();
definition.toolbarButtons = {
@@ -49,14 +52,10 @@ UIEditorShellInteractionDefinition BuildBaseEditorShellDefinition() {
BuildToolbarButton("run.step", UIEditorShellToolbarGlyph::Step)
};
definition.statusSegments = {};
definition.workspacePresentations = {
BuildHostedContentPresentation("hierarchy"),
BuildViewportPresentation("scene", "Scene"),
BuildViewportPresentation("game", "Game"),
BuildHostedContentPresentation("inspector"),
BuildHostedContentPresentation("console"),
BuildHostedContentPresentation("project")
};
definition.workspacePresentations.reserve(panelRegistry.panels.size());
for (const UIEditorPanelDescriptor& descriptor : panelRegistry.panels) {
definition.workspacePresentations.push_back(BuildPanelPresentation(descriptor));
}
return definition;
}