Add callbacks for mouse/key events in gui.SceneWidget on the Python side
C++ can subclass gui::SceneWidget to override mouse and keyboard events; Python needs to have access to this, too. Having mouse and key events would enable things like:
- changing the key navigation if you have an international keyboard (#1893)
- custom editing of selected points (#1965)
- synchronize cameras with multiple SceneWidgets (#999, see last comments)
- showing the current mouse coordinate (there was an issue for this, but I can't find it)
Hi, @prewettg thanks for this contribution.
Can we now use set_on_mouse or set_on_key for a o3d.visualization.O3DVisualizer in python? That would be very useful for people who want a quick shortcut key binding but do not want to completely re-write other widgets.
@heiwang1997 Our original thinking was that actions should take care of this case: you can add a callback function and you get a button at the bottom of the window and a menu item. The menu item should have a shortcut, which seems like it would solve your problem, but unfortunately the Dear ImGui library we are using for the UI doesn't support shortcuts at the moment (except on macOS because we use the native calls). If that would not be sufficient for your use case, please open a new issue, describe it, and assign to me.
I would be really interested in this as well. I created a new issue for this, but was not able to assign it to @prewettg in it.