From 9066ed0135fb55d188bddf6c4dfecaabfc0963c1 Mon Sep 17 00:00:00 2001 From: cremebrule <84cremebrule@gmail.com> Date: Sun, 26 May 2024 00:27:19 -0700 Subject: [PATCH 1/2] fix render_product syncing when updating camera width / height --- omnigibson/sensors/vision_sensor.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/omnigibson/sensors/vision_sensor.py b/omnigibson/sensors/vision_sensor.py index de4e469eb..501002ce4 100644 --- a/omnigibson/sensors/vision_sensor.py +++ b/omnigibson/sensors/vision_sensor.py @@ -588,6 +588,18 @@ def image_height(self, height): """ width, _ = self._viewport.viewport_api.get_texture_resolution() self._viewport.viewport_api.set_texture_resolution((width, height)) + + # Also update render product and update all annotators + old_render_product = self._render_product + new_render_product = lazy.omni.replicator.core.create.render_product(self._prim_path, (width, height)) + # from IPython import embed; embed() + for annotator in self._annotators.values(): + annotator.detach([old_render_product.path]) + annotator.attach([new_render_product]) + + old_render_product.destroy() + self._render_product = new_render_product + # Requires 3 updates to propagate changes for i in range(3): render() @@ -610,6 +622,18 @@ def image_width(self, width): """ _, height = self._viewport.viewport_api.get_texture_resolution() self._viewport.viewport_api.set_texture_resolution((width, height)) + + # Also update render product and update all annotators + old_render_product = self._render_product + new_render_product = lazy.omni.replicator.core.create.render_product(self._prim_path, (width, height)) + # from IPython import embed; embed() + for annotator in self._annotators.values(): + annotator.detach([old_render_product.path]) + annotator.attach([new_render_product]) + + old_render_product.destroy() + self._render_product = new_render_product + # Requires 3 updates to propagate changes for i in range(3): render() From 9e98760300746cd81a4b381f9958b0606b123126 Mon Sep 17 00:00:00 2001 From: cremebrule <84cremebrule@gmail.com> Date: Sun, 26 May 2024 02:15:15 -0700 Subject: [PATCH 2/2] remove debug statements --- omnigibson/sensors/vision_sensor.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/omnigibson/sensors/vision_sensor.py b/omnigibson/sensors/vision_sensor.py index 501002ce4..3d9ea36de 100644 --- a/omnigibson/sensors/vision_sensor.py +++ b/omnigibson/sensors/vision_sensor.py @@ -592,7 +592,6 @@ def image_height(self, height): # Also update render product and update all annotators old_render_product = self._render_product new_render_product = lazy.omni.replicator.core.create.render_product(self._prim_path, (width, height)) - # from IPython import embed; embed() for annotator in self._annotators.values(): annotator.detach([old_render_product.path]) annotator.attach([new_render_product]) @@ -626,7 +625,6 @@ def image_width(self, width): # Also update render product and update all annotators old_render_product = self._render_product new_render_product = lazy.omni.replicator.core.create.render_product(self._prim_path, (width, height)) - # from IPython import embed; embed() for annotator in self._annotators.values(): annotator.detach([old_render_product.path]) annotator.attach([new_render_product])