def _on_menu_open(self): dlg = gui.FileDialog(gui.FileDialog.OPEN, "Choose file to load", self.window.theme) dlg.add_filter( ".ply .stl .fbx .obj .off .gltf .glb", "Triangle mesh files (.ply, .stl, .fbx, .obj, .off, " ".gltf, .glb)") dlg.add_filter( ".xyz .xyzn .xyzrgb .ply .pcd .pts", "Point cloud files (.xyz, .xyzn, .xyzrgb, .ply, " ".pcd, .pts)") dlg.add_filter(".ply", "Polygon files (.ply)") dlg.add_filter(".stl", "Stereolithography files (.stl)") dlg.add_filter(".fbx", "Autodesk Filmbox files (.fbx)") dlg.add_filter(".obj", "Wavefront OBJ files (.obj)") dlg.add_filter(".off", "Object file format (.off)") dlg.add_filter(".gltf", "OpenGL transfer files (.gltf)") dlg.add_filter(".glb", "OpenGL binary transfer files (.glb)") dlg.add_filter(".xyz", "ASCII point cloud files (.xyz)") dlg.add_filter(".xyzn", "ASCII point cloud with normals (.xyzn)") dlg.add_filter(".xyzrgb", "ASCII point cloud files with colors (.xyzrgb)") dlg.add_filter(".pcd", "Point Cloud Data files (.pcd)") dlg.add_filter(".pts", "3D Points files (.pts)") dlg.add_filter("", "All files") # A file dialog MUST define on_cancel and on_done functions dlg.set_on_cancel(self._on_file_dialog_cancel) dlg.set_on_done(self._on_load_dialog_done) self.window.show_dialog(dlg)
def _on_menu_export(self): dlg = gui.FileDialog(gui.FileDialog.SAVE, "Choose file to save", self.window.theme) dlg.add_filter(".png", "PNG files (.png)") dlg.set_on_cancel(self._on_file_dialog_cancel) dlg.set_on_done(self._on_export_dialog_done) self.window.show_dialog(dlg)
def _on_filedlg_button(self): filedlg = gui.FileDialog(gui.FileDialog.OPEN, "Select file", self.window.theme) filedlg.add_filter(".obj .ply .stl", "Triangle mesh (.obj, .ply, .stl)") filedlg.add_filter("", "All files") filedlg.set_on_cancel(self._on_filedlg_cancel) filedlg.set_on_done(self._on_filedlg_done) self.window.show_dialog(filedlg)
def _on_menu_open(self): dlg = gui.FileDialog(gui.FileDialog.OPEN, "Choose file to load", self.window.theme) dlg.add_filter(".obj, .ply, .stl", "3D mesh") dlg.add_filter("*.*", "All files") # A file dialog MUST define on_cancel and on_done functions dlg.set_on_cancel(self._on_file_dialog_cancel) dlg.set_on_done(self._on_file_dialog_done) self.window.show_dialog(dlg)