From a7c4c04596c1a9decd7e9fcb480eb4150011c57b Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Wed, 2 Feb 2022 17:47:46 +0100 Subject: [PATCH 1/4] fix usd family this is fixing usd family in loaders and integrator --- openpype/hosts/houdini/plugins/load/load_usd_layer.py | 5 +---- openpype/hosts/houdini/plugins/load/load_usd_reference.py | 5 +---- openpype/plugins/publish/integrate_new.py | 3 ++- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/openpype/hosts/houdini/plugins/load/load_usd_layer.py b/openpype/hosts/houdini/plugins/load/load_usd_layer.py index 7483101409..b4f9124567 100644 --- a/openpype/hosts/houdini/plugins/load/load_usd_layer.py +++ b/openpype/hosts/houdini/plugins/load/load_usd_layer.py @@ -6,10 +6,7 @@ class USDSublayerLoader(api.Loader): """Sublayer USD file in Solaris""" families = [ - "colorbleed.usd", - "colorbleed.pointcache", - "colorbleed.animation", - "colorbleed.camera", + "usd", "usdCamera", ] label = "Sublayer USD" diff --git a/openpype/hosts/houdini/plugins/load/load_usd_reference.py b/openpype/hosts/houdini/plugins/load/load_usd_reference.py index cab3cb5269..e7a428add1 100644 --- a/openpype/hosts/houdini/plugins/load/load_usd_reference.py +++ b/openpype/hosts/houdini/plugins/load/load_usd_reference.py @@ -6,10 +6,7 @@ class USDReferenceLoader(api.Loader): """Reference USD file in Solaris""" families = [ - "colorbleed.usd", - "colorbleed.pointcache", - "colorbleed.animation", - "colorbleed.camera", + "usd", "usdCamera", ] label = "Reference USD" diff --git a/openpype/plugins/publish/integrate_new.py b/openpype/plugins/publish/integrate_new.py index bf214d9139..3d48fb92ee 100644 --- a/openpype/plugins/publish/integrate_new.py +++ b/openpype/plugins/publish/integrate_new.py @@ -100,7 +100,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): "redshiftproxy", "effect", "xgen", - "hda" + "hda", + "usd" ] exclude_families = ["clip"] db_representation_context_keys = [ From 4501c8eaf1da1314e898480e9d1f757789d8b93f Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Tue, 8 Feb 2022 14:31:54 +0100 Subject: [PATCH 2/4] add default for ftrack, fix family name --- .../houdini/plugins/publish/collect_usd_layers.py | 2 +- .../defaults/project_settings/ftrack.json | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/houdini/plugins/publish/collect_usd_layers.py b/openpype/hosts/houdini/plugins/publish/collect_usd_layers.py index 8be6ead1b1..e3985e3c97 100644 --- a/openpype/hosts/houdini/plugins/publish/collect_usd_layers.py +++ b/openpype/hosts/houdini/plugins/publish/collect_usd_layers.py @@ -48,7 +48,7 @@ class CollectUsdLayers(pyblish.api.InstancePlugin): label = "{0} -> {1}".format(instance.data["name"], name) layer_inst = context.create_instance(name) - family = "colorbleed.usdlayer" + family = "usdlayer" layer_inst.data["family"] = family layer_inst.data["families"] = [family] layer_inst.data["subset"] = "__stub__" diff --git a/openpype/settings/defaults/project_settings/ftrack.json b/openpype/settings/defaults/project_settings/ftrack.json index 1474ad103d..3d32ea0b7c 100644 --- a/openpype/settings/defaults/project_settings/ftrack.json +++ b/openpype/settings/defaults/project_settings/ftrack.json @@ -331,6 +331,18 @@ "tasks": [], "add_ftrack_family": true, "advanced_filtering": [] + }, + { + "hosts": [ + "houdini" + ], + "families": [ + "usd" + ], + "task_types": [], + "tasks": [], + "add_ftrack_family": true, + "advanced_filtering": [] } ] }, @@ -374,7 +386,8 @@ "layout": "layout", "unrealStaticMesh": "geo", "vrayproxy": "cache", - "redshiftproxy": "cache" + "redshiftproxy": "cache", + "usd": "usd" } } } From 816eb713938b5b11371c148ffbfbedfe1866d3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Wed, 9 Feb 2022 14:57:25 +0100 Subject: [PATCH 3/4] add `/stage` to ls --- openpype/hosts/houdini/api/lib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openpype/hosts/houdini/api/lib.py b/openpype/hosts/houdini/api/lib.py index eaaba94ed5..6e48791ce8 100644 --- a/openpype/hosts/houdini/api/lib.py +++ b/openpype/hosts/houdini/api/lib.py @@ -406,6 +406,7 @@ def imprint(node, data): def lsattr(attr, value=None): if value is None: nodes = list(hou.node("/obj").allNodes()) + nodes += list(hou.node("/stage").allNodes()) return [n for n in nodes if n.parm(attr)] return lsattrs({attr: value}) @@ -428,6 +429,7 @@ def lsattrs(attrs): matches = set() nodes = list(hou.node("/obj").allNodes()) # returns generator object + nodes += list(hou.node("/stage").allNodes()) for node in nodes: for attr in attrs: if not node.parm(attr): From 390c6d15a580f18b736dbb26670effe24719d974 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Thu, 10 Feb 2022 17:31:32 +0100 Subject: [PATCH 4/4] handle permissions and root more gracefully --- openpype/hosts/houdini/api/lib.py | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/houdini/api/lib.py b/openpype/hosts/houdini/api/lib.py index 6e48791ce8..937863caba 100644 --- a/openpype/hosts/houdini/api/lib.py +++ b/openpype/hosts/houdini/api/lib.py @@ -403,33 +403,46 @@ def imprint(node, data): node.setParmTemplateGroup(parm_group) -def lsattr(attr, value=None): +def lsattr(attr, value=None, root="/"): + """Return nodes that have `attr` + When `value` is not None it will only return nodes matching that value + for the given attribute. + Args: + attr (str): Name of the attribute (hou.Parm) + value (object, Optional): The value to compare the attribute too. + When the default None is provided the value check is skipped. + root (str): The root path in Houdini to search in. + Returns: + list: Matching nodes that have attribute with value. + """ if value is None: - nodes = list(hou.node("/obj").allNodes()) - nodes += list(hou.node("/stage").allNodes()) + # Use allSubChildren() as allNodes() errors on nodes without + # permission to enter without a means to continue of querying + # the rest + nodes = hou.node(root).allSubChildren() return [n for n in nodes if n.parm(attr)] return lsattrs({attr: value}) -def lsattrs(attrs): +def lsattrs(attrs, root="/"): """Return nodes matching `key` and `value` - Arguments: attrs (dict): collection of attribute: value - + root (str): The root path in Houdini to search in. Example: >> lsattrs({"id": "myId"}) ["myNode"] >> lsattr("id") ["myNode", "myOtherNode"] - Returns: - list + list: Matching nodes that have attribute with value. """ matches = set() - nodes = list(hou.node("/obj").allNodes()) # returns generator object - nodes += list(hou.node("/stage").allNodes()) + # Use allSubChildren() as allNodes() errors on nodes without + # permission to enter without a means to continue of querying + # the rest + nodes = hou.node(root).allSubChildren() for node in nodes: for attr in attrs: if not node.parm(attr):