mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
disable button feature on exports and clean export panel
This commit is contained in:
1 parent
b5e9f8c533
commit
fef8461f44
1 file changed
+75
-20
@@ -115,9 +115,9 @@ def populate_point_cloud_tab(
|
|||||||
hint="Normal map source.",
|
hint="Normal map source.",
|
||||||
)
|
)
|
||||||
|
|
||||||
export_button = server.gui.add_button("Export", icon=viser.Icon.FILE_EXPORT)
|
|
||||||
download_button = server.gui.add_button("Download Point Cloud", icon=viser.Icon.DOWNLOAD)
|
|
||||||
output_dir = server.gui.add_text("Output Directory", initial_value="exports/pcd/")
|
output_dir = server.gui.add_text("Output Directory", initial_value="exports/pcd/")
|
||||||
|
export_button = server.gui.add_button("Export", icon=viser.Icon.FILE_EXPORT)
|
||||||
|
download_button = server.gui.add_button("Download Point Cloud", icon=viser.Icon.DOWNLOAD, disabled=True)
|
||||||
generate_command = server.gui.add_button("Generate Command", icon=viser.Icon.TERMINAL_2)
|
generate_command = server.gui.add_button("Generate Command", icon=viser.Icon.TERMINAL_2)
|
||||||
|
|
||||||
@export_button.on_click
|
@export_button.on_click
|
||||||
@@ -129,6 +129,7 @@ def populate_point_cloud_tab(
|
|||||||
title="Exporting point cloud",
|
title="Exporting point cloud",
|
||||||
body="File will be saved under " + str(output_dir.value),
|
body="File will be saved under " + str(output_dir.value),
|
||||||
loading=True,
|
loading=True,
|
||||||
|
with_close_button=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
if control_panel.crop_obb is not None and control_panel.crop_viewport:
|
if control_panel.crop_obb is not None and control_panel.crop_viewport:
|
||||||
@@ -154,10 +155,12 @@ def populate_point_cloud_tab(
|
|||||||
export.main()
|
export.main()
|
||||||
|
|
||||||
if export.complete:
|
if export.complete:
|
||||||
notif.update(
|
notif.title = "Export complete!"
|
||||||
title="Export complete!",
|
notif.body = "File saved under " + str(output_dir.value)
|
||||||
body="File saved under " + str(output_dir.value),
|
notif.loading = False
|
||||||
)
|
notif.with_close_button = True
|
||||||
|
|
||||||
|
download_button.disabled = False
|
||||||
|
|
||||||
@download_button.on_click
|
@download_button.on_click
|
||||||
def _(event: viser.GuiEvent) -> None:
|
def _(event: viser.GuiEvent) -> None:
|
||||||
@@ -171,6 +174,23 @@ def populate_point_cloud_tab(
|
|||||||
"point_cloud.ply", ply_bytes
|
"point_cloud.ply", ply_bytes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@generate_command.on_click
|
||||||
|
def _(event: viser.GuiEvent) -> None:
|
||||||
|
assert event.client is not None
|
||||||
|
command = " ".join(
|
||||||
|
[
|
||||||
|
"ns-export pointcloud",
|
||||||
|
f"--load-config {config_path}",
|
||||||
|
f"--output-dir {output_dir.value}",
|
||||||
|
f"--num-points {num_points.value}",
|
||||||
|
f"--remove-outliers {remove_outliers.value}",
|
||||||
|
f"--normal-method {normals.value}",
|
||||||
|
f"--save-world-frame {world_frame.value}",
|
||||||
|
get_crop_string(control_panel.crop_obb, control_panel.crop_viewport),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
show_command_modal(event.client, "point cloud", command)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
server.gui.add_markdown("<small>Point cloud export is not currently supported with Gaussian Splatting</small>")
|
server.gui.add_markdown("<small>Point cloud export is not currently supported with Gaussian Splatting</small>")
|
||||||
|
|
||||||
@@ -194,12 +214,12 @@ def populate_mesh_tab(
|
|||||||
)
|
)
|
||||||
num_faces = server.gui.add_number("# Faces", initial_value=50_000, min=1)
|
num_faces = server.gui.add_number("# Faces", initial_value=50_000, min=1)
|
||||||
texture_resolution = server.gui.add_number("Texture Resolution", min=8, initial_value=2048)
|
texture_resolution = server.gui.add_number("Texture Resolution", min=8, initial_value=2048)
|
||||||
output_dir = server.gui.add_text("Output Directory", initial_value="exports/mesh/")
|
|
||||||
num_points = server.gui.add_number("# Points", initial_value=1_000_000, min=1, max=None, step=1)
|
num_points = server.gui.add_number("# Points", initial_value=1_000_000, min=1, max=None, step=1)
|
||||||
remove_outliers = server.gui.add_checkbox("Remove outliers", True)
|
remove_outliers = server.gui.add_checkbox("Remove outliers", True)
|
||||||
|
|
||||||
|
output_dir = server.gui.add_text("Output Directory", initial_value="exports/mesh/")
|
||||||
export_button = server.gui.add_button("Export", icon=viser.Icon.FILE_EXPORT)
|
export_button = server.gui.add_button("Export", icon=viser.Icon.FILE_EXPORT)
|
||||||
download_button = server.gui.add_button("Download Mesh", icon=viser.Icon.DOWNLOAD)
|
download_button = server.gui.add_button("Download Mesh", icon=viser.Icon.DOWNLOAD, disabled=True)
|
||||||
generate_command = server.gui.add_button("Generate Command", icon=viser.Icon.TERMINAL_2)
|
generate_command = server.gui.add_button("Generate Command", icon=viser.Icon.TERMINAL_2)
|
||||||
|
|
||||||
@export_button.on_click
|
@export_button.on_click
|
||||||
@@ -211,6 +231,7 @@ def populate_mesh_tab(
|
|||||||
title="Exporting poisson mesh",
|
title="Exporting poisson mesh",
|
||||||
body="File will be saved under " + str(output_dir.value),
|
body="File will be saved under " + str(output_dir.value),
|
||||||
loading=True,
|
loading=True,
|
||||||
|
with_close_button=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
if control_panel.crop_obb is not None and control_panel.crop_viewport:
|
if control_panel.crop_obb is not None and control_panel.crop_viewport:
|
||||||
@@ -237,10 +258,12 @@ def populate_mesh_tab(
|
|||||||
export.main()
|
export.main()
|
||||||
|
|
||||||
if export.complete:
|
if export.complete:
|
||||||
notif.update(
|
notif.title = "Export complete!"
|
||||||
title="Export complete!",
|
notif.body = "File saved under " + str(output_dir.value)
|
||||||
body="File saved under " + str(output_dir.value),
|
notif.loading = False
|
||||||
)
|
notif.with_close_button = True
|
||||||
|
|
||||||
|
download_button.disabled = False
|
||||||
|
|
||||||
@download_button.on_click
|
@download_button.on_click
|
||||||
def _(event: viser.GuiEvent) -> None:
|
def _(event: viser.GuiEvent) -> None:
|
||||||
@@ -254,6 +277,24 @@ def populate_mesh_tab(
|
|||||||
"poisson_mesh.ply", ply_bytes
|
"poisson_mesh.ply", ply_bytes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@generate_command.on_click
|
||||||
|
def _(event: viser.GuiEvent) -> None:
|
||||||
|
assert event.client is not None
|
||||||
|
command = " ".join(
|
||||||
|
[
|
||||||
|
"ns-export poisson",
|
||||||
|
f"--load-config {config_path}",
|
||||||
|
f"--output-dir {output_dir.value}",
|
||||||
|
f"--target-num-faces {num_faces.value}",
|
||||||
|
f"--num-pixels-per-side {texture_resolution.value}",
|
||||||
|
f"--num-points {num_points.value}",
|
||||||
|
f"--remove-outliers {remove_outliers.value}",
|
||||||
|
f"--normal-method {normals.value}",
|
||||||
|
get_crop_string(control_panel.crop_obb, control_panel.crop_viewport),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
show_command_modal(event.client, "mesh", command)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
server.gui.add_markdown("<small>Mesh export is not currently supported with Gaussian Splatting</small>")
|
server.gui.add_markdown("<small>Mesh export is not currently supported with Gaussian Splatting</small>")
|
||||||
@@ -267,11 +308,9 @@ def populate_splat_tab(
|
|||||||
) -> None:
|
) -> None:
|
||||||
if viewing_gsplat:
|
if viewing_gsplat:
|
||||||
server.gui.add_markdown("<small>Generate ply export of Gaussian Splat</small>")
|
server.gui.add_markdown("<small>Generate ply export of Gaussian Splat</small>")
|
||||||
|
|
||||||
export_button = server.gui.add_button("Export", icon=viser.Icon.FILE_EXPORT)
|
|
||||||
download_button = server.gui.add_button("Download Splat", icon=viser.Icon.DOWNLOAD)
|
|
||||||
|
|
||||||
output_dir = server.gui.add_text("Output Directory", initial_value="exports/splat/")
|
output_dir = server.gui.add_text("Output Directory", initial_value="exports/splat/")
|
||||||
|
export_button = server.gui.add_button("Export", icon=viser.Icon.FILE_EXPORT)
|
||||||
|
download_button = server.gui.add_button("Download Splat", icon=viser.Icon.DOWNLOAD, disabled=True)
|
||||||
generate_command = server.gui.add_button("Generate Command", icon=viser.Icon.TERMINAL_2)
|
generate_command = server.gui.add_button("Generate Command", icon=viser.Icon.TERMINAL_2)
|
||||||
|
|
||||||
@export_button.on_click
|
@export_button.on_click
|
||||||
@@ -283,6 +322,7 @@ def populate_splat_tab(
|
|||||||
title="Exporting gaussian splat",
|
title="Exporting gaussian splat",
|
||||||
body="File will be saved under " + str(output_dir.value),
|
body="File will be saved under " + str(output_dir.value),
|
||||||
loading=True,
|
loading=True,
|
||||||
|
with_close_button=False,
|
||||||
)
|
)
|
||||||
notif.show()
|
notif.show()
|
||||||
|
|
||||||
@@ -305,10 +345,12 @@ def populate_splat_tab(
|
|||||||
export.main()
|
export.main()
|
||||||
|
|
||||||
if export.complete:
|
if export.complete:
|
||||||
notif.update(
|
notif.title = "Export complete!"
|
||||||
title="Export complete!",
|
notif.body = "File saved under " + str(output_dir.value)
|
||||||
body="File saved under " + str(output_dir.value),
|
notif.loading = False
|
||||||
)
|
notif.with_close_button = True
|
||||||
|
|
||||||
|
download_button.disabled = False
|
||||||
|
|
||||||
@download_button.on_click
|
@download_button.on_click
|
||||||
def _(event: viser.GuiEvent) -> None:
|
def _(event: viser.GuiEvent) -> None:
|
||||||
@@ -322,5 +364,18 @@ def populate_splat_tab(
|
|||||||
"splat.ply", ply_bytes
|
"splat.ply", ply_bytes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@generate_command.on_click
|
||||||
|
def _(event: viser.GuiEvent) -> None:
|
||||||
|
assert event.client is not None
|
||||||
|
command = " ".join(
|
||||||
|
[
|
||||||
|
"ns-export gaussian-splat",
|
||||||
|
f"--load-config {config_path}",
|
||||||
|
f"--output-dir {output_directory.value}",
|
||||||
|
get_crop_string(control_panel.crop_obb, control_panel.crop_viewport),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
show_command_modal(event.client, "splat", command)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
server.gui.add_markdown("<small>Splat export is only supported with Gaussian Splatting methods</small>")
|
server.gui.add_markdown("<small>Splat export is only supported with Gaussian Splatting methods</small>")
|
||||||
Reference in new issue
Block a user