Debug Tools: Debug Log: Hide its own clipper log to reduce noise in the output.

This commit is contained in:
ocornut 2023-12-20 15:46:26 +01:00
parent 036a6c875e
commit 1e1013085b
2 changed files with 8 additions and 3 deletions

View File

@ -76,6 +76,7 @@ Other changes:
- Menus: Tweaked hover slack logic, adding a timer to avoid situations where a slow vertical - Menus: Tweaked hover slack logic, adding a timer to avoid situations where a slow vertical
movements toward another parent BeginMenu() can keep the wrong child menu open. (#6671, #6926) movements toward another parent BeginMenu() can keep the wrong child menu open. (#6671, #6926)
- Debug Tools: Added DebugFlashStyleColor() to identify a style color. Added to Style Editor. - Debug Tools: Added DebugFlashStyleColor() to identify a style color. Added to Style Editor.
- Debug Tools: Debug Log: Hide its own clipper log to reduce noise in the output.
- Misc: Added IMGUI_USER_H_FILENAME to change the path included when using - Misc: Added IMGUI_USER_H_FILENAME to change the path included when using
IMGUI_INCLUDE_IMGUI_USER_H. (#7039) [@bryceberger] IMGUI_INCLUDE_IMGUI_USER_H. (#7039) [@bryceberger]
- Misc: Rework debug display of texture id in Metrics window to avoid compile-error when - Misc: Rework debug display of texture id in Metrics window to avoid compile-error when

View File

@ -4787,7 +4787,7 @@ void ImGui::NewFrame()
g.DebugLocateId = 0; g.DebugLocateId = 0;
if (g.DebugLogClipperAutoDisableFrames > 0 && --g.DebugLogClipperAutoDisableFrames == 0) if (g.DebugLogClipperAutoDisableFrames > 0 && --g.DebugLogClipperAutoDisableFrames == 0)
{ {
DebugLog("(Auto-disabled ImGuiDebugLogFlags_EventClipper to avoid spamming)\n"); DebugLog("(Debug Log: Auto-disabled ImGuiDebugLogFlags_EventClipper after 2 frames)\n");
g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper; g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper;
} }
@ -14939,6 +14939,9 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
SetClipboardText(g.DebugLogBuf.c_str()); SetClipboardText(g.DebugLogBuf.c_str());
BeginChild("##log", ImVec2(0.0f, 0.0f), ImGuiChildFlags_Border, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar); BeginChild("##log", ImVec2(0.0f, 0.0f), ImGuiChildFlags_Border, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
const ImGuiDebugLogFlags backup_log_flags = g.DebugLogFlags;
g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper;
ImGuiListClipper clipper; ImGuiListClipper clipper;
clipper.Begin(g.DebugLogIndex.size()); clipper.Begin(g.DebugLogIndex.size());
while (clipper.Step()) while (clipper.Step())
@ -14946,10 +14949,10 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
{ {
const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no); const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no);
const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no); const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no);
TextUnformatted(line_begin, line_end); TextUnformatted(line_begin, line_end); // Display line
ImRect text_rect = g.LastItemData.Rect; ImRect text_rect = g.LastItemData.Rect;
if (IsItemHovered()) if (IsItemHovered())
for (const char* p = line_begin; p <= line_end - 10; p++) for (const char* p = line_begin; p <= line_end - 10; p++) // Search for 0x???????? identifiers
{ {
ImGuiID id = 0; ImGuiID id = 0;
if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1) if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1)
@ -14962,6 +14965,7 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
p += 10; p += 10;
} }
} }
g.DebugLogFlags = backup_log_flags;
if (GetScrollY() >= GetScrollMaxY()) if (GetScrollY() >= GetScrollMaxY())
SetScrollHereY(1.0f); SetScrollHereY(1.0f);
EndChild(); EndChild();