Tables: tweaked debug tools + minor data packing in in ImGuiTableColumn

This commit is contained in:
ocornut 2026-06-15 16:12:16 +02:00
parent fea6f4603a
commit 94a3dcc5fa
3 changed files with 29 additions and 18 deletions

View File

@ -16956,7 +16956,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
if (TreeNode("SettingsTables", "Settings packed data: Tables: %d bytes", g.SettingsTables.size())) if (TreeNode("SettingsTables", "Settings packed data: Tables: %d bytes", g.SettingsTables.size()))
{ {
for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings)) for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
DebugNodeTableSettings(settings); DebugNodeTableSettings(settings, NULL);
TreePop(); TreePop();
} }

View File

@ -2934,8 +2934,8 @@ struct ImGuiTableColumn
bool IsSkipItems; // Do we want item submissions to this column to be completely ignored (no layout will happen). bool IsSkipItems; // Do we want item submissions to this column to be completely ignored (no layout will happen).
bool IsPreserveWidthAuto; bool IsPreserveWidthAuto;
ImS8 NavLayerCurrent; // ImGuiNavLayer in 1 byte ImS8 NavLayerCurrent; // ImGuiNavLayer in 1 byte
ImU8 AutoFitQueue; // Queue of 8 values for the next 8 frames to request auto-fit ImU8 AutoFitQueue : 4; // Queue of 4 values for the next 4 frames to request auto-fit
ImU8 CannotSkipItemsQueue; // Queue of 8 values for the next 8 frames to disable Clipped/SkipItem ImU8 CannotSkipItemsQueue : 4; // Queue of 4 values for the next 4 frames to disable Clipped/SkipItem
ImU8 SortDirection : 2; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending ImU8 SortDirection : 2; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending
ImU8 SortDirectionsAvailCount : 2; // Number of available sort directions (0 to 3) ImU8 SortDirectionsAvailCount : 2; // Number of available sort directions (0 to 3)
ImU8 SortDirectionsAvailMask : 4; // Mask of available sort directions (1-bit each) ImU8 SortDirectionsAvailMask : 4; // Mask of available sort directions (1-bit each)
@ -3785,7 +3785,7 @@ namespace ImGui
IMGUI_API void DebugNodeStorage(ImGuiStorage* storage, const char* label); IMGUI_API void DebugNodeStorage(ImGuiStorage* storage, const char* label);
IMGUI_API void DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label); IMGUI_API void DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label);
IMGUI_API void DebugNodeTable(ImGuiTable* table); IMGUI_API void DebugNodeTable(ImGuiTable* table);
IMGUI_API void DebugNodeTableSettings(ImGuiTableSettings* settings); IMGUI_API void DebugNodeTableSettings(ImGuiTableSettings* settings, ImGuiTable* table);
IMGUI_API void DebugNodeInputTextState(ImGuiInputTextState* state); IMGUI_API void DebugNodeInputTextState(ImGuiInputTextState* state);
IMGUI_API void DebugNodeTypingSelectState(ImGuiTypingSelectState* state); IMGUI_API void DebugNodeTypingSelectState(ImGuiTypingSelectState* state);
IMGUI_API void DebugNodeMultiSelectState(ImGuiMultiSelectState* state); IMGUI_API void DebugNodeMultiSelectState(ImGuiMultiSelectState* state);

View File

@ -4214,16 +4214,24 @@ void ImGui::DebugNodeTable(ImGuiTable* table)
} }
} }
if (ImGuiTableSettings* settings = TableGetBoundSettings(table)) if (ImGuiTableSettings* settings = TableGetBoundSettings(table))
DebugNodeTableSettings(settings); DebugNodeTableSettings(settings, table);
if (clear_settings) if (clear_settings)
table->IsResetAllRequest = true; // Queue a call to TableResetSettings() table->IsResetAllRequest = true; // Queue a call to TableResetSettings()
TreePop(); TreePop();
} }
void ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings) void ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings, ImGuiTable* table)
{
if (settings->ID == 0)
PushID(settings);
const bool open = TreeNode((void*)(intptr_t)settings->ID, "Settings 0x%08X (%d columns)", settings->ID, settings->ColumnsCount);
const bool hovered = IsItemHovered();
if (hovered && table == NULL && settings->ID != 0)
table = TableFindByID(settings->ID);
if (hovered && table != NULL)
GetForegroundDrawList(table->OuterWindow)->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255));
if (open)
{ {
if (!TreeNode((void*)(intptr_t)settings->ID, "Settings 0x%08X (%d columns)", settings->ID, settings->ColumnsCount))
return;
BulletText("SaveFlags: 0x%08X", settings->SaveFlags); BulletText("SaveFlags: 0x%08X", settings->SaveFlags);
BulletText("ColumnsCount: %d (max %d)", settings->ColumnsCount, settings->ColumnsCountMax); BulletText("ColumnsCount: %d (max %d)", settings->ColumnsCount, settings->ColumnsCountMax);
for (int n = 0; n < settings->ColumnsCount; n++) for (int n = 0; n < settings->ColumnsCount; n++)
@ -4237,6 +4245,9 @@ void ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings)
} }
TreePop(); TreePop();
} }
if (settings->ID == 0)
PopID();
}
#else // #ifndef IMGUI_DISABLE_DEBUG_TOOLS #else // #ifndef IMGUI_DISABLE_DEBUG_TOOLS