mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-19 01:38:23 +00:00
Debug Tools: ID Stack Tool: internal renaming (should be no-op).
This commit is contained in:
32
imgui.cpp
32
imgui.cpp
@@ -4069,7 +4069,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
||||
WheelingWindowReleaseTimer = 0.0f;
|
||||
|
||||
DebugDrawIdConflictsId = 0;
|
||||
DebugHookIdInfo = 0;
|
||||
DebugHookIdInfoId = 0;
|
||||
HoveredId = HoveredIdPreviousFrame = 0;
|
||||
HoveredIdPreviousFrameItemCount = 0;
|
||||
HoveredIdAllowOverlap = false;
|
||||
@@ -8980,7 +8980,7 @@ ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end)
|
||||
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
ImGuiContext& g = *Ctx;
|
||||
if (g.DebugHookIdInfo == id)
|
||||
if (g.DebugHookIdInfoId == id)
|
||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
||||
#endif
|
||||
return id;
|
||||
@@ -8992,7 +8992,7 @@ ImGuiID ImGuiWindow::GetID(const void* ptr)
|
||||
ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
ImGuiContext& g = *Ctx;
|
||||
if (g.DebugHookIdInfo == id)
|
||||
if (g.DebugHookIdInfoId == id)
|
||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL);
|
||||
#endif
|
||||
return id;
|
||||
@@ -9004,7 +9004,7 @@ ImGuiID ImGuiWindow::GetID(int n)
|
||||
ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
ImGuiContext& g = *Ctx;
|
||||
if (g.DebugHookIdInfo == id)
|
||||
if (g.DebugHookIdInfoId == id)
|
||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
||||
#endif
|
||||
return id;
|
||||
@@ -9067,7 +9067,7 @@ void ImGui::PushOverrideID(ImGuiID id)
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
if (g.DebugHookIdInfo == id)
|
||||
if (g.DebugHookIdInfoId == id)
|
||||
DebugHookIdInfo(id, ImGuiDataType_ID, NULL, NULL);
|
||||
#endif
|
||||
window->IDStack.push_back(id);
|
||||
@@ -9081,7 +9081,7 @@ ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed)
|
||||
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.DebugHookIdInfo == id)
|
||||
if (g.DebugHookIdInfoId == id)
|
||||
DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
||||
#endif
|
||||
return id;
|
||||
@@ -9092,7 +9092,7 @@ ImGuiID ImGui::GetIDWithSeed(int n, ImGuiID seed)
|
||||
ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.DebugHookIdInfo == id)
|
||||
if (g.DebugHookIdInfoId == id)
|
||||
DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
||||
#endif
|
||||
return id;
|
||||
@@ -17661,21 +17661,21 @@ void ImGui::UpdateDebugToolStackQueries()
|
||||
ImGuiIDStackTool* tool = &g.DebugIDStackTool;
|
||||
|
||||
// Clear hook when id stack tool is not visible
|
||||
g.DebugHookIdInfo = 0;
|
||||
g.DebugHookIdInfoId = 0;
|
||||
if (g.FrameCount != tool->LastActiveFrame + 1)
|
||||
return;
|
||||
|
||||
// Update queries. The steps are: -1: query Stack, >= 0: query each stack item
|
||||
// We can only perform 1 ID Info query every frame. This is designed so the GetID() tests are cheap and constant-time
|
||||
const ImGuiID query_id = g.HoveredIdPreviousFrame ? g.HoveredIdPreviousFrame : g.ActiveId;
|
||||
if (tool->QueryId != query_id)
|
||||
const ImGuiID query_main_id = g.HoveredIdPreviousFrame ? g.HoveredIdPreviousFrame : g.ActiveId;
|
||||
if (tool->QueryMainId != query_main_id)
|
||||
{
|
||||
tool->QueryId = query_id;
|
||||
tool->QueryMainId = query_main_id;
|
||||
tool->StackLevel = -1;
|
||||
tool->Results.resize(0);
|
||||
tool->ResultPathsBuf.resize(0);
|
||||
}
|
||||
if (query_id == 0)
|
||||
if (query_main_id == 0)
|
||||
return;
|
||||
|
||||
// Advance to next stack level when we got our result, or after 2 frames (in case we never get a result)
|
||||
@@ -17687,10 +17687,10 @@ void ImGui::UpdateDebugToolStackQueries()
|
||||
// Update hook
|
||||
stack_level = tool->StackLevel;
|
||||
if (stack_level == -1)
|
||||
g.DebugHookIdInfo = query_id;
|
||||
if (stack_level >= 0 && stack_level < tool->Results.Size)
|
||||
g.DebugHookIdInfoId = query_main_id;
|
||||
else if (stack_level >= 0 && stack_level < tool->Results.Size)
|
||||
{
|
||||
g.DebugHookIdInfo = tool->Results[stack_level].ID;
|
||||
g.DebugHookIdInfoId = tool->Results[stack_level].ID;
|
||||
tool->Results[stack_level].QueryFrameCount++;
|
||||
}
|
||||
}
|
||||
@@ -17801,7 +17801,7 @@ void ImGui::ShowIDStackToolWindow(bool* p_open)
|
||||
p = p_next;
|
||||
}
|
||||
}
|
||||
Text("0x%08X", tool->QueryId);
|
||||
Text("0x%08X", tool->QueryMainId);
|
||||
SameLine();
|
||||
MetricsHelpMarker("Hover an item with the mouse to display elements of the ID Stack leading to the item's final ID.\nEach level of the stack correspond to a PushID() call.\nAll levels of the stack are hashed together to make the final ID of a widget (ID displayed at the bottom level of the stack).\nRead FAQ entry about the ID stack for details.");
|
||||
|
||||
|
@@ -2126,7 +2126,7 @@ struct ImGuiIDStackTool
|
||||
{
|
||||
int LastActiveFrame;
|
||||
int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level
|
||||
ImGuiID QueryId; // ID to query details for
|
||||
ImGuiID QueryMainId; // ID to query details for
|
||||
ImVector<ImGuiStackLevelInfo> Results;
|
||||
bool OptHexEncodeNonAsciiChars;
|
||||
bool OptCopyToClipboardOnCtrlC;
|
||||
@@ -2216,7 +2216,7 @@ struct ImGuiContext
|
||||
|
||||
// Item/widgets state and tracking information
|
||||
ImGuiID DebugDrawIdConflictsId; // Set when we detect multiple items with the same identifier
|
||||
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||||
ImGuiID DebugHookIdInfoId; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||||
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
||||
ImGuiID HoveredIdPreviousFrame;
|
||||
int HoveredIdPreviousFrameItemCount; // Count numbers of items using the same ID as last frame's hovered id
|
||||
|
Reference in New Issue
Block a user