Skip to content

[minor] Add ImGuiApp.EnableExtensions to turn on ImGui extensions after launch - #623

Merged
matt-edmondson merged 2 commits into
mainfrom
claude/project-thread-dod34n
Oct 11, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
claude/project-thread-dod34n

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Before: ImGuiAppConfig.Extensions fixed the set of ImGui extensions at launch. An app that launched with None to keep ImNodes' startup cost off the launch path had no supported way to turn ImNodes on later. ImGuiExtensionManager.Initialize replaces the enabled set, so calling it again would drop extensions that were already on.

After: ImGuiApp.EnableExtensions(ImGuiAppExtensions) turns extensions on after launch, on the render thread, either between frames or inside OnRender before the extension is drawn with. It adds to the enabled set rather than replacing it, it is idempotent, and it returns which of the requested extensions are ready to draw with. Before launch it throws InvalidOperationException, because the launch-time setting is ImGuiAppConfig.Extensions. It works under ImGuiAppHarness without any harness changes.

How: the new ImGuiExtensionManager.Enable probes each newly added extension and shares the ImGui context with only those (SetImGuiContext and BeginFrame are now built on per-extension helpers). It then calls CreateExtensionContexts, which creates the ImNodes and ImPlot contexts with the dark style and leaves existing contexts alone. ImGuizmo draws into the window that its BeginFrame opens, and inside a frame the per-frame BeginFrame has already run. So when ImGuizmo is enabled while the ImGui context is WithinFrameScope, Enable calls its BeginFrame straight away. I checked that this is needed: without it, Manipulate in the same frame segfaults. Tests: EnableExtensionsTests (harness) covers enabling ImNodes between frames and inside OnRender, enabling twice, keeping an already enabled ImPlot, ImGuizmo Manipulate in the frame it is enabled, and the throw before launch. There are also new unit tests for ImGuiExtensionManager.Enable. CLAUDE.md and the ImGui.App and ImGui.App.Testing READMEs are updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q6T8bWvnxhB7gckKnGSN5D


Generated by Claude Code

…er launch

An application that launches with ImGuiAppConfig.Extensions = None to keep
ImNodes off the startup path can now enable it the first time a node editor
opens. ImGuiExtensionManager.Enable adds to the enabled set (Initialize
replaces it), probes, shares the ImGui context and creates the dark-styled
context exactly as launch does, and is idempotent. Enabling ImGuizmo inside
a frame begins its frame at once, since the per-frame BeginFrame has already
passed and Manipulate would otherwise draw through a null draw list.

Works under ImGuiAppHarness unchanged; covered by EnableExtensionsTests and
new ImGuiExtensionManager tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6T8bWvnxhB7gckKnGSN5D
@matt-edmondson matt-edmondson self-assigned this Oct 11, 2026
@matt-edmondson
matt-edmondson merged commit 5a57a95 into main Oct 11, 2026
6 checks passed
@matt-edmondson
matt-edmondson deleted the claude/project-thread-dod34n branch October 11, 2026 10:13
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants