4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 02:24:38 +08:00

Fix crash on camera delete (#1094)

This commit is contained in:
Matthew Tancik 2022-12-05 17:35:12 -08:00 committed by GitHub
parent 6896028fc5
commit 006703bb64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -612,6 +612,11 @@ export default function CameraPanel(props) {
sceneTree.delete(['Camera Path', 'Cameras']); // delete old cameras, which is important
if (cameras.length < 1) {
dispatch({
type: 'write',
path: 'renderingState/camera_choice',
data: 'Main Camera',
});
camera_render_helper.set_visibility(false);
} else {
camera_render_helper.set_visibility(true);
@ -625,7 +630,7 @@ export default function CameraPanel(props) {
labelDiv.className = 'label';
labelDiv.textContent = camera.properties.get('NAME');
labelDiv.style.color = 'black';
labelDiv.style.backgroundColor = "rgba(255, 255, 255, 0.61)";
labelDiv.style.backgroundColor = 'rgba(255, 255, 255, 0.61)';
labelDiv.style.backdropFilter = 'blur(5px)';
labelDiv.style.padding = '6px';
labelDiv.style.borderRadius = '6px';

View File

@ -54,6 +54,9 @@ def three_js_perspective_camera_focal_length(fov: float, image_height: int):
fov: the field of view of the camera in degrees.
image_height: the height of the image in pixels.
"""
if fov is None:
print("Warning: fov is None, using default value")
return 50
pp_h = image_height / 2.0
focal_length = pp_h / np.tan(fov * (np.pi / 180.0) / 2.0)
return focal_length