mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-25 05:06:59 +00:00
Debug Tools: Rename ShowIdStackToolWindow() -> ShowIDStackToolWindow(). (#4631)
Amend 8175a47
This commit is contained in:
parent
2f431a948c
commit
c21278eeae
@ -42,7 +42,7 @@ HOW TO UPDATE?
|
|||||||
|
|
||||||
Breaking changes:
|
Breaking changes:
|
||||||
|
|
||||||
- Debug Tools: Renamed ShowStackToolWindow() ("Stack Tool") to ShowIdStackToolWindow() ("ID Stack Tool"),
|
- Debug Tools: Renamed ShowStackToolWindow() ("Stack Tool") to ShowIDStackToolWindow() ("ID Stack Tool"),
|
||||||
as earlier name was misleading. Kept inline redirection function. (#4631)
|
as earlier name was misleading. Kept inline redirection function. (#4631)
|
||||||
- IO: Removed io.MetricsActiveAllocations introduced in 1.63, was displayed in Metrics and unlikely to
|
- IO: Removed io.MetricsActiveAllocations introduced in 1.63, was displayed in Metrics and unlikely to
|
||||||
be accessed by end-user. Value still visible in the UI and easily to recompute from a delta.
|
be accessed by end-user. Value still visible in the UI and easily to recompute from a delta.
|
||||||
|
@ -217,7 +217,7 @@ Interactive widgets (such as calls to Button buttons) need a unique ID.
|
|||||||
**Unique IDs are used internally to track active widgets and occasionally associate state to widgets.<BR>
|
**Unique IDs are used internally to track active widgets and occasionally associate state to widgets.<BR>
|
||||||
Unique IDs are implicitly built from the hash of multiple elements that identify the "path" to the UI element.**
|
Unique IDs are implicitly built from the hash of multiple elements that identify the "path" to the UI element.**
|
||||||
|
|
||||||
Since Dear ImGui 1.85, you can use `Demo>Tools>Stack Tool` or call `ImGui::ShowIdStackToolWindow()`. The tool display intermediate values leading to the creation of a unique ID, making things easier to debug and understand.
|
Since Dear ImGui 1.85, you can use `Demo>Tools>ID Stack Tool` or call `ImGui::ShowIDStackToolWindow()`. The tool display intermediate values leading to the creation of a unique ID, making things easier to debug and understand.
|
||||||
|
|
||||||
![Stack tool](https://user-images.githubusercontent.com/8225057/136235657-a0ea5665-dcd1-423f-9be6-dc3f8ced8f12.png)
|
![Stack tool](https://user-images.githubusercontent.com/8225057/136235657-a0ea5665-dcd1-423f-9be6-dc3f8ced8f12.png)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
|
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
|
||||||
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
||||||
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
|
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
|
||||||
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIdStackToolWindow() will be empty.
|
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIDStackToolWindow() will be empty.
|
||||||
|
|
||||||
//---- Don't implement some functions to reduce linkage requirements.
|
//---- Don't implement some functions to reduce linkage requirements.
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
||||||
|
22
imgui.cpp
22
imgui.cpp
@ -425,7 +425,7 @@ CODE
|
|||||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||||
|
|
||||||
- 2023/09/27 (1.90.0) - io: removed io.MetricsActiveAllocations introduced in 1.63. Same as 'g.DebugMemAllocCount - g.DebugMemFreeCount' (still displayed in Metrics, unlikely to be accessed by end-user).
|
- 2023/09/27 (1.90.0) - io: removed io.MetricsActiveAllocations introduced in 1.63. Same as 'g.DebugMemAllocCount - g.DebugMemFreeCount' (still displayed in Metrics, unlikely to be accessed by end-user).
|
||||||
- 2023/09/26 (1.90.0) - debug tools: Renamed ShowStackToolWindow() ("Stack Tool") to ShowIdStackToolWindow() ("ID Stack Tool"), as earlier name was misleading. Kept inline redirection function. (#4631)
|
- 2023/09/26 (1.90.0) - debug tools: Renamed ShowStackToolWindow() ("Stack Tool") to ShowIDStackToolWindow() ("ID Stack Tool"), as earlier name was misleading. Kept inline redirection function. (#4631)
|
||||||
- 2023/09/15 (1.90.0) - ListBox, Combo: changed signature of "name getter" callback in old one-liner ListBox()/Combo() apis. kept inline redirection function (will obsolete).
|
- 2023/09/15 (1.90.0) - ListBox, Combo: changed signature of "name getter" callback in old one-liner ListBox()/Combo() apis. kept inline redirection function (will obsolete).
|
||||||
- old: bool Combo(const char* label, int* current_item, bool (*getter)(void* user_data, int idx, const char** out_text), ...)
|
- old: bool Combo(const char* label, int* current_item, bool (*getter)(void* user_data, int idx, const char** out_text), ...)
|
||||||
- new: bool Combo(const char* label, int* current_item, const char* (*getter)(void* user_data, int idx), ...);
|
- new: bool Combo(const char* label, int* current_item, const char* (*getter)(void* user_data, int idx), ...);
|
||||||
@ -13732,8 +13732,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
|
ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
|
||||||
if (cfg->ShowDebugLog)
|
if (cfg->ShowDebugLog)
|
||||||
ShowDebugLogWindow(&cfg->ShowDebugLog);
|
ShowDebugLogWindow(&cfg->ShowDebugLog);
|
||||||
if (cfg->ShowIdStackTool)
|
if (cfg->ShowIDStackTool)
|
||||||
ShowIdStackToolWindow(&cfg->ShowIdStackTool);
|
ShowIDStackToolWindow(&cfg->ShowIDStackTool);
|
||||||
|
|
||||||
if (!Begin("Dear ImGui Metrics/Debugger", p_open) || GetCurrentWindow()->BeginCount > 1)
|
if (!Begin("Dear ImGui Metrics/Debugger", p_open) || GetCurrentWindow()->BeginCount > 1)
|
||||||
{
|
{
|
||||||
@ -13823,9 +13823,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
SameLine();
|
SameLine();
|
||||||
MetricsHelpMarker("You can also call ImGui::ShowDebugLogWindow() from your code.");
|
MetricsHelpMarker("You can also call ImGui::ShowDebugLogWindow() from your code.");
|
||||||
|
|
||||||
Checkbox("Show ID Stack Tool", &cfg->ShowIdStackTool);
|
Checkbox("Show ID Stack Tool", &cfg->ShowIDStackTool);
|
||||||
SameLine();
|
SameLine();
|
||||||
MetricsHelpMarker("You can also call ImGui::ShowIdStackToolWindow() from your code.");
|
MetricsHelpMarker("You can also call ImGui::ShowIDStackToolWindow() from your code.");
|
||||||
|
|
||||||
Checkbox("Show windows begin order", &cfg->ShowWindowsBeginOrder);
|
Checkbox("Show windows begin order", &cfg->ShowWindowsBeginOrder);
|
||||||
Checkbox("Show windows rectangles", &cfg->ShowWindowsRects);
|
Checkbox("Show windows rectangles", &cfg->ShowWindowsRects);
|
||||||
@ -14867,7 +14867,7 @@ void ImGui::UpdateDebugToolItemPicker()
|
|||||||
void ImGui::UpdateDebugToolStackQueries()
|
void ImGui::UpdateDebugToolStackQueries()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
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.DebugHookIdInfo = 0;
|
||||||
@ -14908,7 +14908,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
ImGuiIdStackTool* tool = &g.DebugIdStackTool;
|
ImGuiIDStackTool* tool = &g.DebugIDStackTool;
|
||||||
|
|
||||||
// Step 0: stack query
|
// Step 0: stack query
|
||||||
// This assumes that the ID was computed with the current ID stack, which tends to be the case for our widget.
|
// This assumes that the ID was computed with the current ID stack, which tends to be the case for our widget.
|
||||||
@ -14951,7 +14951,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
|
|||||||
info->DataType = data_type;
|
info->DataType = data_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int StackToolFormatLevelInfo(ImGuiIdStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size)
|
static int StackToolFormatLevelInfo(ImGuiIDStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
ImGuiStackLevelInfo* info = &tool->Results[n];
|
ImGuiStackLevelInfo* info = &tool->Results[n];
|
||||||
ImGuiWindow* window = (info->Desc[0] == 0 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL;
|
ImGuiWindow* window = (info->Desc[0] == 0 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL;
|
||||||
@ -14969,7 +14969,7 @@ static int StackToolFormatLevelInfo(ImGuiIdStackTool* tool, int n, bool format_f
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ID Stack Tool: Display UI
|
// ID Stack Tool: Display UI
|
||||||
void ImGui::ShowIdStackToolWindow(bool* p_open)
|
void ImGui::ShowIDStackToolWindow(bool* p_open)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize))
|
if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize))
|
||||||
@ -14981,7 +14981,7 @@ void ImGui::ShowIdStackToolWindow(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display hovered/active status
|
// Display hovered/active status
|
||||||
ImGuiIdStackTool* tool = &g.DebugIdStackTool;
|
ImGuiIDStackTool* tool = &g.DebugIDStackTool;
|
||||||
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
||||||
const ImGuiID active_id = g.ActiveId;
|
const ImGuiID active_id = g.ActiveId;
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
@ -15063,7 +15063,7 @@ void ImGui::DebugNodeViewport(ImGuiViewportP*) {}
|
|||||||
void ImGui::DebugLog(const char*, ...) {}
|
void ImGui::DebugLog(const char*, ...) {}
|
||||||
void ImGui::DebugLogV(const char*, va_list) {}
|
void ImGui::DebugLogV(const char*, va_list) {}
|
||||||
void ImGui::ShowDebugLogWindow(bool*) {}
|
void ImGui::ShowDebugLogWindow(bool*) {}
|
||||||
void ImGui::ShowIdStackToolWindow(bool*) {}
|
void ImGui::ShowIDStackToolWindow(bool*) {}
|
||||||
void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {}
|
void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {}
|
||||||
void ImGui::UpdateDebugToolItemPicker() {}
|
void ImGui::UpdateDebugToolItemPicker() {}
|
||||||
void ImGui::UpdateDebugToolStackQueries() {}
|
void ImGui::UpdateDebugToolStackQueries() {}
|
||||||
|
4
imgui.h
4
imgui.h
@ -307,7 +307,7 @@ namespace ImGui
|
|||||||
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
||||||
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
|
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
|
||||||
IMGUI_API void ShowDebugLogWindow(bool* p_open = NULL); // create Debug Log window. display a simplified log of important dear imgui events.
|
IMGUI_API void ShowDebugLogWindow(bool* p_open = NULL); // create Debug Log window. display a simplified log of important dear imgui events.
|
||||||
IMGUI_API void ShowIdStackToolWindow(bool* p_open = NULL); // create Stack Tool window. hover items with mouse to query information about the source of their unique ID.
|
IMGUI_API void ShowIDStackToolWindow(bool* p_open = NULL); // create Stack Tool window. hover items with mouse to query information about the source of their unique ID.
|
||||||
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
||||||
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
|
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
|
||||||
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
||||||
@ -3099,7 +3099,7 @@ namespace ImGui
|
|||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
// OBSOLETED in 1.90.0 (from September 2023)
|
// OBSOLETED in 1.90.0 (from September 2023)
|
||||||
static inline void ShowStackToolWindow(bool* p_open = NULL) { ShowIdStackToolWindow(p_open); }
|
static inline void ShowStackToolWindow(bool* p_open = NULL) { ShowIDStackToolWindow(p_open); }
|
||||||
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int height_in_items = -1);
|
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int height_in_items = -1);
|
||||||
IMGUI_API bool Combo(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int popup_max_height_in_items = -1);
|
IMGUI_API bool Combo(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int popup_max_height_in_items = -1);
|
||||||
// OBSOLETED in 1.89.7 (from June 2023)
|
// OBSOLETED in 1.89.7 (from June 2023)
|
||||||
|
@ -299,7 +299,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (show_tool_debug_log)
|
if (show_tool_debug_log)
|
||||||
ImGui::ShowDebugLogWindow(&show_tool_debug_log);
|
ImGui::ShowDebugLogWindow(&show_tool_debug_log);
|
||||||
if (show_tool_id_stack_tool)
|
if (show_tool_id_stack_tool)
|
||||||
ImGui::ShowIdStackToolWindow(&show_tool_id_stack_tool);
|
ImGui::ShowIDStackToolWindow(&show_tool_id_stack_tool);
|
||||||
if (show_tool_style_editor)
|
if (show_tool_style_editor)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Dear ImGui Style Editor", &show_tool_style_editor);
|
ImGui::Begin("Dear ImGui Style Editor", &show_tool_style_editor);
|
||||||
|
@ -1803,7 +1803,7 @@ struct ImGuiDebugAllocInfo
|
|||||||
struct ImGuiMetricsConfig
|
struct ImGuiMetricsConfig
|
||||||
{
|
{
|
||||||
bool ShowDebugLog = false;
|
bool ShowDebugLog = false;
|
||||||
bool ShowIdStackTool = false;
|
bool ShowIDStackTool = false;
|
||||||
bool ShowWindowsRects = false;
|
bool ShowWindowsRects = false;
|
||||||
bool ShowWindowsBeginOrder = false;
|
bool ShowWindowsBeginOrder = false;
|
||||||
bool ShowTablesRects = false;
|
bool ShowTablesRects = false;
|
||||||
@ -1826,7 +1826,7 @@ struct ImGuiStackLevelInfo
|
|||||||
};
|
};
|
||||||
|
|
||||||
// State for ID Stack tool queries
|
// State for ID Stack tool queries
|
||||||
struct ImGuiIdStackTool
|
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
|
||||||
@ -1835,7 +1835,7 @@ struct ImGuiIdStackTool
|
|||||||
bool CopyToClipboardOnCtrlC;
|
bool CopyToClipboardOnCtrlC;
|
||||||
float CopyToClipboardLastTime;
|
float CopyToClipboardLastTime;
|
||||||
|
|
||||||
ImGuiIdStackTool() { memset(this, 0, sizeof(*this)); CopyToClipboardLastTime = -FLT_MAX; }
|
ImGuiIDStackTool() { memset(this, 0, sizeof(*this)); CopyToClipboardLastTime = -FLT_MAX; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -2149,7 +2149,7 @@ struct ImGuiContext
|
|||||||
ImU8 DebugItemPickerMouseButton;
|
ImU8 DebugItemPickerMouseButton;
|
||||||
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID
|
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID
|
||||||
ImGuiMetricsConfig DebugMetricsConfig;
|
ImGuiMetricsConfig DebugMetricsConfig;
|
||||||
ImGuiIdStackTool DebugIdStackTool;
|
ImGuiIDStackTool DebugIdStackTool;
|
||||||
ImGuiDebugAllocInfo DebugAllocInfo;
|
ImGuiDebugAllocInfo DebugAllocInfo;
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
|
Loading…
Reference in New Issue
Block a user