ImGui.NET
ImGui.NET copied to clipboard
Expose ImGui internals (experimental) using 1.85 WIP
Description
Add changes to expose ImGui internals using ImGui 1.85 WIP. This PR is based on the fork of https://github.com/renenieuw/ImGui.NET (see https://github.com/mellinoe/ImGui.NET/issues/202) and is currently in experimental status.
The fork introduces a last-moment string replacement on the generated files to allow correcting code that has not been generated properly. While it seems to be working at the moment, it kinda defeats the whole purpose of the code generator and focus should be on fixing the remaining errors to get rid of it again. Still having a pull request might get this feature a bit more attention than a fork mentioned deep down in a random issue.
I have added an example using the internal DockBuilder API in the SampleProgram.XNA project. However, it's probably better to move these changes into a separate PR and the regular/a more advanced example app.. "I got carried away while refactoring" does not even come close, there are a lot of changes that are really unnecessary for this feature. I'm open to all ideas though!
The C binaries have been compiled using https://github.com/mellinoe/ImGui.NET-nativebuild/pull/3. The CodeGenerator can now be invoked with a third argument to enable or disable exposing internals in the generated files: dotnet run -p src\CodeGenerator\CodeGenerator.csproj src\ImGui.NET\Generated cimgui true
Last but not least I have removed a non-existing reference from the ImPlot.NET project file, and the CodeGenerator can be forced to always copy the definition json files to the output folder by setting a environment variable: SET CopyToOutputDirectory=Always (any other value will fallback to the original behaviour of PreserveNewest)
| Library | Compiles with internal |
|---|---|
| ImGui.NET | yes |
| ImPlot.NET | no (is this important at all?) |
| ImGuizmo.NET | yes |
| ImNodes.NET | yes |
Without DockingEnable flag

With DockingEnable flag

Demo stuff is working too!

Type of change
- [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] This change requires a documentation update
How Has This Been Tested?
I have implemented an example of the internal DockBuilder API inside the XNA sample.
- [x] SampleProgram
- [x] SampleProgram.XNA
- [x] ImGui Demo
- [x] My own DIY engine
Test Configuration:
- OS: Windows 10 x64
- Hardware: GTX 1080TI
Checklist:
- [ ] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [x] I have added ~tests~ examples that prove my fix is effective or that my feature works
- [ ] Any dependent changes have been merged and published in downstream modules
Thanks for putting this together, experimental or not I will give it a shot. Not being able to predefine a docking layout makes it pretty annoying to use.
I really want this and access to the internals!!! 😁
What else is needed for this pull request to be merged? more tests? features? I wanted to use this feature and maybe i can help out finishing this PR
What else is needed for this pull request to be merged? more tests? features? I wanted to use this feature and maybe i can help out finishing this PR
It's been a while since I worked on this, so bear with me if I miss something.
The generated code seems be mostly correct, but still has a few obvious errors whose cause I can't find on my own. The PostFixes class kind of documents all these errors, and does some string replace/remove on the generated code to make the compiler happy.
This approach works in theory, but has the obvious problem that we simply discard parts of the internals. It is also a pain to maintain, as we probably have to adjust these tweaks with every ImGui update. Therefore, we probably need to get rid of these monkey patches (basically remove the PostFixes file) as the next step.
I'll try to find some time to rebase the PR in the next couple days. If it doesn't break too many things I'll also update to ImGui 1.87, maybe it fixes some of the issues 👍
@JulianVallee If you need any help tag me here, i can work with you if needed
@JulianVallee I hope you dont mind but i stole a bit of your code and put on my own fork of imgui.net, i really want to test and use imgui, i gave you proper credits and i hope you dont mind.
https://github.com/MarioGK/ImGuiSharp/blob/main/CREDITS.md
@JulianVallee I hope you dont mind but i stole a bit of your code and put on my own fork of imgui.net, i really want to test and use imgui, i gave you proper credits and i hope you dont mind.
https://github.com/MarioGK/ImGuiSharp/blob/main/CREDITS.md
No not at all, feel free to use code of this PR in any way you want. Credits are highly appreciated, but wouldn't have been necessary!
PS: Noticed the discord link in your readme.md doesn't work, the link is broken.
It works fine on Windows, but on Linux, some APIs give the error EntryPoint not found, such as ImGui.PushStyleVar, ImGui.TreeNode, etc. How can I fix this problem?
It works fine on Windows, but on Linux, some APIs give the error EntryPoint not found, such as ImGui.PushStyleVar, ImGui.TreeNode, etc. How can I fix this problem?
Maybe, it is time to move this discussion on that repo? It will help that repo grow and become as awesome as imgui.net.
@zzxzzk115 If you want to talk about this please move to my repo https://github.com/MarioGK/ImGuiSharp OBS: I am rewriting the code generator from scratch using C#'s source generator and templates to make it easier to edit the source code, it will take a while before i prioritize building for linux and mac @JulianVallee Fixed the discord link, i forgot to properly create an invite link
@zzxzzk115 If you want to talk about this please move to my repo https://github.com/MarioGK/ImGuiSharp OBS: I am rewriting the code generator from scratch using C#'s source generator and templates to make it easier to edit the source code, it will take a while before i prioritize building for linux and mac @JulianVallee Fixed the discord link, i forgot to properly create an invite link
That's great! Ok I'll keep watching on your repo.
Does this expose the Impli methods that make implementing imgui for some api's easier?
Works to a degree but using this on the latest version 1.89.3 causes so many errors it's pointless me even thinking about listing them all. What will it take to make this work with the latest ImGui version in order to update ImGui.NET to 1.89.3?