mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-19 09:48:26 +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;
|
WheelingWindowReleaseTimer = 0.0f;
|
||||||
|
|
||||||
DebugDrawIdConflictsId = 0;
|
DebugDrawIdConflictsId = 0;
|
||||||
DebugHookIdInfo = 0;
|
DebugHookIdInfoId = 0;
|
||||||
HoveredId = HoveredIdPreviousFrame = 0;
|
HoveredId = HoveredIdPreviousFrame = 0;
|
||||||
HoveredIdPreviousFrameItemCount = 0;
|
HoveredIdPreviousFrameItemCount = 0;
|
||||||
HoveredIdAllowOverlap = false;
|
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);
|
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
||||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||||
ImGuiContext& g = *Ctx;
|
ImGuiContext& g = *Ctx;
|
||||||
if (g.DebugHookIdInfo == id)
|
if (g.DebugHookIdInfoId == id)
|
||||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
||||||
#endif
|
#endif
|
||||||
return id;
|
return id;
|
||||||
@@ -8992,7 +8992,7 @@ ImGuiID ImGuiWindow::GetID(const void* ptr)
|
|||||||
ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);
|
ImGuiID id = ImHashData(&ptr, sizeof(void*), seed);
|
||||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||||
ImGuiContext& g = *Ctx;
|
ImGuiContext& g = *Ctx;
|
||||||
if (g.DebugHookIdInfo == id)
|
if (g.DebugHookIdInfoId == id)
|
||||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL);
|
ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL);
|
||||||
#endif
|
#endif
|
||||||
return id;
|
return id;
|
||||||
@@ -9004,7 +9004,7 @@ ImGuiID ImGuiWindow::GetID(int n)
|
|||||||
ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
||||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||||
ImGuiContext& g = *Ctx;
|
ImGuiContext& g = *Ctx;
|
||||||
if (g.DebugHookIdInfo == id)
|
if (g.DebugHookIdInfoId == id)
|
||||||
ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
||||||
#endif
|
#endif
|
||||||
return id;
|
return id;
|
||||||
@@ -9067,7 +9067,7 @@ void ImGui::PushOverrideID(ImGuiID id)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||||
if (g.DebugHookIdInfo == id)
|
if (g.DebugHookIdInfoId == id)
|
||||||
DebugHookIdInfo(id, ImGuiDataType_ID, NULL, NULL);
|
DebugHookIdInfo(id, ImGuiDataType_ID, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
window->IDStack.push_back(id);
|
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);
|
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
|
||||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.DebugHookIdInfo == id)
|
if (g.DebugHookIdInfoId == id)
|
||||||
DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
DebugHookIdInfo(id, ImGuiDataType_String, str, str_end);
|
||||||
#endif
|
#endif
|
||||||
return id;
|
return id;
|
||||||
@@ -9092,7 +9092,7 @@ ImGuiID ImGui::GetIDWithSeed(int n, ImGuiID seed)
|
|||||||
ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
||||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.DebugHookIdInfo == id)
|
if (g.DebugHookIdInfoId == id)
|
||||||
DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL);
|
||||||
#endif
|
#endif
|
||||||
return id;
|
return id;
|
||||||
@@ -17661,21 +17661,21 @@ void ImGui::UpdateDebugToolStackQueries()
|
|||||||
ImGuiIDStackTool* tool = &g.DebugIDStackTool;
|
ImGuiIDStackTool* tool = &g.DebugIDStackTool;
|
||||||
|
|
||||||
// Clear hook when id stack tool is not visible
|
// Clear hook when id stack tool is not visible
|
||||||
g.DebugHookIdInfo = 0;
|
g.DebugHookIdInfoId = 0;
|
||||||
if (g.FrameCount != tool->LastActiveFrame + 1)
|
if (g.FrameCount != tool->LastActiveFrame + 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update queries. The steps are: -1: query Stack, >= 0: query each stack item
|
// 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
|
// 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;
|
const ImGuiID query_main_id = g.HoveredIdPreviousFrame ? g.HoveredIdPreviousFrame : g.ActiveId;
|
||||||
if (tool->QueryId != query_id)
|
if (tool->QueryMainId != query_main_id)
|
||||||
{
|
{
|
||||||
tool->QueryId = query_id;
|
tool->QueryMainId = query_main_id;
|
||||||
tool->StackLevel = -1;
|
tool->StackLevel = -1;
|
||||||
tool->Results.resize(0);
|
tool->Results.resize(0);
|
||||||
tool->ResultPathsBuf.resize(0);
|
tool->ResultPathsBuf.resize(0);
|
||||||
}
|
}
|
||||||
if (query_id == 0)
|
if (query_main_id == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Advance to next stack level when we got our result, or after 2 frames (in case we never get a result)
|
// 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
|
// Update hook
|
||||||
stack_level = tool->StackLevel;
|
stack_level = tool->StackLevel;
|
||||||
if (stack_level == -1)
|
if (stack_level == -1)
|
||||||
g.DebugHookIdInfo = query_id;
|
g.DebugHookIdInfoId = query_main_id;
|
||||||
if (stack_level >= 0 && stack_level < tool->Results.Size)
|
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++;
|
tool->Results[stack_level].QueryFrameCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17801,7 +17801,7 @@ void ImGui::ShowIDStackToolWindow(bool* p_open)
|
|||||||
p = p_next;
|
p = p_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text("0x%08X", tool->QueryId);
|
Text("0x%08X", tool->QueryMainId);
|
||||||
SameLine();
|
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.");
|
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 LastActiveFrame;
|
||||||
int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level
|
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;
|
ImVector<ImGuiStackLevelInfo> Results;
|
||||||
bool OptHexEncodeNonAsciiChars;
|
bool OptHexEncodeNonAsciiChars;
|
||||||
bool OptCopyToClipboardOnCtrlC;
|
bool OptCopyToClipboardOnCtrlC;
|
||||||
@@ -2216,7 +2216,7 @@ struct ImGuiContext
|
|||||||
|
|
||||||
// Item/widgets state and tracking information
|
// Item/widgets state and tracking information
|
||||||
ImGuiID DebugDrawIdConflictsId; // Set when we detect multiple items with the same identifier
|
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 HoveredId; // Hovered widget, filled during the frame
|
||||||
ImGuiID HoveredIdPreviousFrame;
|
ImGuiID HoveredIdPreviousFrame;
|
||||||
int HoveredIdPreviousFrameItemCount; // Count numbers of items using the same ID as last frame's hovered id
|
int HoveredIdPreviousFrameItemCount; // Count numbers of items using the same ID as last frame's hovered id
|
||||||
|
Reference in New Issue
Block a user