Skip to content

Commit 5be513e

Browse files
krahetsjb-ye
andauthored
Write camera path to output dir if saving to the data dir fails (#3476)
* Update render_panel.py * Update render_panel.py * Update render_panel.py * Update render_panel.py * isort fix * Update render_panel.py --------- Co-authored-by: J.Y. <[email protected]>
1 parent 7be0ed9 commit 5be513e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

nerfstudio/viewer/render_panel.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import viser.transforms as tf
3131
from scipy import interpolate
3232

33+
from nerfstudio.utils.rich_utils import CONSOLE
3334
from nerfstudio.viewer.control_panel import ControlPanel
3435

3536

@@ -1130,8 +1131,15 @@ def _(event: viser.GuiEvent) -> None:
11301131
}
11311132

11321133
# now write the json file
1133-
json_outfile = datapath / "camera_paths" / f"{render_name_text.value}.json"
1134-
json_outfile.parent.mkdir(parents=True, exist_ok=True)
1134+
try:
1135+
json_outfile = datapath / "camera_paths" / f"{render_name_text.value}.json"
1136+
json_outfile.parent.mkdir(parents=True, exist_ok=True)
1137+
except Exception:
1138+
CONSOLE.print(
1139+
"[bold yellow]Warning: Failed to write the camera path to the data directory. Saving to the output directory instead."
1140+
)
1141+
json_outfile = config_path.parent / "camera_paths" / f"{render_name_text.value}.json"
1142+
json_outfile.parent.mkdir(parents=True, exist_ok=True)
11351143
with open(json_outfile.absolute(), "w") as outfile:
11361144
json.dump(json_data, outfile)
11371145
# now show the command

0 commit comments

Comments
 (0)