Add shell definition contract
This commit is contained in:
@@ -41,7 +41,6 @@ using XCEngine::UI::UIPointerButton;
|
||||
using XCEngine::UI::UIRect;
|
||||
using XCEngine::UI::Editor::AppendUIEditorShellInteraction;
|
||||
using XCEngine::UI::Editor::BuildDefaultUIEditorWorkspaceController;
|
||||
using XCEngine::UI::Editor::BuildUIEditorResolvedMenuModel;
|
||||
using XCEngine::UI::Editor::BuildUIEditorWorkspacePanel;
|
||||
using XCEngine::UI::Editor::BuildUIEditorWorkspaceSplit;
|
||||
using XCEngine::UI::Editor::BuildUIEditorWorkspaceTabStack;
|
||||
@@ -60,8 +59,8 @@ using XCEngine::UI::Editor::UIEditorMenuItemKind;
|
||||
using XCEngine::UI::Editor::UIEditorMenuModel;
|
||||
using XCEngine::UI::Editor::UIEditorPanelPresentationKind;
|
||||
using XCEngine::UI::Editor::UIEditorPanelRegistry;
|
||||
using XCEngine::UI::Editor::UIEditorShellInteractionDefinition;
|
||||
using XCEngine::UI::Editor::UIEditorShellInteractionFrame;
|
||||
using XCEngine::UI::Editor::UIEditorShellInteractionModel;
|
||||
using XCEngine::UI::Editor::UIEditorShellInteractionResult;
|
||||
using XCEngine::UI::Editor::UIEditorShellInteractionServices;
|
||||
using XCEngine::UI::Editor::UIEditorShellInteractionState;
|
||||
@@ -395,7 +394,7 @@ private:
|
||||
void HandleLeftButtonDown(float x, float y);
|
||||
void HandleLeftButtonUp(float x, float y);
|
||||
void ExecuteAction(ActionId action);
|
||||
UIEditorShellInteractionModel BuildInteractionModel() const;
|
||||
UIEditorShellInteractionDefinition BuildInteractionDefinition() const;
|
||||
bool HasInteractiveCaptureState() const;
|
||||
void ApplyHostCaptureRequests(const UIEditorShellInteractionResult& result);
|
||||
void SetInteractionResult(const UIEditorShellInteractionResult& result);
|
||||
@@ -411,7 +410,6 @@ private:
|
||||
UIEditorCommandDispatcher m_commandDispatcher = {};
|
||||
UIEditorMenuModel m_menuModel = {};
|
||||
UIEditorShellInteractionState m_interactionState = {};
|
||||
UIEditorShellInteractionModel m_cachedModel = {};
|
||||
UIEditorShellInteractionFrame m_cachedFrame = {};
|
||||
std::vector<UIInputEvent> m_pendingInputEvents = {};
|
||||
std::vector<ButtonState> m_buttons = {};
|
||||
@@ -629,7 +627,6 @@ void ScenarioApp::ResetScenario() {
|
||||
m_commandDispatcher = UIEditorCommandDispatcher(BuildCommandRegistry());
|
||||
m_menuModel = BuildMenuModel();
|
||||
m_interactionState = {};
|
||||
m_cachedModel = {};
|
||||
m_cachedFrame = {};
|
||||
m_pendingInputEvents.clear();
|
||||
m_lastStatus = "Ready";
|
||||
@@ -734,14 +731,10 @@ void ScenarioApp::ApplyHostCaptureRequests(const UIEditorShellInteractionResult&
|
||||
}
|
||||
}
|
||||
|
||||
UIEditorShellInteractionModel ScenarioApp::BuildInteractionModel() const {
|
||||
UIEditorShellInteractionModel model = {};
|
||||
model.resolvedMenuModel = BuildUIEditorResolvedMenuModel(
|
||||
m_menuModel,
|
||||
m_commandDispatcher,
|
||||
m_controller,
|
||||
nullptr);
|
||||
model.statusSegments = {
|
||||
UIEditorShellInteractionDefinition ScenarioApp::BuildInteractionDefinition() const {
|
||||
UIEditorShellInteractionDefinition definition = {};
|
||||
definition.menuModel = m_menuModel;
|
||||
definition.statusSegments = {
|
||||
UIEditorStatusBarSegment{
|
||||
"mode",
|
||||
"Shell Contract",
|
||||
@@ -774,8 +767,8 @@ UIEditorShellInteractionModel ScenarioApp::BuildInteractionModel() const {
|
||||
presentation.viewportShellModel.frame.hasTexture = false;
|
||||
presentation.viewportShellModel.frame.statusText =
|
||||
"这里只验证 Editor 根壳交互,不接旧 editor 业务面板。";
|
||||
model.workspacePresentations = { presentation };
|
||||
return model;
|
||||
definition.workspacePresentations = { presentation };
|
||||
return definition;
|
||||
}
|
||||
|
||||
void ScenarioApp::SetInteractionResult(const UIEditorShellInteractionResult& result) {
|
||||
@@ -872,31 +865,20 @@ void ScenarioApp::SetDispatchResult(const UIEditorCommandDispatchResult& result)
|
||||
|
||||
void ScenarioApp::RenderFrame() {
|
||||
UpdateLayout();
|
||||
m_cachedModel = BuildInteractionModel();
|
||||
const UIEditorShellInteractionDefinition definition = BuildInteractionDefinition();
|
||||
UIEditorShellInteractionServices services = {};
|
||||
services.commandDispatcher = &m_commandDispatcher;
|
||||
m_cachedFrame = UpdateUIEditorShellInteraction(
|
||||
m_interactionState,
|
||||
m_controller,
|
||||
m_shellRect,
|
||||
m_cachedModel,
|
||||
definition,
|
||||
m_pendingInputEvents,
|
||||
services);
|
||||
m_pendingInputEvents.clear();
|
||||
ApplyHostCaptureRequests(m_cachedFrame.result);
|
||||
SetInteractionResult(m_cachedFrame.result);
|
||||
|
||||
if (m_cachedFrame.result.commandDispatched) {
|
||||
m_cachedModel = BuildInteractionModel();
|
||||
m_cachedFrame = UpdateUIEditorShellInteraction(
|
||||
m_interactionState,
|
||||
m_controller,
|
||||
m_shellRect,
|
||||
m_cachedModel,
|
||||
{},
|
||||
services);
|
||||
}
|
||||
|
||||
const auto* viewportFrame =
|
||||
FindUIEditorWorkspaceViewportPresentationFrame(m_cachedFrame.workspaceInteractionFrame.composeFrame, "scene");
|
||||
const std::string selectedPresentation =
|
||||
@@ -968,7 +950,7 @@ void ScenarioApp::RenderFrame() {
|
||||
11.0f);
|
||||
|
||||
DrawCard(drawList, m_previewRect, "Preview", "真实 UIEditorShellInteraction 预览,不接旧 editor 业务。");
|
||||
AppendUIEditorShellInteraction(drawList, m_cachedFrame, m_cachedModel, m_interactionState);
|
||||
AppendUIEditorShellInteraction(drawList, m_cachedFrame, m_interactionState);
|
||||
|
||||
const bool framePresented = m_renderer.Render(drawData);
|
||||
m_autoScreenshot.CaptureIfRequested(
|
||||
|
||||
Reference in New Issue
Block a user