Open3D
Open3D copied to clipboard
Request to add `set_on_key` for open3d.visualization.O3DVisualizer in Python
Checklist
- [x] I have searched for similar issues.
- [x] For Python issues, I have tested with the latest development wheel.
- [x] I have checked the release documentation and the latest documentation (for
mainbranch).
Proposed new feature or change
open3d.visualization.O3DVisualizer is an amazing out-of-box class as it provides many built-in features, however, there's no option for developers to add custom keyboard key handling to it. It is, therefore, requested that set_on_key should be exposed. I believe it is simple and clutter free to include this feature as open3d.visualization.O3DVisualizer inherits from open3d.visualization.gui.Window that has SetOnKeyEvent, so adding something like following to cpp/pybind/visualization/o3dvisualizer.cpp under pybind_o3dvisualizer_definitions should work just fine:
.def("set_on_key", &O3DVisualizer::SetOnKeyEvent,
"Sets a callback that will be called when a key is pressed. "
"The callback will be given the key event and should return "
"True if the event was handled, or False if it was not.",
"callback"_a);
References
No response
Additional information
I previously only used pip package of Open3D, so please let me know if this solution is not ideal or against design principles of Open3D.
If you create a PR I think it would be faster to get implemented/reviewed/merged. Seems like a small but useful change.