Refactor XCUI editor module layout
This commit is contained in:
@@ -292,7 +292,8 @@ void Application::RenderFrame() {
|
||||
m_pendingInputEvents.clear();
|
||||
|
||||
UIDrawData drawData = {};
|
||||
if (m_useStructuredScreen && m_screenPlayer.IsLoaded()) {
|
||||
const bool hasAuthoredScreenDocument = !m_screenAsset.documentPath.empty();
|
||||
if (hasAuthoredScreenDocument && m_useStructuredScreen && m_screenPlayer.IsLoaded()) {
|
||||
UIScreenFrameInput input = {};
|
||||
input.viewportRect = UIRect(0.0f, 0.0f, width, height);
|
||||
input.events = std::move(frameEvents);
|
||||
@@ -307,6 +308,10 @@ void Application::RenderFrame() {
|
||||
|
||||
m_runtimeStatus = "XCUI Editor Shell";
|
||||
m_runtimeError = frame.errorMessage;
|
||||
} else if (!hasAuthoredScreenDocument) {
|
||||
++m_frameIndex;
|
||||
m_runtimeStatus = "XCUI Editor Shell | Code-driven";
|
||||
m_runtimeError.clear();
|
||||
} else {
|
||||
m_runtimeStatus = "Editor Shell | Load Error";
|
||||
if (m_runtimeError.empty() && !m_screenPlayer.IsLoaded()) {
|
||||
@@ -401,14 +406,19 @@ void Application::QueueWindowFocusEvent(UIInputEventType type) {
|
||||
bool Application::LoadStructuredScreen(const char* triggerReason) {
|
||||
(void)triggerReason;
|
||||
m_screenAsset = m_structuredShell.screenAsset;
|
||||
const bool loaded = m_screenPlayer.Load(m_screenAsset);
|
||||
const EditorShellAssetValidationResult& shellAssetValidation =
|
||||
m_structuredShell.assetValidation;
|
||||
const auto shortcutValidation = m_structuredShell.shortcutManager.ValidateConfiguration();
|
||||
m_useStructuredScreen = loaded;
|
||||
m_runtimeStatus = loaded ? "XCUI Editor Shell" : "Editor Shell | Load Error";
|
||||
const bool hasAuthoredScreenDocument = !m_screenAsset.documentPath.empty();
|
||||
const bool loaded =
|
||||
hasAuthoredScreenDocument ? m_screenPlayer.Load(m_screenAsset) : shellAssetValidation.IsValid();
|
||||
m_useStructuredScreen = hasAuthoredScreenDocument && loaded;
|
||||
m_runtimeStatus =
|
||||
hasAuthoredScreenDocument
|
||||
? (loaded ? "XCUI Editor Shell" : "Editor Shell | Load Error")
|
||||
: "XCUI Editor Shell | Code-driven";
|
||||
m_runtimeError.clear();
|
||||
if (!loaded) {
|
||||
if (hasAuthoredScreenDocument && !loaded) {
|
||||
AppendErrorMessage(m_runtimeError, m_screenPlayer.GetLastError());
|
||||
}
|
||||
if (!shellAssetValidation.IsValid()) {
|
||||
@@ -468,7 +478,6 @@ void Application::RebuildTrackedFileStates() {
|
||||
};
|
||||
|
||||
appendTrackedPath(m_screenAsset.documentPath);
|
||||
appendTrackedPath(m_screenAsset.themePath);
|
||||
|
||||
if (const auto* document = m_screenPlayer.GetDocument(); document != nullptr) {
|
||||
for (const std::string& dependency : document->dependencies) {
|
||||
@@ -503,14 +512,18 @@ bool Application::DetectTrackedFileChange() const {
|
||||
}
|
||||
|
||||
void Application::AppendRuntimeOverlay(UIDrawData& drawData, float width, float height) const {
|
||||
const bool authoredMode = m_useStructuredScreen && m_screenPlayer.IsLoaded();
|
||||
const bool authoredMode =
|
||||
!m_screenAsset.documentPath.empty() && m_useStructuredScreen && m_screenPlayer.IsLoaded();
|
||||
const float panelWidth = authoredMode ? 430.0f : 380.0f;
|
||||
std::vector<std::string> detailLines = {};
|
||||
detailLines.push_back(
|
||||
authoredMode
|
||||
? "Hot reload watches editor shell resources."
|
||||
: "Authored editor shell failed to load.");
|
||||
detailLines.push_back("Document: editor_shell.xcui");
|
||||
? "Hot reload watches editor shell document and dependencies."
|
||||
: "Editor shell is composed directly from fixed code definitions.");
|
||||
detailLines.push_back(
|
||||
authoredMode
|
||||
? "Document: " + std::filesystem::path(m_screenAsset.documentPath).filename().string()
|
||||
: "Document: (none)");
|
||||
|
||||
if (authoredMode) {
|
||||
const auto& inputDebug = m_documentHost.GetInputDebugSnapshot();
|
||||
@@ -560,7 +573,7 @@ void Application::AppendRuntimeOverlay(UIDrawData& drawData, float width, float
|
||||
} else if (!m_autoScreenshot.GetLastCaptureError().empty()) {
|
||||
detailLines.push_back(TruncateText(m_autoScreenshot.GetLastCaptureError(), 78u));
|
||||
} else if (!authoredMode) {
|
||||
detailLines.push_back("No fallback sandbox is rendered in this host.");
|
||||
detailLines.push_back("No authored XCUI document is used by the editor shell host.");
|
||||
}
|
||||
|
||||
const float panelHeight = 38.0f + static_cast<float>(detailLines.size()) * 18.0f;
|
||||
|
||||
Reference in New Issue
Block a user