Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

App interactive with Visualizer

Open bladesaber opened this issue 3 years ago • 0 comments
trafficstars

Checklist

Describe the issue

Hi, I need to crop the point cloud in the App. Since VisualizerWithEditing working well, so I add a button in the App to create a VisualizerWithEditing. But after destroy_window, the whole app destroy with log: [Open3D WARNING] GLFW Error: The GLFW library is not initialized Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Do you have an idea or is this simply not possible yet?

thank for your work and looking forward to your response

Best regards

Steps to reproduce the bug

import open3d as o3d
import open3d.visualization.gui as gui
import open3d.visualization.rendering as rendering
import numpy as np

class CustomWindow(object):
    def __init__(self):
        self.window = gui.Application.instance.create_window("Reconstruct", 960, 720)

        self.widget3d = gui.SceneWidget()
        self.widget3d.scene = rendering.Open3DScene(self.window.renderer)
        self.widget3d.scene.set_background([1, 1, 1, 1])

        geometry_crop_btn = gui.Button("Crop")
        geometry_crop_btn.set_on_clicked(self.geometry_crop_on_click)

        em = self.window.theme.font_size
        self.spacing = int(np.round(0.5 * em))
        vspacing = int(np.round(0.5 * em))
        self.margins = gui.Margins(vspacing)
        self.panel = gui.Vert(self.spacing, self.margins)

        self.panel.add_child(geometry_crop_btn)

        self.window.add_child(self.panel)
        self.window.add_child(self.widget3d)

        self.window.set_on_layout(self._on_layout)

    def geometry_crop_on_click(self):
        vis = o3d.visualization.VisualizerWithEditing()
        vis.create_window(width=960, height=720)
        vis.run()
        vis.destroy_window()

    def _on_layout(self, layout_context):
        em = layout_context.theme.font_size

        panel_width = 15 * em
        rect = self.window.content_rect

        self.widget3d.frame = gui.Rect(rect.x, rect.y, rect.get_right() - panel_width, rect.height)
        self.panel.frame = gui.Rect(self.widget3d.frame.get_right(), rect.y, panel_width, rect.height)

def main():
    app = gui.Application.instance
    app.initialize()

    window = CustomWindow()

    app.run()

if __name__ == '__main__':
    main()

Error message

FEngine (64 bits) created at 0x7fce0001b010 (threading is enabled) FEngine resolved backend: OpenGL [Open3D WARNING] GLFW Error: The GLFW library is not initialized [Open3D WARNING] GLFW Error: The GLFW library is not initialized

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Expected behavior

After destroy the VisualizerWithEditing, the app should be alive.

Open3D, Python and System information

- Operating system: Ubuntu 18.04
- Python version: Python 3.9.12
- Open3D version: 0.15.2+e705e648
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: build from source
- Compiler version (if built from source): gcc 7.5 / clang 7.0

Additional information

No response

bladesaber avatar Aug 08 '22 05:08 bladesaber