isl-org / isl-org/Open3D

Add callbacks for mouse/key events in o3d.visualization.O3DVisualizer

Open
#4,286 0 comments 6 reactions 0 assignees View on GitHub
feature request interaction ui
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

Hello guys, hello @prewettg,

Thanks for open3d upfront. It is really great!

I am facing the issue that I am dealing with a certain amount of 3d applications and some of them providing different mouse bindings for rotating, panning, etc...
That drives me nuts. So I hoped to create my own mouse control and assign it to `o3d.visualization.O3DVisualizer().mouse_mode`.

Like:

```python3

class BlenderControls(o3d.visualization.gui.SceneWidget.Controls):

def __init__(self, *args, **kwargs) -> None:
print('args', args)
print('kwargs', kwargs)
super().__init__(*args, **kwargs)

def on_mouse(self, e):
print("[debug] mouse:", (e.x, e.y))
return gui.Widget.EventCallbackResult.IGNORED

vis = o3d.visualization.O3DVisualizer(title, window_width, window_height)
vis.mouse_mode = BlenderControls(0)
```

The code runs but after having a look in the C++ documentation it turns out that the class `Controls` is actually just an `enum open3d::gui::SceneWidget::Controls`.
So, I searched the issues and found that [issue #2610](https://github.com/isl-org/Open3D/issues/2610#issuecomment-818078046) might be related.

Maybe I didn't look right or something slipped through on my side. But I reckon for the time being there is not way of assigning your own mouse, keyboard controls to a `o3d.visualization.O3DVisualizer` class?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.