mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-14 19:17:48 +01:00
Enclosed a few more remaining sections in ifndef IMGUI_DISABLE_DEBUG_TOOLS for completeness.
This commit is contained in:
parent
33fabdf392
commit
1a48a63446
20
imgui.cpp
20
imgui.cpp
@ -4147,17 +4147,19 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flag
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
if (id != 0)
|
||||
{
|
||||
// [DEBUG] Item Picker tool!
|
||||
// We perform the check here because SetHoveredID() is not frequently called (1~ time a frame), making
|
||||
// the cost of this tool near-zero. We can get slightly better call-stack and support picking non-hovered
|
||||
// items if we performed the test in ItemAdd(), but that would incur a small runtime cost.
|
||||
// We perform the check here because reaching is path is rare (1~ time a frame),
|
||||
// making the cost of this tool near-zero! We could get better call-stack and support picking non-hovered
|
||||
// items if we performed the test in ItemAdd(), but that would incur a bigger runtime cost.
|
||||
if (g.DebugItemPickerActive && g.HoveredIdPreviousFrame == id)
|
||||
GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255));
|
||||
if (g.DebugItemPickerBreakId == id)
|
||||
IM_DEBUG_BREAK();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g.NavDisableMouseHover)
|
||||
return false;
|
||||
@ -4792,6 +4794,7 @@ void ImGui::NewFrame()
|
||||
g.GroupStack.resize(0);
|
||||
|
||||
// [DEBUG] Update debug features
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
UpdateDebugToolItemPicker();
|
||||
UpdateDebugToolStackQueries();
|
||||
UpdateDebugToolFlashStyleColor();
|
||||
@ -4806,6 +4809,7 @@ void ImGui::NewFrame()
|
||||
g.DebugLogFlags &= ~g.DebugLogAutoDisableFlags;
|
||||
g.DebugLogAutoDisableFlags = ImGuiDebugLogFlags_None;
|
||||
}
|
||||
#endif
|
||||
|
||||
// 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.
|
||||
@ -4817,10 +4821,12 @@ void ImGui::NewFrame()
|
||||
|
||||
// [DEBUG] When io.ConfigDebugBeginReturnValue is set, we make Begin()/BeginChild() return false at different level of the window-stack,
|
||||
// allowing to validate correct Begin/End behavior in user code.
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
if (g.IO.ConfigDebugBeginReturnValueLoop)
|
||||
g.DebugBeginReturnValueCullDepth = (g.DebugBeginReturnValueCullDepth == -1) ? 0 : ((g.DebugBeginReturnValueCullDepth + ((g.FrameCount % 4) == 0 ? 1 : 0)) % 10);
|
||||
else
|
||||
g.DebugBeginReturnValueCullDepth = -1;
|
||||
#endif
|
||||
|
||||
CallContextHooks(&g, ImGuiContextHookType_NewFramePost);
|
||||
}
|
||||
@ -7059,12 +7065,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
|
||||
// [DEBUG] io.ConfigDebugBeginReturnValue override return value to test Begin/End and BeginChild/EndChild behaviors.
|
||||
// (The implicit fallback window is NOT automatically ended allowing it to always be able to receive commands without crashing)
|
||||
if (!window->IsFallbackWindow && ((g.IO.ConfigDebugBeginReturnValueOnce && window_just_created) || (g.IO.ConfigDebugBeginReturnValueLoop && g.DebugBeginReturnValueCullDepth == g.CurrentWindowStack.Size)))
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
if (!window->IsFallbackWindow)
|
||||
if ((g.IO.ConfigDebugBeginReturnValueOnce && window_just_created) || (g.IO.ConfigDebugBeginReturnValueLoop && g.DebugBeginReturnValueCullDepth == g.CurrentWindowStack.Size))
|
||||
{
|
||||
if (window->AutoFitFramesX > 0) { window->AutoFitFramesX++; }
|
||||
if (window->AutoFitFramesY > 0) { window->AutoFitFramesY++; }
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return !window->SkipItems;
|
||||
}
|
||||
@ -15561,9 +15570,6 @@ void ImGui::DebugLogV(const char*, va_list) {}
|
||||
void ImGui::ShowDebugLogWindow(bool*) {}
|
||||
void ImGui::ShowIDStackToolWindow(bool*) {}
|
||||
void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {}
|
||||
void ImGui::UpdateDebugToolItemPicker() {}
|
||||
void ImGui::UpdateDebugToolStackQueries() {}
|
||||
void ImGui::UpdateDebugToolFlashStyleColor() {}
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user