From 86564d3412708fda21621f9e2437b5c878ddd7a6 Mon Sep 17 00:00:00 2001 From: MaximumFX Date: Tue, 16 Jan 2024 16:18:53 +0100 Subject: [PATCH] Fix error for publish version metadata on missing sg_data --- python/tk_houdini_renderman/handler.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/python/tk_houdini_renderman/handler.py b/python/tk_houdini_renderman/handler.py index a7f2865..dad261d 100644 --- a/python/tk_houdini_renderman/handler.py +++ b/python/tk_houdini_renderman/handler.py @@ -445,30 +445,32 @@ def setup_aovs(self, node: hou.Node, show_notification: bool = True) -> bool: # Now loop over all items for published_item in published_items: + fields = published_item["fields"] + # Get the latest version on disk latest_version = breakdown_app.compute_highest_version( - published_item["template"], published_item["fields"] + published_item["template"], fields ) - fields = published_item["fields"] - entity_type = published_item["sg_data"]["entity"]["type"] - version = { - "version": published_item["sg_data"]["version_number"], + "version": fields["version"], "latest_version": latest_version, - "type": entity_type, + "published": False, } - if entity_type == "Shot": + if "Shot" in fields: + version["type"] = "Shot" version[ "name" ] = f"{fields['Sequence']} {fields['Shot']} {fields['Step']} {fields['name']}" - elif entity_type == "Asset": + elif "Asset" in fields: + version["type"] = "Asset" version[ "name" ] = f"{fields['Asset']} {fields['Step']} {fields['name']}" - else: - version["name"] = "Undefined" + + if published_item["sg_data"]: + version["published"] = True used_versions.append(version)