Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

Request to add `set_on_key` for open3d.visualization.O3DVisualizer in Python

Open m-shahbaz-kharal opened this issue 7 months ago • 1 comments

Checklist

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.

m-shahbaz-kharal avatar Apr 17 '25 02:04 m-shahbaz-kharal

If you create a PR I think it would be faster to get implemented/reviewed/merged. Seems like a small but useful change.

timohl avatar Apr 17 '25 08:04 timohl