Editor: Fix InspectorPanel AddComponent popup crash

- Remove SeparatorText which causes PopStyleVar mismatch in ImGui
- Add stderr redirection for better error capture
- Add debug logging to InspectorPanel
- Fix EditorLayer commented out undefined functions
This commit is contained in:
2026-03-25 12:56:51 +08:00
parent 0834ccb7aa
commit cad6f586fb
6 changed files with 70 additions and 88 deletions

View File

@@ -22,7 +22,9 @@ void ConsolePanel::Render() {
}
ImGui::SameLine();
ImGui::SeparatorText("Filter");
ImGui::TextColored(ImVec4(0.5f, 0.5f, 0.5f, 1.0f), "Filter:");
ImGui::SameLine();
ImGui::Separator();
ImGui::SameLine();
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4.0f);
@@ -117,53 +119,6 @@ void ConsolePanel::Render() {
ImGui::EndChild();
ImGui::End();
}
ImGui::SameLine();
if (ImGui::Button("Info")) {
LogSystem::Get().AddLog(::XCEngine::Debug::LogLevel::Info, "Test info message");
}
ImGui::SameLine();
if (ImGui::Button("Warn")) {
LogSystem::Get().AddLog(::XCEngine::Debug::LogLevel::Warning, "Test warning message");
}
ImGui::SameLine();
if (ImGui::Button("Error")) {
LogSystem::Get().AddLog(::XCEngine::Debug::LogLevel::Error, "Test error message");
}
ImGui::Separator();
ImGui::BeginChild("LogScroll", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
for (const auto& log : LogSystem::Get().GetLogs()) {
ImVec4 color;
const char* prefix;
switch (log.level) {
case ::XCEngine::Debug::LogLevel::Info:
color = ImVec4(0.7f, 0.7f, 0.7f, 1.0f);
prefix = "[Info] ";
break;
case ::XCEngine::Debug::LogLevel::Warning:
color = ImVec4(1.0f, 0.8f, 0.0f, 1.0f);
prefix = "[Warn] ";
break;
case ::XCEngine::Debug::LogLevel::Error:
color = ImVec4(1.0f, 0.3f, 0.3f, 1.0f);
prefix = "[Error]";
break;
}
ImGui::TextColored(color, "%s%s", prefix, log.message.c_str());
}
if (m_scrollToBottom) {
ImGui::SetScrollHereY(1.0f);
m_scrollToBottom = false;
}
ImGui::EndChild();
ImGui::End();
}
}
}