From 0fdc92b9397f843fb12f2eb6ddd0e6475a3ee3c9 Mon Sep 17 00:00:00 2001 From: lucaseck <117225985+lucaseck@users.noreply.github.com> Date: Fri, 1 Nov 2024 11:59:35 -0500 Subject: [PATCH] fix: detect ROP USD Render output directories Signed-off-by: lucaseck <117225985+lucaseck@users.noreply.github.com> --- .../deadline_cloud_for_houdini/_assets.py | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/deadline/houdini_submitter/python/deadline_cloud_for_houdini/_assets.py b/src/deadline/houdini_submitter/python/deadline_cloud_for_houdini/_assets.py index a6d8f1e..fb8283f 100644 --- a/src/deadline/houdini_submitter/python/deadline_cloud_for_houdini/_assets.py +++ b/src/deadline/houdini_submitter/python/deadline_cloud_for_houdini/_assets.py @@ -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") @@ -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 @@ -291,7 +317,6 @@ 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 @@ -299,6 +324,8 @@ def _husk_outputs(node: hou.Node) -> set[str]: "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