Skip to content

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

@masmu-3di

Description

@masmu-3di

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:

    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 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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions