Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write camera path to output dir if saving to the data dir fails #3476

Merged
merged 10 commits into from
Jan 8, 2025
12 changes: 10 additions & 2 deletions nerfstudio/viewer/render_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import viser.transforms as tf
from scipy import interpolate

from nerfstudio.utils.rich_utils import CONSOLE
from nerfstudio.viewer.control_panel import ControlPanel


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

# now write the json file
json_outfile = datapath / "camera_paths" / f"{render_name_text.value}.json"
json_outfile.parent.mkdir(parents=True, exist_ok=True)
try:
json_outfile = datapath / "camera_paths" / f"{render_name_text.value}.json"
json_outfile.parent.mkdir(parents=True, exist_ok=True)
except Exception:
CONSOLE.print(
"[bold yellow]Warning: Failed to write the camera path to the data directory. Saving to the output directory instead."
)
json_outfile = config_path.parent / "camera_paths" / f"{render_name_text.value}.json"
json_outfile.parent.mkdir(parents=True, exist_ok=True)
with open(json_outfile.absolute(), "w") as outfile:
json.dump(json_data, outfile)
# now show the command
Expand Down
Loading