4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 10:34:29 +08:00

small fix silencing exception on camera change (#112)

This commit is contained in:
evonneng 2022-07-11 16:07:52 -07:00 committed by GitHub
parent 898d9384a5
commit efa40993e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,19 +141,11 @@ class VisualizerState:
self.check_interrupt_vis = True
time.sleep(0.001)
def _interruptable_get_outputs_for_camera_ray_bundle(self, graph: Graph, camera_ray_bundle: RayBundle) -> None:
"""wrapper around graph function, terminating when interrupting"""
try:
outputs = graph.get_outputs_for_camera_ray_bundle(camera_ray_bundle)
return outputs
except CameraChangeException:
return None
@torch.no_grad()
def _async_get_visualizer_outputs(self, graph: Graph, camera_ray_bundle: RayBundle) -> None:
"""async getter function for visualizer without returning"""
with SetTrace(self._check_interrupt):
self._interruptable_get_outputs_for_camera_ray_bundle(graph, camera_ray_bundle)
interruptable_get_outputs_for_camera_ray_bundle(graph, camera_ray_bundle)
self.check_done_render = True
self.check_interrupt_vis = False
@ -207,6 +199,18 @@ class VisualizerState:
self.vis["/Cameras/Main Camera"].set_image(image)
def interruptable_get_outputs_for_camera_ray_bundle(graph: Graph, camera_ray_bundle: RayBundle) -> None:
"""wrapper around graph function, terminating when interrupting"""
try:
outputs = graph.get_outputs_for_camera_ray_bundle(camera_ray_bundle)
return outputs
except CameraChangeException:
return None
finally:
# TODO(): find out better way to do interrupts for camera change
return None # pylint: disable=lost-exception
def get_default_vis() -> Viewer:
"""Returns the default Visualizer."""
zmq_url = "tcp://0.0.0.0:6000"