Debug Tools: Item Picker: remove IMGUI_DEBUG_TOOL_ITEM_PICKER_EX since it doesn't work on non-ItemHoverable() items anyway. (#2673)

Call stack difference not meaningful.
This commit is contained in:
ocornut 2022-10-21 18:03:46 +02:00
parent bc918404fe
commit f6bd7c8e53
2 changed files with 2 additions and 17 deletions

View File

@ -108,11 +108,6 @@
//#define IM_DEBUG_BREAK IM_ASSERT(0) //#define IM_DEBUG_BREAK IM_ASSERT(0)
//#define IM_DEBUG_BREAK __debugbreak() //#define IM_DEBUG_BREAK __debugbreak()
//---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(),
// (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.)
// This adds a small runtime cost which is why it is not enabled by default.
//#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
//---- Debug Tools: Enable slower asserts //---- Debug Tools: Enable slower asserts
//#define IMGUI_DEBUG_PARANOID //#define IMGUI_DEBUG_PARANOID

View File

@ -3716,8 +3716,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
// [DEBUG] Item Picker tool! // [DEBUG] Item Picker tool!
// We perform the check here because SetHoveredID() is not frequently called (1~ time a frame), making // 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 // the cost of this tool near-zero. We can get slightly better call-stack and support picking non-hovered
// items if we perform the test in ItemAdd(), but that would incur a small runtime cost. // items if we performed the test in ItemAdd(), but that would incur a small runtime cost.
// #define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX in imconfig.h if you want this check to also be performed in ItemAdd().
if (g.DebugItemPickerActive && g.HoveredIdPreviousFrame == id) if (g.DebugItemPickerActive && g.HoveredIdPreviousFrame == id)
GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255)); GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255));
if (g.DebugItemPickerBreakId == id) if (g.DebugItemPickerBreakId == id)
@ -8646,15 +8645,6 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
// Empty identifier are valid and useful in a small amount of cases, but 99.9% of the time you want to use "##something". // Empty identifier are valid and useful in a small amount of cases, but 99.9% of the time you want to use "##something".
// READ THE FAQ: https://dearimgui.org/faq // READ THE FAQ: https://dearimgui.org/faq
IM_ASSERT(id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!"); IM_ASSERT(id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!");
// [DEBUG] Item Picker tool, when enabling the "extended" version we perform the check in ItemAdd()
#ifdef IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
if (id == g.DebugItemPickerBreakId)
{
IM_DEBUG_BREAK();
g.DebugItemPickerBreakId = 0;
}
#endif
} }
g.NextItemData.Flags = ImGuiNextItemDataFlags_None; g.NextItemData.Flags = ImGuiNextItemDataFlags_None;
@ -13421,7 +13411,7 @@ void ImGui::DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int wi
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// [SECTION] DEBUG LOG // [SECTION] DEBUG LOG WINDOW
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ImGui::DebugLog(const char* fmt, ...) void ImGui::DebugLog(const char* fmt, ...)