Metrics/Debugger: Added DebugDrawCmdCallback + ImGuiDebugDrawCmdCallbackFn#9459
Metrics/Debugger: Added DebugDrawCmdCallback + ImGuiDebugDrawCmdCallbackFn#9459soufianekhiat wants to merge 1 commit into
Conversation
…llbackFn. When set, callback draw commands in the Metrics/Debugger's draw-list viewer show a descriptive TreeNode and optionally render mesh/bounding-box overlays on hover, instead of the opaque "Callback %p, user_data %p" bullet. The callback receives the draw list, the draw command, the two overlay toggles (mesh / bbox) already exposed by the Metrics config, and a text buffer to fill with a short description for the tree label. - Add ImGuiDebugDrawCmdCallbackFn typedef in imgui.h. - Add DebugDrawCmdCallback field on ImGuiIO (defaults to NULL). - In DebugNodeDrawList(), branch on the callback: descriptive TreeNode when set, previous BulletText fallback otherwise. Behaviour is unchanged for users that don't set the callback.
|
If that's a debug tool for a third-party project presumably you don't need to commit it to the main repo? It can be a commit in your fork? |
|
It also feels like that whatever code creates those draw cmd could perfectly them them to a list in your own subsystem where you could have your own debug renderer? You are not extracting much value of reusing Metrics/Debugger window here? |
|
I just illustrate my usecase. |
But my point stands, if you use callbacks a lots/wildly, you can very trivially add code that iterates windows or ImDrawData and display the callbacks in whatever way you like, or process that debugging differently. Right now your suggested scheme without chaining make it that multiple users of callbacks can't easily register debug callbacks. |
|
A better scheme would be:
|
When set, callback draw commands in the Metrics/Debugger's draw-list viewer show a descriptive TreeNode and optionally render mesh/bounding-box overlays on hover, instead of the opaque "Callback %p, user_data %p" bullet.
The callback receives the draw list, the draw command, the two overlay toggles (mesh / bbox) already exposed by the Metrics config, and a text buffer to fill with a short description for the tree label.
Only thing arbitrary I put 300 for default buffer size.
context: I'm using that on my branch refacto of to do debug view the glyph in text renderer with slug.
Example of usage: