mitsuba-renderer / nanogui

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

Cannot set Slider range using pypi version of NanoGUI #164

Closed dtourolle closed 1 month ago

dtourolle commented 2 months ago

First thanks for all the great work on this project. It's a really powerful tool for cross platform GUIs, simple to use, performant and bloat free.

If I install nanoGUI from pypi and edit the example1.py to include this at line 215:

slider.set_range((-0.5,100.3))

Then I get the following error:

TypeError: set_range(): incompatible function arguments. The following argument types are supported:
    1. set_range(self, arg: std::pair<float, float>, /) -> None

I checked the unit tests of nanobind (I know not this project, but that is the binding lib) and they/you explicitly test converting tuples to and from std::pairs. So I believe this is a bug.

Right now I am suspecting that the pypi version of nanogui is the issue and will build from the master branch to test again.

dtourolle commented 2 months ago

I can confirm that the issue is still present in the master branch. I also have a fix. The issue is that in the python.h file where the stl bindings are included there should also be:

#include <nanobind/stl/pair.h>

I can make a merge request if you want, but for one line I can understand if it's over kill.