mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Debug Tools: Added DebugLocateItem()/DebugLocateItemOnHover() to visually locate items when hovering a 0xXXXXXXXX value. (#5855, #2673, #4631)
This commit is contained in:
		@@ -1690,6 +1690,7 @@ struct ImGuiContext
 | 
			
		||||
    // Next window/item data
 | 
			
		||||
    ImGuiID                 CurrentFocusScopeId;                // == g.FocusScopeStack.back()
 | 
			
		||||
    ImGuiItemFlags          CurrentItemFlags;                   // == g.ItemFlagsStack.back()
 | 
			
		||||
    ImGuiID                 DebugLocateId;                      // Storage for DebugLocateItemOnHover() feature: this is read by ItemAdd() so we keep it in a hot/cached location
 | 
			
		||||
    ImGuiNextItemData       NextItemData;                       // Storage for SetNextItem** functions
 | 
			
		||||
    ImGuiLastItemData       LastItemData;                       // Storage for last submitted item (setup by ItemAdd)
 | 
			
		||||
    ImGuiNextWindowData     NextWindowData;                     // Storage for SetNextWindow** functions
 | 
			
		||||
@@ -1867,6 +1868,7 @@ struct ImGuiContext
 | 
			
		||||
    ImGuiDebugLogFlags      DebugLogFlags;
 | 
			
		||||
    ImGuiTextBuffer         DebugLogBuf;
 | 
			
		||||
    ImGuiTextIndex          DebugLogIndex;
 | 
			
		||||
    ImU8                    DebugLocateFrames;                  // For DebugLocateItemOnHover(). This is used together with DebugLocateId which is in a hot/cached spot above.
 | 
			
		||||
    bool                    DebugItemPickerActive;              // Item picker is active (started with DebugStartItemPicker())
 | 
			
		||||
    ImU8                    DebugItemPickerMouseButton;
 | 
			
		||||
    ImGuiID                 DebugItemPickerBreakId;             // Will call IM_DEBUG_BREAK() when encountering this ID
 | 
			
		||||
@@ -2029,6 +2031,8 @@ struct ImGuiContext
 | 
			
		||||
        LogDepthToExpand = LogDepthToExpandDefault = 2;
 | 
			
		||||
 | 
			
		||||
        DebugLogFlags = ImGuiDebugLogFlags_OutputToTTY;
 | 
			
		||||
        DebugLocateId = 0;
 | 
			
		||||
        DebugLocateFrames = 0;
 | 
			
		||||
        DebugItemPickerActive = false;
 | 
			
		||||
        DebugItemPickerMouseButton = ImGuiMouseButton_Left;
 | 
			
		||||
        DebugItemPickerBreakId = 0;
 | 
			
		||||
@@ -2958,6 +2962,9 @@ namespace ImGui
 | 
			
		||||
    IMGUI_API void          ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
 | 
			
		||||
    IMGUI_API void          ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
 | 
			
		||||
    IMGUI_API void          ErrorCheckUsingSetCursorPosToExtendParentBoundaries();
 | 
			
		||||
    IMGUI_API void          DebugLocateItem(ImGuiID target_id);                     // Call sparingly: only 1 at the same time!
 | 
			
		||||
    IMGUI_API void          DebugLocateItemOnHover(ImGuiID target_id);              // Only call on reaction to a mouse Hover: because only 1 at the same time!
 | 
			
		||||
    IMGUI_API void          DebugLocateItemResolveWithLastItem();
 | 
			
		||||
    inline void             DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255))    { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
 | 
			
		||||
    inline void             DebugStartItemPicker()                                  { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
 | 
			
		||||
    IMGUI_API void          ShowFontAtlas(ImFontAtlas* atlas);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user