Merge pull request #735 from StanfordVL/fix/render_product
fix render_product syncing when updating camera width / height
This commit is contained in:
commit
4c62f2e37d
|
@ -588,6 +588,17 @@ class VisionSensor(BaseSensor):
|
|||
"""
|
||||
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))
|
||||
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 +621,17 @@ class VisionSensor(BaseSensor):
|
|||
"""
|
||||
_, 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))
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue