Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,22 @@ def compute(db: Any) -> bool:
db.log_error(f"Error attaching hydra texture to render product {render_product_path}: {e}")
db.outputs.execOut = omni.graph.core.ExecutionAttributeState.DISABLED
return False

render_prod_prim = UsdRender.Product(stage.GetPrimAtPath(render_product_path))
if not render_prod_prim:
db.log_error(f'Invalid renderProduct "{render_product_path}"')
return False

requested_resolution = (db.inputs.width, db.inputs.height)
if tuple(render_prod_prim.GetResolutionAttr().Get()) != requested_resolution:
render_prod_prim.GetResolutionAttr().Set(Gf.Vec2i(*requested_resolution))
requested_camera = db.inputs.cameraPrim[0].GetString()
if list(render_prod_prim.GetCameraRel().GetTargets()) != [requested_camera]:
render_prod_prim.GetCameraRel().SetTargets([requested_camera])

state.render_product_path = render_product_path
state.resolution = requested_resolution
state.camera_path = requested_camera
db.node.get_attribute("inputs:renderProductPrim").set([render_product_path])
db.outputs.renderProductPath = render_product_path
db.outputs.execOut = omni.graph.core.ExecutionAttributeState.ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,17 @@ async def test_create_render_product(self) -> None:
("createRP1.inputs:cameraPrim", "/OmniverseKit_Persp"),
("createRP2.inputs:cameraPrim", "/OmniverseKit_Persp"),
("createRP2.inputs:enabled", False),
("createRP3.inputs:cameraPrim", "/OmniverseKit_Persp"),
("createRP3.inputs:cameraPrim", "/OmniverseKit_Top"),
("createRP3.inputs:renderProductPrim", [rp_3.path]),
],
},
)
self._stage = stage_utils.get_current_stage()
rp_3_product = UsdRender.Product(self._stage.GetPrimAtPath(rp_3.path))
self._timeline.play()
await omni.kit.app.get_app().next_update_async()
self.assertEqual(rp_3_product.GetResolutionAttr().Get(), (1280, 720))
self.assertEqual(rp_3_product.GetCameraRel().GetTargets()[0], "/OmniverseKit_Top")
await omni.kit.app.get_app().next_update_async()
await omni.kit.app.get_app().next_update_async()
rp_prefix = carb.settings.get_settings().get_as_string("/exts/omni.kit.hydra_texture/renderProduct/path/prefix")
Expand Down