Skip to content

Commit

Permalink
fix: detect ROP USD Render output directories
Browse files Browse the repository at this point in the history
Signed-off-by: lucaseck <[email protected]>
  • Loading branch information
lucaseck committed Nov 4, 2024
1 parent f88974f commit 0fdc92b
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,18 @@ def _husk_outputs(node: hou.Node) -> set[str]:
of the USD stage input
"""
output_directories: set[str] = set()

for n in node.inputs():
try:
products = n.stage().GetPrimAtPath("/Render/Products")
# GetPrimAtPath returns an invalid null Prim object
# if a Prim doesn't exist at the specified path
if not products.IsValid():
continue
except Exception:
# no products found in standard namespace
return output_directories
continue

for child in products.GetChildren():
if child.GetTypeName() == "RenderProduct":
product_name_attr = child.GetAttribute("productName")
Expand All @@ -279,6 +285,26 @@ def _husk_outputs(node: hou.Node) -> set[str]:
return output_directories


def _usd_render_outputs(node: hou.Node) -> set[str]:
"""Obtain list of outputs by checking in priority order for:
1) The override output image value
2) The input nodes to the node set by the LOP Path
3) The input nodes to the current USD Render ROP
"""
output_directories: set[str] = set()

if override_path := node.parm("outputimage").eval():
output_directories.add(os.path.dirname(override_path))
elif (lop_path_node := hou.node(node.parm("loppath").evalAsNodePath())) and not node.parm(
"loppath"
).isDisabled():
output_directories.update(_husk_outputs(lop_path_node))
else:
output_directories.update(_husk_outputs(node))

return output_directories


_NODE_DIR_MAP = {
"Driver/alembic": "filename", # Alembic
"Driver/arnold": "ar_picture", # Arnold
Expand All @@ -291,14 +317,15 @@ def _husk_outputs(node: hou.Node) -> set[str]:
"Sop/filecache::2.0": "file", # File Cache v2
"Driver/filmboxfbx": "sopoutput", # Filmbox FBX
"Driver/geometry": "sopoutput", # Geometry
"Lop/usdrender_rop": _husk_outputs, # Husk
"Driver/karma": "picture", # Karma
"Driver/ifd": "vm_picture", # Mantra
"Driver/opengl": "picture", # OpenGL
"Driver/ris::3.0": _renderman_outputs, # Renderman
"Driver/Redshift_ROP": "RS_outputFileNamePrefix", # Redshift
"Sop/rop_alembic": "filename", # ROP Alembic Output
"Dop/rop_dop": "dopoutput", # ROP Output Driver
"Driver/usdrender": _usd_render_outputs, # USD Render ROP
"Lop/usdrender_rop": _usd_render_outputs, # USD Render LOP ROP
"Driver/vray_renderer": "SettingsOutput_img_file_path", # Vray
"Sop/rop_vrayproxy": "filepath", # Vray
"Driver/rop_vrayproxy": "filepath", # Vray
Expand Down

0 comments on commit 0fdc92b

Please sign in to comment.