Open davidlatwe opened 1 month ago
Hello,
Thanks for the PR! Since it was based on an older version of litgen, I tried nanobind with the newer litgen in the branch nanobind_p.
It looks promising, since all of the included libraries do now compile with nanobind, and running seems to be fine. This is still work in progress. Bindings do not work under windows at the moment: the link takes forever and never ends.
If you have time could you try it on your side?
Hey @pthom , yeah I have tried building bindings on Windows and yes, the process hangs for some unknown reason. ( I kind of rememeber this happened before, but cannot recall why exactly... 😟 )
I will keep looking into that, see if I can find anything and let you know.
Hello David,
under Windows it can work, but you have to wait for 3h50!
see https://github.com/pthom/imgui_bundle/actions/runs/11877309198
based on my experimentations, this time is spent in the optimization process of msvc
A discussion about the slow compil on windows:
Hello @davidlatwe
I just released v1.6.0, which now includes bindings produced with nanobind. Could you give it a try?
Hey @pthom , glad to test it out. And really great investigation work in https://github.com/wjakob/nanobind/discussions/791!
I played with example code I found in README, and the code from interactive menu. I also installed previous release 1.5.2
in a separate venv for comparison.
✅ The "Complex layouts with docking windows" example works.
❔ Example "Custom 3D Background" did not. Parameter GUI is shown, but shader was not rendered. Same with bundle 1.5.2
, maybe the example shader is too old? But Emscripten does work though.
❌ Example "Test & Automation with ImGui Test Engine" could not launch. Looks like a nanobind problem. Tested with bundle 1.5.2
and it works.
Traceback (most recent call last):
File "C:\pyvenv\imgui-bundle\test.py", line 247, in <module>
main()
File "C:\pyvenv\imgui-bundle\test.py", line 175, in main
hello_imgui.run(runner_params)
File "C:\pyvenv\imgui-bundle\test.py", line 224, in show_test_engine_windows
imgui.test_engine.show_test_engine_windows(
TypeError: show_test_engine_windows(): incompatible function arguments. The following argument types are supported:
1. show_test_engine_windows(engine: imgui_bundle._imgui_bundle.imgui.test_engine.TestEngine, p_open: bool) -> bool
Invoked with types: imgui_bundle._imgui_bundle.imgui.test_engine.TestEngine, NoneType
✅ Example "Display & analyze images with ImmVision" works. At first I got following error, but looks like it was simply because the demo code was outdated a little. Adding immvision.use_bgr_color_order()
call at the bottom fixed it.
Error in ImmVision
==================
You must set the image color order before displaying images. At the start of your program, call:
ImmVision::UseRgbColorOrder() or ImmVision::UseBgrColorOrder() (C++)
or
immvision.use_rgb_color_order() or immvision.use_bgr_color_order() (Python)
This is a required setup step. (Breaking change - October 2024)
ImmVision: Panic!
✅ Example "Additional Widgets" works.
✅ This is a fun one. NanoVG works.
⚠️ Example "ImGuizmo" works.
But... See the transformation UI, the rotation value seems off, it should be 0, 0, 0
. And the scale row shows different default value in every launch. Looks like a rounding error.
This does not happen in bundle 1.5.2
, and the value looks correct.
Had a quick look, the bad scale value is coming from this line, gizmo.decompose_matrix_to_components(objectMatrix)
.
So that might have something to do with numpy.array <=> MatrixXX
conversion here?
Hi @davidlatwe
Many many thanks for taking the time of an extensive test!!!
Example "Custom 3D Background" did not render. Parameter GUI is shown, but shader was not rendered
Yes, this is because the shader code was too old. It was updated. This should work now (see 2d0ebef8a99c1183aa90c9e05239cc9e951583cb)
Example "Display & analyze images with ImmVision" works.
Oops, it's just the documentation which was not updated :-(
Example "Test & Automation with ImGui Test Engine"
Same issue, the documentation was out of date
Example "ImGuizmo" works. But... See the transformation UI, the rotation value seems off, ...
Thanks for noting this! I had to review the API. See 28152833de051b372b56bfbe42876bdb83497788 and a455607381eeaa65e05cfa7eac39f68e516b1ec4
New wheels will be available at https://github.com/pthom/imgui_bundle/actions/runs/11995970675
Cheers!
Hi @pthom 👋🏼
This pull request demonstrates what changes were required for generating ImGui binding code with nanobind.
Some of the options were tweaked to fit our preferences so this might not able to be merged as is.
In these 2 latest commits, we were able to generate binding from original ImGui source with the help of our
litgen
fork:Please also see this
litgen
pull request for more details: https://github.com/pthom/litgen/pull/20