diff --git a/nerfstudio/viewer/export_panel.py b/nerfstudio/viewer/export_panel.py index 9b79d8662..9e721ae1f 100644 --- a/nerfstudio/viewer/export_panel.py +++ b/nerfstudio/viewer/export_panel.py @@ -63,23 +63,6 @@ def get_crop_string(obb: OrientedBox, crop_viewport: bool) -> List[str]: scalestring = " ".join([f"{x:.10f}" for x in scale]) return [posstring, rpystring, scalestring] - -def show_notification( - export_complete: bool, - server: viser.ViserServer, - output_dir: str) -> None: - if export_complete: - server.clear_notification() - notif = server.add_notification( - title="Export complete!", - body="File saved under " + output_dir, - withCloseButton=True, - loading=False, - autoClose=5000, - ) - notif.show() - - def populate_point_cloud_tab( server: viser.ViserServer, control_panel: ControlPanel, @@ -117,14 +100,11 @@ def populate_point_cloud_tab( @export_button.on_click def _(event: viser.GuiEvent) -> None: assert event.client is not None - notif = server.add_notification( + notif = server.gui.add_notification( title="Exporting point cloud", body="File will be saved under " + str(output_dir.value), - withCloseButton=True, loading=True, - autoClose=False, ) - notif.show() if control_panel.crop_obb is not None and control_panel.crop_viewport: posstring, rpystring, scalestring = get_crop_string( @@ -147,10 +127,12 @@ def populate_point_cloud_tab( obb_scale=scalestring, ) export.main() - - show_notification(export_complete=export.complete, - server=server, - output_dir=str(output_dir.value)) + + if export.complete: + notif.update( + title="Export complete!", + body="File saved under " + str(output_dir.value), + ) else: server.add_gui_markdown( @@ -195,11 +177,8 @@ def populate_mesh_tab( notif = server.add_notification( title="Exporting poisson mesh", body="File will be saved under " + str(output_dir.value), - withCloseButton=True, loading=True, - autoClose=False, ) - notif.show() if control_panel.crop_obb is not None and control_panel.crop_viewport: posstring, rpystring, scalestring = get_crop_string( @@ -224,9 +203,11 @@ def populate_mesh_tab( ) export.main() - show_notification(export_complete=export.complete, - server=server, - output_dir=str(output_dir.value)) + if export.complete: + notif.update( + title="Export complete!", + body="File saved under " + str(output_dir.value), + ) else: server.add_gui_markdown( @@ -255,9 +236,7 @@ def populate_splat_tab( notif = server.add_notification( title="Exporting gaussian splat", body="File will be saved under " + str(output_dir.value), - withCloseButton=True, loading=True, - autoClose=False, ) notif.show() @@ -279,9 +258,11 @@ def populate_splat_tab( ) export.main() - show_notification(export_complete=export.complete, - server=server, - output_dir=str(output_dir.value)) + if export.complete: + notif.update( + title="Export complete!", + body="File saved under " + str(output_dir.value), + ) else: server.add_gui_markdown( diff --git a/nerfstudio/viewer/render_panel.py b/nerfstudio/viewer/render_panel.py index 7579afaff..4cccc7622 100644 --- a/nerfstudio/viewer/render_panel.py +++ b/nerfstudio/viewer/render_panel.py @@ -1123,14 +1123,11 @@ def populate_render_tab( def _(event: viser.GuiEvent) -> None: assert event.client is not None render_path = f"renders/{datapath.name}/{render_name_text.value}.mp4" - notif = server.add_notification( + notif = server.gui.add_notification( title="Rendering trajectory", body="Saving rendered video as " + render_path, - withCloseButton=True, loading=True, - autoClose=False, ) - notif.show() num_frames = int(framerate_number.value * duration_number.value) json_data = {} @@ -1245,34 +1242,10 @@ def populate_render_tab( render.main() if render.complete: - server.clear_notification() - notif = server.add_notification( - title="Render complete!", - body="Video saved as " + render_path, - withCloseButton=True, - loading=False, - autoClose=5000, - ) - notif.show() - - with server.gui.add_modal("Render download") as modal: - server.gui.add_markdown("Download the rendered video to your local machine:") - - download_button = server.gui.add_button("Download") - - @downlaod_button.on_click - def _(_) -> None: - import imageio.v3 as iio - - server.send_file_download( - f"{render_name_text.value}.mp4", iio.imwrite("", images, extension=".gif") - ) - - close_button = server.gui.add_button("Close") - - @close_button.on_click - def _(_) -> None: - modal.close() + notif.update( + title="Render complete!", + body="Video saved as " + render_path, + ) if control_panel is not None: camera_path = CameraPath(server, duration_number, control_panel._time_enabled)