mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Internals: Added IMGUI_DEBUG_INI_SETTINGS. Made IMGUI_DEBUG_LOG redefinable in imconfig.h. Comments. Fix to allow Metrics's NodeWindow() being called with a NULL window.
This commit is contained in:
15
imgui.cpp
15
imgui.cpp
@ -998,6 +998,7 @@ CODE
|
||||
// Debug options
|
||||
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL
|
||||
#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
|
||||
#define IMGUI_DEBUG_INI_SETTINGS 0 // Save additional comments in .ini file
|
||||
|
||||
// Visual Studio warnings
|
||||
#ifdef _MSC_VER
|
||||
@ -4795,6 +4796,7 @@ ImGuiWindow* ImGui::FindWindowByName(const char* name)
|
||||
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
//IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags);
|
||||
|
||||
// Create window the first time
|
||||
ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name);
|
||||
@ -9265,8 +9267,12 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.SettingsWindows.push_back(ImGuiWindowSettings());
|
||||
ImGuiWindowSettings* settings = &g.SettingsWindows.back();
|
||||
if (const char* p = strstr(name, "###")) // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
||||
#if !IMGUI_DEBUG_INI_SETTINGS
|
||||
// Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
||||
// Preserve the full string when IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier.
|
||||
if (const char* p = strstr(name, "###"))
|
||||
name = p;
|
||||
#endif
|
||||
settings->Name = ImStrdup(name);
|
||||
settings->ID = ImHashStr(name);
|
||||
return settings;
|
||||
@ -9791,7 +9797,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
|
||||
static void NodeWindow(ImGuiWindow* window, const char* label)
|
||||
{
|
||||
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
|
||||
if (window == NULL)
|
||||
{
|
||||
ImGui::BulletText("%s: NULL", label);
|
||||
return;
|
||||
}
|
||||
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, (window->Active || window->WasActive), window))
|
||||
return;
|
||||
ImGuiWindowFlags flags = window->Flags;
|
||||
NodeDrawList(window, window->DrawList, "DrawList");
|
||||
|
Reference in New Issue
Block a user