Make time slider effective in viewer (Fixes #2928) (#2931)

This commit is contained in:
Sacha Lewin authored and GitHub committed 2024-02-19 14:42:38 -08:00
1 parent 45db2bcfab
commit 6c2bfad931
2 files changed
+6 -3

No files matched your search

+4 -1
View File
@@ -129,7 +129,10 @@ class RenderStateMachine(threading.Thread):
image_height, image_width = self._calculate_image_res(camera_state.aspect)
camera = get_camera(camera_state, image_height, image_width)
if self.viewer.include_time:
camera = get_camera(camera_state, image_height, image_width, self.viewer.control_panel.time)
else:
camera = get_camera(camera_state, image_height, image_width)
camera = camera.to(self.viewer.get_model().device)
assert isinstance(camera, Cameras)
assert camera is not None, "render called before viewer connected"
+2 -2
View File
@@ -42,7 +42,7 @@ class CameraState:
def get_camera(
camera_state: CameraState, image_height: int, image_width: Optional[Union[int, float]] = None
camera_state: CameraState, image_height: int, image_width: Optional[Union[int, float]] = None, time: float = 0.0
) -> Cameras:
"""Returns the camera intrinsics matrix and the camera to world homogeneous matrix.
@@ -74,7 +74,7 @@ def get_camera(
cy=pp_h,
camera_type=camera_state.camera_type,
camera_to_worlds=camera_state.c2w.to(torch.float32)[None, ...],
times=torch.tensor([0.0], dtype=torch.float32),
times=torch.tensor([time], dtype=torch.float32),
)
return camera