v1.91.0
版本发布时间: 2024-07-30 23:02:07
ocornut/imgui最新发布版本:v1.91.3(2024-10-04 21:48:34)
1.91.0: multi-select, box-select, item flags, links & more
Reading the changelog is a good way to keep up to date with the things Dear ImGui has to offer, and maybe will give you ideas of some features that you've been ignoring until now!
📣 Click version number above to display full release note contents, otherwise it is clipped by GitHub! ❤️ This is the 100th release of Dear ImGui. 📆 In 12 days I will address the nation regarding upcoming plans for Dear Imgui, general thoughts, and putting more energy on topics that no one cares about such as: fonts, dpi scaling, styling, docking. *EDIT* Read August 15 post: "10 years of Dear ImGui". !
Links: Homepage - Release notes - FAQ - Issues, Q&A. Also see our Wiki with sections such as..
- Getting Started (~25 lines in an existing app)
- Useful Extensions/Widgets
- Software using Dear ImGui
- Bindings & Backends
- and more! 👌
Dear ImGui is funded by your contributions and absolutely needs them to sustain and grow. We can invoice and accommodate to many situations. If your company uses Dear ImGui, please reach out. See Funding & Sponsors page. Did you know? If you need an excuse to pay, you may buy licenses for Test Engine and that will contribute to fund Dear ImGui.
In the recent years, Dear ImGui has been financially supported by: Aras Pranckevičius / Arkane Lyon / Asobo Studio / Avalanche Studios Group / BeamNG / Blizzard / Esoterica Engine / G3Dvu / Lucid Games / Noel Berry / Mobigame / OTOY / Planestate Software / Pocketwatch Games / Remedy Entertainment / Sofistik / Supercell / Terrible Toybox / Tuxedo Labs / Wonderland Engine and many individual contributors. Thank you for allowing Dear ImGui to stay on its path.
Welcome to our new sponsors Valve, OTOY, Sofistik !!
Special thanks to @GamingMinds-DanielC, @PathogenDavid, @cfillion & more for for their help with patches and answers!
Some of the multi-selection demos:
Changes
Breaking Changes:
- IO, IME: renamed platform IME hook and added explicit context for consistency and future-proofness.
- old:
io.SetPlatformImeDataFn(ImGuiViewport* viewport, ImGuiPlatformImeData* data);
- new:
io.PlatformSetImeDataFn(ImGuiContext* ctx, ImGuiViewport* viewport, ImGuiPlatformImeData* data);
It is expected that for a vast majority of users this is automatically set by core library and/or platform backend so it won't have any effect.
- old:
- Obsoleted
GetContentRegionMax()
,GetWindowContentRegionMin()
andGetWindowContentRegionMax()
. (information thread: #7838) You should never need those functions! You can do everything in less a confusing manner by only usingGetCursorScreenPos()
andGetContentRegionAvail()
. Also always consider that if you are usingGetWindowPos()
andGetCursorPos()
you may also be making things unnecessarily complicated. I repeat: You can do everything withGetCursorScreenPos()
andGetContentRegionAvail()
!-
GetWindowContentRegionMax().x - GetCursorPos().x
-->GetContentRegionAvail().x
-
GetWindowContentRegionMax().x + GetWindowPos().x
-->GetCursorScreenPos().x + GetContentRegionAvail().x
// when called from left edge of window -
GetContentRegionMax()
-->GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos()
// right edge in local coordinates -
GetWindowContentRegionMax().x - GetWindowContentRegionMin().x
-->GetContentRegionAvail()
// when called from left edge of window
-
- Item flag changes:
- Obsoleted
PushButtonRepeat()
/PopButtonRepeat()
in favor of using newPushItemFlag()
/PopItemFlag()
withImGuiItemFlags_ButtonRepeat
. Kept inline redirecting functions (will obsolete). - Obsoleted
PushTabStop()
/PopTabStop()
in favor of using newPushItemFlag()
/PopItemFlag()
withImGuiItemFlags_NoTabStop
. Kept inline redirecting functions (will obsolete). - Renamed
ImGuiSelectableFlags_DontClosePopups
toImGuiSelectableFlags_NoAutoClosePopups
for consistency. Kept inline redirecting functions (will obsolete). + Internals: changed/invertedImGuiItemFlags_SelectableDontClosePopup
(default==false) toImGuiItemFlags_AutoClosePopups
(default==true), same logic, only inverted behavior. (#1379, #1468, #2200, #4936, #5216, #7302, #7573)
- Obsoleted
- Commented out obsolete
ImGuiModFlags
(renamed toImGuiKeyChord
in 1.89). (#4921, #456) - Commented out obsolete
ImGuiModFlags_XXX
values (renamed toImGuiMod_XXX
in 1.89). (#4921, #456)-
ImGuiModFlags_Ctrl
->ImGuiMod_Ctrl
,ImGuiModFlags_Shift
->ImGuiMod_Shift
etc.
-
- Backends: GLFW+Emscripten: Renamed
ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback()
toImGui_ImplGlfw_InstallEmscriptenCallbacks()
, with an additionalGLFWWindow*
parameter. (#7647) [@ypujante]
Other Changes
- Added
TextLink()
,TextLinkOpenURL()
hyperlink widgets. (#7660) - IO: added
io.PlatformOpenInShellFn()
handler to open a link/folder/file in OS shell. (#7660) Added IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS to disable default Windows/Linux/Mac implementation. - IO: added
io.ConfigNavSwapGamepadButtons
to swap Activate/Cancel (A<>B) buttons, to match the typical "Nintendo/Japanese consoles" button layout when using Gamepad navigation. (#787, #5723) - Added
PushItemFlag()
/PopItemFlags()
,ImGuiItemFlags
to modify shared item flags:- Added
ImGuiItemFlags_NoTabStop
to disable tabbing through items. - Added
ImGuiItemFlags_NoNav
to disable any navigation and focus of items. (#787) - Added
ImGuiItemFlags_NoNavDefaultFocus
to disable item being default focus. (#787) - Added
ImGuiItemFlags_ButtonRepeat
to enable repeat on any button-like behavior. - Added
ImGuiItemFlags_AutoClosePopups
to disable menu items/selection auto closing parent popups. Disabling this was previously possible for Selectable() via a direct flag but not for MenuItem(). (#1379, #1468, #2200, #4936, #5216, #7302, #7573) - This was mostly all previously in imgui_internal.h.
- Added
- Multi-Select: added multi-select API and demos. (#1861, #6518)
- This system implements standard multi-selection idioms (CTRL+mouse click, CTRL+keyboard moves, SHIFT+mouse click, SHIFT+keyboard moves, etc.) with support for clipper (not submitting non-visible items), box-selection with scrolling, and many other details.
- In the spirit of Dear ImGui design, your code owns both items and actual selection data. This is designed to allow all kinds of selection storage you may use in your application (e.g. set/map/hash, intrusive selection, interval trees, up to you).
- The supported widgets are Selectable(), Checkbox(). TreeNode() is also technically supported but... using this correctly is more complicated. You need some sort of linear/random access to your tree, which is suited to advanced trees setups already implementing filters and clipper. We will work toward simplifying our existing demo for trees.
- A helper
ImGuiSelectionBasicStorage
is provided to facilitate getting started in a typical app (likely to suit a majority of users). - Documentation:
- Wiki page https://github.com/ocornut/imgui/wiki/Multi-Select for API overview.
- Demo code + headers are well commented.
- Added
BeginMultiSelect()
,EndMultiSelect()
,SetNextItemSelectionUserData()
. - Added
IsItemToggledSelection()
for use if you need latest selection update during current iteration. - Added
ImGuiMultiSelectIO
andImGuiSelectionRequest
structures:-
BeginMultiSelect()
andEndMultiSelect()
return aImGuiMultiSelectIO
structure, which is mostly an array ofImGuiSelectionRequest
actions (clear, select all, set range, etc.) - Other fields are helpful when using a clipper, or wanting to handle deletion nicely.
-
- Added
ImGuiSelectionBasicStorage
helper to store and maintain a selection (optional):- This is similar to if you used e.g. a std::set<ID> to store a selection, with all the right glue to honor
ImGuiMultiSelectIO
requests. Most applications can use that.
- This is similar to if you used e.g. a std::set<ID> to store a selection, with all the right glue to honor
- Added
ImGuiSelectionExternalStorage
helper to maintain an externally stored selection (optional):- Helpful to easily bind multi-selection to e.g. an array of checkboxes.
- Added
ImGuiMultiSelectFlags
options:-
ImGuiMultiSelectFlags_SingleSelect
: Disable selecting more than one item. This is available to allow single-selection code to share same code/logic if desired. It essentially disables the main purpose of BeginMultiSelect() tho! -
ImGuiMultiSelectFlags_NoSelectAll
: Disable CTRL+A shortcut to select all. -
ImGuiMultiSelectFlags_NoRangeSelect
: Disable Shift+selection mouse/keyboard support (useful for unordered 2D selection). With BoxSelect is also ensure contiguous SetRange requests are not combined into one. This allows not handling interpolation in SetRange requests. -
ImGuiMultiSelectFlags_NoAutoSelect
: Disable selecting items when navigating (useful for e.g. supporting range-select in a list of checkboxes). -
ImGuiMultiSelectFlags_NoAutoClear
: Disable clearing selection when navigating or selecting another one (generally used with ImGuiMultiSelectFlags_NoAutoSelect. useful for e.g. supporting range-select in a list of checkboxes). -
ImGuiMultiSelectFlags_NoAutoClearOnReselect
: Disable clearing selection when clicking/selecting an already selected item. (#7424) -
ImGuiMultiSelectFlags_BoxSelect1d
: Enable box-selection with same width and same x pos items (e.g. full row Selectable()). Box-selection works better with little bit of spacing between items hit-box in order to be able to aim at empty space. -
ImGuiMultiSelectFlags_BoxSelect2d
: Enable box-selection with varying width or varying x pos items support (e.g. different width labels, or 2D layout/grid). This is slower: alters clipping logic so that e.g. horizontal movements will update selection of normally clipped items. -
ImGuiMultiSelectFlags_BoxSelectNoScroll
: Disable scrolling when box-selecting near edges of scope. -
ImGuiMultiSelectFlags_ClearOnEscape
: Clear selection when pressing Escape while scope is focused. -
ImGuiMultiSelectFlags_ClearOnClickVoid
. Clear selection when clicking on empty location within scope. -
ImGuiMultiSelectFlags_ScopeWindow
(default): Scope for _BoxSelect and _ClearOnClickVoid is whole window (Default). Use if BeginMultiSelect() covers a whole window or used a single time in same window. -
ImGuiMultiSelectFlags_ScopeRect
: Scope for _BoxSelect and _ClearOnClickVoid is rectangle encompassing BeginMultiSelect()/EndMultiSelect(). Use if BeginMultiSelect() is called multiple times in same window. -
ImGuiMultiSelectFlags_SelectOnClick
(default): Apply selection on mouse down when clicking on unselected item. (Default) -
ImGuiMultiSelectFlags_SelectOnClickRelease
: Apply selection on mouse release when clicking an unselected item. Allow dragging an unselected item without altering selection. -
ImGuiMultiSelectFlags_NavWrapX
: [Temporary] Enable navigation wrapping on X axis. Provided as a convenience because we don't have a design for the general Nav API for this yet. When the more general feature be public we may obsolete this flag in favor of new one.
-
- Demo: Added "Examples->Assets Browser" demo.
- Demo: Added "Widgets->Selection State & Multi-Select" section, with:
- Multi-Select
- Multi-Select (with clipper)
- Multi-Select (with deletion)
- Multi-Select (dual list box) (#6648)
- Multi-Select (in a table)
- Multi-Select (checkboxes)
- Multi-Select (multiple scopes)
- Multi-Select (tiled assert browser)
- Multi-Select (trees) (#1861)
- Multi-Select (advanced)
- Inputs: added
SetItemKeyOwner(ImGuiKey key)
in public API. This is a simplified version of a more complete set of function available in imgui_internal.h. One common use-case for this is to allow your widgets to disable standard inputs behaviors such as Tab or Alt handling, Mouse Wheel scrolling, etc. (#456, #2637, #2620, #2891, #3370, #3724, #4828, #5108, #5242, #5641)
// Hovering or activating the button will disable mouse wheel default behavior to scroll
InvisibleButton(...);
SetItemKeyOwner(ImGuiKey_MouseWheelY);
- Nav: fixed clicking window decorations (e.g. resize borders) from losing focused item when within a child window using
ImGuiChildFlags_NavFlattened
. - InputText: added '' and '/' as word separator. (#7824, #7704) [@reduf]
- TreeNode: added
SetNextItemStorageID()
to specify/override the identifier used for persisting open/close storage. Useful if needing to often read/write from storage without manipulating the ID stack. (#7553, #6990, #3823, #1131) - Selectable: added
ImGuiSelectableFlags_Highlight
flag to highlight items independently from the hovered state. (#7820) [@rerilier] - Clipper: added
SeekCursorForItem()
function. When usingImGuiListClipper::Begin(INT_MAX)
you can can use the clipper without knowing the amount of items beforehand. In this situation, callImGuiListClipper::SeekCursorForItem(items_count)
at the end of your iteration loop to position the layout cursor correctly. This is done automatically if provided a count to Begin(). (#1311) - Groups, Tables: fixed
EndGroup()
failing to correctly capture current table occupied size. (#7543) - Style, TabBar: added
style.TabBarOverlineSize
/ImGuiStyleVar_TabBarOverlineSize
to manipulate thickness of the horizontal line over selected tabs. [@DctrNoob] - Style: close button and collapse/window-menu button hover highlight made rectangular instead of round.
- Misc: added
GetID(int)
variant for consistency. (#7111) - Debug Tools:
- Debug Log: Added
IMGUI_DEBUG_LOG()
,ImGui::DebugLog()
in public API. (#5855) Printed entries include imgui frame counter prefix + are redirected toShowDebugLogWindow()
and other configurable locations. Always call IMGUI_DEBUG_LOG() for maximum stripping in caller code. - Debug Log: Added "Configure Outputs.." button. (#5855)
- Debug Log: Fixed incorrect checkbox layout when partially clipped.
- Debug Log: Added
- Demo: Reworked "Property Editor" demo in a manner that more resemble the tree data and struct description data that a real application would want to use.
- Backends:
- Backends: Win32: Fixed
ImGuiMod_Super
being mapped toVK_APPS
instead ofVK_LWIN || VK_RWIN
. (#7768, #4858, #2622) [@Aemony] - Backends: SDL3: Update for API changes:
SDL_GetGamepads()
memory ownership change. (#7807) - Backends: SDL3: Update for API changes:
SDL_GetClipboardText()
memory ownership change. (#7801) - Backends: SDL3: Update for API changes:
SDLK_x
renames andSDLK_KP_x
removals (#7761, #7762) - Backends: SDL3: Update for API changes:
SDL_GetProperty() change to
SDL_GetPointerProperty()`. (#7794) [@wermipls] - Backends: SDL2,SDL3,OSX: Update for
io.SetPlatformImeDataFn()
->io.PlatformSetImeDataFn()
rename. - Backends: GLFW,SDL2: Added
io.PlatformOpenInShellFn
handler for web/Emscripten versions. (#7660) [@ypujante, @ocornut] - Backends; GLFW+Emscripten: Added support for GLFW3 contrib port which fixes many of the things not supported by the embedded GLFW: gamepad support, mouse cursor shapes, copy to clipboard, workaround for Super/Meta key, different ways of resizing, multi-window (glfw/canvas) support. (#7647) [@ypujante]
- Backends: GLFW+Emscripten: Fixed Emscripten warning when using mouse wheel on some setups "Unable to preventDefault inside passive event listener". (#7647, #7600) [@ypujante]
- Backends: Win32: Fixed
Changes from 1.90.9 to 1.91.0 related to the Docking branch:
- Viewports: Always update fallback monitor to primary monitor if there's one.
- Backends: OSX: Fixed
NSAppKitVersion
version limit forsetWantsBestResolutionOpenGLSurface
usage. (#7814) [@YGXXD] - Backends: SDL3: Fixed a bug preventing
ImGuiViewportFlags_NoFocusOnAppearing
support from working (Windows only). - Backends: Vulkan:
ImGui_ImplVulkan_SwapBuffers()
used by secondary viewports still proceeds increasing frame counters onVK_SUBOPTIMAL_KHR
. (#7825, #3881) [@NostraMagister]
Bonus: Dear ImGui Multi-Context Compositor
Released a simple helper to facilitate displaying & interacting with multiple contexts simultaneously (e.g. update vs render domains contexts) https://github.com/ocornut/imgui_club -> imgui_multicontext_compositor Manages z-order, mouse/keyboard routing, cross-context drag and drop.
Gallery
TextLink(), TextLinkOpenURL()
Some more multi-select demos
Dear ImGui Test Engine running automated tests for box-selection :tv: Video link: https://github.com/user-attachments/assets/bf55db48-f57b-4b9c-b595-44c45281ef6b
@yannlemos: "We used ImGui to create the in-game developer console for Extremely Powerful Capybaras. " "We use the C# bindings provided by uimgui to use it inside Unity. Love ImGui, thanks for the effort!!" :tv: Video link: https://github.com/ocornut/imgui/assets/16945950/44e65ba6-b836-4353-91df-582b22ebe121
@ypujante "_Announcing the release of WebGPU Shader Toy, a free tool that you can access in your browser. There is a video demonstrating several of the features
@baderouaich "Enigma, A Simple, Reliable and Efficient Encryption Tool" https://github.com/baderouaich/Enigma
splatviz by @Florian-Barthel https://github.com/Florian-Barthel/splatviz
Openthesia: customizable midi visualization software kinda like Synthesia for Windows by @ImAxel0 Built using ImGui.NET wrapper. https://openthesia.pages.dev/ :tv: Video link: https://github.com/user-attachments/assets/b59182de-f99f-442c-a163-2bdb027330b0
@thedmd: "I took a swing at Wave Function Collapse. Once again Dear ImGui did heavy lifting by showing how internals does tick." :tv: Video link: https://github.com/user-attachments/assets/8c6894f9-edd4-49f4-8cdc-0163d72479f7
@alien-brother: "A synthesizer plugin I'm working on - https://sr.ht/~alien-brother/still. ImGui is one of the few UI frameworks that works well in a plugin - links statically and does not want to own the event loop."
Also see previous releases details. Note that GitHub are now clamping release notes sometimes really badly, click on a header/title to read full notes.
Dear ImGui is funded by your contributions and needs them to sustain and grow. We can invoice and accommodate to many situations. If your company uses Dear ImGui, please reach out (omar AT dearimgui DOT com). See Funding/Sponsors page. Did you know? If you need an excuse to pay, you may buy licenses for Test Engine and that will contribute to fund Dear ImGui.