Skip to content

Debug tools: "Item Picker", "Show window rectangles" #2673

Closed

Description

@ocornut

Update 2024

  • I have promoted ImGui::DebugStartItemPicker() to public API (i am honestly not sure why it wasn't done before).
  • I have also added the Item Picker option to Demo->Tools->Item Picker BUT it is greyed out if io.ConfigDebugIsDebuggerPresent is not set. This is partly to promote the discovery of both the item picker and the io.ConfigDebugIsDebuggerPresent option.
  • It is still and always available from Metrics->Tools.
  • See https://github.com/ocornut/imgui/wiki/Debug-Tools for details.

FYI
Recently added some tools in the Metrics window.

(1)
The "Item Picker" will allow you to pick an item and have dear imgui break within the call-stack of that item. This is useful if you have large UI / codebase and you would to easily find out where some UI item is emitted. This only works on item that are hoverable and have an identifier, so e.g. raw ImGui::Text() items won't work.

image

image

image

This will call IM_DEBUG_BREAK() which for Clang and Visual Studio default to a nice debugger break, for other compiles default to an unsatisfying IM_ASSERT(0) (can improve!). You can always #define IM_DEBUG_BREAK to anything in imconfig.h. See commit: 130b449

(2)
The "Show windows rectangles" tool allows you to visualize various rectangles which purpose may otherwise be difficult to understand. If you need to work within dear imgui codebase this can be useful to clarify what's going on.
image

Activity

  1. ocornut commented on Jul 19, 2019

    @ocornut
    OwnerAuthor

    Item Picker:
    I also exposed a function in imgui_internal.h ImGui::DebugStartItemPicker() to enable this, so it can be wired directly in a menu or shortcut.
    This tool has been incredibly useful to me in the past few days - generally when dealing with large or foreign codebase. Highly recommend trying it out.

  2. ocornut commented on Feb 20, 2024

    @ocornut
    OwnerAuthor

    I have promoted ImGui::DebugStartItemPicker() to public API (i am honestly not sure why it wasn't done before).

    I have also added the Item Picker option to Demo->Tools BUT it is greyed out if io.ConfigDebugIsDebuggerPresent is not set. This is partly to promote the discovery of both the item picker and the io.ConfigDebugIsDebuggerPresent option.

  3. ocornut commented on Jan 9, 2025

    @ocornut
    OwnerAuthor

    Closing this now.
    Note the wiki page https://github.com/ocornut/imgui/wiki/Debug-Tools

  4. added a commit that references this issue on Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址