Files
XCEngine/new_editor/src/Workspace/WorkspaceModelValidation.cpp

30 lines
1001 B
C++
Raw Normal View History

#include "Workspace/WorkspaceModelInternal.h"
namespace XCEngine::UI::Editor {
UIEditorWorkspaceValidationResult ValidateUIEditorWorkspace(
const UIEditorWorkspaceModel& workspace) {
std::unordered_set<std::string> nodeIds = {};
std::unordered_set<std::string> panelIds = {};
UIEditorWorkspaceValidationResult result =
Internal::ValidateNodeRecursive(workspace.root, nodeIds, panelIds);
if (!result.IsValid()) {
return result;
}
if (!workspace.activePanelId.empty()) {
const UIEditorWorkspacePanelState* activePanel =
FindUIEditorWorkspaceActivePanel(workspace);
if (activePanel == nullptr) {
return Internal::MakeValidationError(
UIEditorWorkspaceValidationCode::InvalidActivePanelId,
"Active panel id '" + workspace.activePanelId +
"' is missing or hidden by the current tab selection.");
}
}
return {};
}
} // namespace XCEngine::UI::Editor