Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ocornut opened this issue Jul 17, 2019 · 2 comments
Open

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

ocornut opened this issue Jul 17, 2019 · 2 comments

Comments

@ocornut
Copy link
Owner

ocornut commented Jul 17, 2019

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.

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

@ocornut
Copy link
Owner Author

ocornut commented Jul 19, 2019

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.

actondev pushed a commit to actondev/imgui that referenced this issue Nov 26, 2021
ocornut added a commit that referenced this issue Oct 21, 2022
…e it doesn't work on non-ItemHoverable() items anyway. (#2673)

Call stack difference not meaningful.
BramblePie pushed a commit to BramblePie/imgui that referenced this issue Oct 26, 2022
…e it doesn't work on non-ItemHoverable() items anyway. (ocornut#2673)

Call stack difference not meaningful.
BramblePie pushed a commit to BramblePie/imgui that referenced this issue Oct 26, 2022
…e it doesn't work on non-ItemHoverable() items anyway. (ocornut#2673)

Call stack difference not meaningful.
ocornut added a commit that referenced this issue Nov 4, 2022
…ally locate items when hovering a 0xXXXXXXXX value. (#5855, #2673, #4631)
kjblanchard pushed a commit to kjblanchard/imgui that referenced this issue May 5, 2023
…e it doesn't work on non-ItemHoverable() items anyway. (ocornut#2673)

Call stack difference not meaningful.
kjblanchard pushed a commit to kjblanchard/imgui that referenced this issue May 5, 2023
@ocornut
Copy link
Owner Author

ocornut commented Feb 20, 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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant