mitsuba-renderer / nanogui

Minimalistic C++/Python GUI library for OpenGL, GLES2/3, Metal, and WebAssembly/WebGL
Other
1.56k stars 196 forks source link

Update to latest nanobind and python 3.12 support #167

Open dtourolle opened 4 months ago

dtourolle commented 4 months ago

This is a very small change that updates the nanobind submodule to the current master (probably a bad idea, maybe a fixed version would be preferred?) and then changes some code around the Flags enum for buttons to get it working.

Why were these changes needed? The Flags enum was treated as an integer by some functions. It seems with the latests nanobind there has been some changes to the handling of enums, which meant the casting of a enum in python to an int for the bound function does not work. This is possible related to this.

The solution I found was to change the functions to accept enums and perform static_casts when int->enum is needed.