-
Notifications
You must be signed in to change notification settings - Fork 23
Add imgui generated bindings #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
This is awesome!! Thanks as always for the contribution! Sorry for not saying anything sooner, I went down a rabbit hole of checking out the pre-existing community ImGui bindings generators. Mainly (https://github.com/cimgui/cimgui/tree/docking_inter/generator/output and https://pthom.github.io/litgen/litgen_book/00_00_intro.html#). However, I don't think either makes sense out of the box for our needs. The cimgui C-interface is a bit too much work to bind to, and the litgen is a little to new for me to bet on it, plus its naming schemes are different which would break all existing code. Anyway, onto this contribution. Generally I think it looks very reasonable. I certainly can't say I checked everything, but the functions and generator setups I spot-checked seem reasonable. My high-level question is what work would be necessary to maintain these bindings in the future? (Especially in a hypothetical situation if you were to sadly stop contributing). Where does Do you anticipate any backwards compatibility-breaks with these changes? (I think small breaks are fine for the imgui bindings, especially if we are moving to a standard that should not break in the future) |
|
@nmwsharp Shortly after I made this PR, I found out about https://github.com/dearimgui/dear_bindings . This will be a maintainable source for generating the imgui bindings I'm pretty sure. I haven't looked in to how to use it, but I think making use of it instead of the JSON data I generated would be best. |
|
I looked into that one as well (along with the cimgui & litgen projects linked above). I'm a little wary of depending on an external project that could be abandoned, but that may be the lesser-evil compared to doing it ourselves. Are you thinking to write a Python generator from their .json file? That could definitely work although it's hard to judge just how much work that would be. I like that the Very interested in your thoughts here :) I'd love to set up an automated solution but am wary about long-term maintainability. |
|
Oh actually I lied, it looks like the |
|
It was really a trivial amount of work to generate the JSON file in this PR. Although the frontier LLM models change over time, one way to help would be to include a prompt with instructions for how to generate the JSON file, or at least get most of the data out so that it could be added to the JSON file. ImGui isn't changing that fast. A prompt could easily take as input the JSON file and a query against ImGui.h that asks for an enums or functions not found in the JSON. That would be a quick way to see what needs to be updated. |
|
Any updated thoughts on this? I'm looking to release a new version soon and it would be a good time to update these bindings. I spent a little while looking into manual bindings generators (you can see some experiments in this branch). Main takeaway is that will require a fair amount of work to massage C-style bindings back into Pythonic or even C++-style pybind11-friendly form. I'm sure it's possible, but it was goin to take more time than I have. I'm still a little wary about maintainability/editability of this setup by folks other than you, but as you say ImGui is not rapidly-changing or anything :) I'd be okay with merging this setup (or something like it) if you think it's good-to-go. |
|
By the way I'm also looking to include bindings ImPlot. I suppose it should be easy to generate bindings for that too with a similar setup? |
type_casterThere are still some functions listed as
#TODOfor the bindings, but this covers 95% of them.Before I continue further, looking for feedback on this idea.