Debug Log: auto-disable ImGuiDebugLogFlags_EventClipper to reduce spam.

This commit is contained in:
ocornut 2023-03-06 18:09:37 +01:00
parent 66b762577c
commit 1c29a8ed18
2 changed files with 8 additions and 1 deletions

View File

@ -4576,6 +4576,11 @@ void ImGui::NewFrame()
UpdateDebugToolStackQueries(); UpdateDebugToolStackQueries();
if (g.DebugLocateFrames > 0 && --g.DebugLocateFrames == 0) if (g.DebugLocateFrames > 0 && --g.DebugLocateFrames == 0)
g.DebugLocateId = 0; g.DebugLocateId = 0;
if (g.DebugLogClipperAutoDisableFrames > 0 && --g.DebugLogClipperAutoDisableFrames == 0)
{
DebugLog("(Auto-disabled ImGuiDebugLogFlags_EventClipper to avoid spamming)\n");
g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper;
}
// Create implicit/fallback window - which we will only render it if the user has added something to it. // Create implicit/fallback window - which we will only render it if the user has added something to it.
// We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags.
@ -14218,7 +14223,7 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
SameLine(); CheckboxFlags("Focus", &g.DebugLogFlags, ImGuiDebugLogFlags_EventFocus); SameLine(); CheckboxFlags("Focus", &g.DebugLogFlags, ImGuiDebugLogFlags_EventFocus);
SameLine(); CheckboxFlags("Popup", &g.DebugLogFlags, ImGuiDebugLogFlags_EventPopup); SameLine(); CheckboxFlags("Popup", &g.DebugLogFlags, ImGuiDebugLogFlags_EventPopup);
SameLine(); CheckboxFlags("Nav", &g.DebugLogFlags, ImGuiDebugLogFlags_EventNav); SameLine(); CheckboxFlags("Nav", &g.DebugLogFlags, ImGuiDebugLogFlags_EventNav);
SameLine(); CheckboxFlags("Clipper", &g.DebugLogFlags, ImGuiDebugLogFlags_EventClipper); SameLine(); if (CheckboxFlags("Clipper", &g.DebugLogFlags, ImGuiDebugLogFlags_EventClipper)) { g.DebugLogClipperAutoDisableFrames = 2; }; if (IsItemHovered()) SetTooltip("Clipper log auto-disabled after 2 frames");
SameLine(); CheckboxFlags("IO", &g.DebugLogFlags, ImGuiDebugLogFlags_EventIO); SameLine(); CheckboxFlags("IO", &g.DebugLogFlags, ImGuiDebugLogFlags_EventIO);
if (SmallButton("Clear")) if (SmallButton("Clear"))

View File

@ -1986,6 +1986,7 @@ struct ImGuiContext
ImGuiDebugLogFlags DebugLogFlags; ImGuiDebugLogFlags DebugLogFlags;
ImGuiTextBuffer DebugLogBuf; ImGuiTextBuffer DebugLogBuf;
ImGuiTextIndex DebugLogIndex; ImGuiTextIndex DebugLogIndex;
ImU8 DebugLogClipperAutoDisableFrames;
ImU8 DebugLocateFrames; // For DebugLocateItemOnHover(). This is used together with DebugLocateId which is in a hot/cached spot above. ImU8 DebugLocateFrames; // For DebugLocateItemOnHover(). This is used together with DebugLocateId which is in a hot/cached spot above.
bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker()) bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker())
ImU8 DebugItemPickerMouseButton; ImU8 DebugItemPickerMouseButton;
@ -2156,6 +2157,7 @@ struct ImGuiContext
DebugLogFlags = ImGuiDebugLogFlags_OutputToTTY; DebugLogFlags = ImGuiDebugLogFlags_OutputToTTY;
DebugLocateId = 0; DebugLocateId = 0;
DebugLogClipperAutoDisableFrames = 0;
DebugLocateFrames = 0; DebugLocateFrames = 0;
DebugItemPickerActive = false; DebugItemPickerActive = false;
DebugItemPickerMouseButton = ImGuiMouseButton_Left; DebugItemPickerMouseButton = ImGuiMouseButton_Left;