diff --git a/nerfstudio/viewer_beta/viewer.py b/nerfstudio/viewer_beta/viewer.py index e577ca5c37..b01c35f4b5 100644 --- a/nerfstudio/viewer_beta/viewer.py +++ b/nerfstudio/viewer_beta/viewer.py @@ -259,15 +259,15 @@ def update_camera_poses(self): with torch.no_grad(): assert isinstance(camera_optimizer, CameraOptimizer) c2ws_delta = camera_optimizer(torch.tensor(idxs, device=camera_optimizer.device)).cpu().numpy() - for idx in idxs: + for i, key in enumerate(idxs): # both are numpy arrays - c2w_orig = self.original_c2w[idx] - c2w_delta = c2ws_delta[idx, ...] + c2w_orig = self.original_c2w[key] + c2w_delta = c2ws_delta[i, ...] c2w = c2w_orig @ np.concatenate((c2w_delta, np.array([[0, 0, 0, 1]])), axis=0) R = vtf.SO3.from_matrix(c2w[:3, :3]) # type: ignore R = R @ vtf.SO3.from_x_radians(np.pi) - self.camera_handles[idx].position = c2w[:3, 3] * VISER_NERFSTUDIO_SCALE_RATIO - self.camera_handles[idx].wxyz = R.wxyz + self.camera_handles[key].position = c2w[:3, 3] * VISER_NERFSTUDIO_SCALE_RATIO + self.camera_handles[key].wxyz = R.wxyz def _interrupt_render(self, _) -> None: """Interrupt current render.""" diff --git a/pyproject.toml b/pyproject.toml index 4c589f6808..b6d11c60c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -162,6 +162,7 @@ pythonVersion = "3.8" pythonPlatform = "Linux" [tool.ruff] +line-length = 120 select = [ "E", # pycodestyle errors. "F", # Pyflakes rules.