From 630966e5b129445b99a003417fa4b69e8bd68cf9 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 8 Mar 2024 12:39:20 +0100 Subject: [PATCH] houdini use representation entity --- client/ayon_core/hosts/houdini/api/pipeline.py | 2 +- .../ayon_core/hosts/houdini/plugins/load/load_alembic.py | 6 +++--- .../hosts/houdini/plugins/load/load_alembic_archive.py | 6 +++--- client/ayon_core/hosts/houdini/plugins/load/load_ass.py | 6 +++--- client/ayon_core/hosts/houdini/plugins/load/load_bgeo.py | 8 ++++---- .../ayon_core/hosts/houdini/plugins/load/load_camera.py | 6 +++--- client/ayon_core/hosts/houdini/plugins/load/load_fbx.py | 6 +++--- client/ayon_core/hosts/houdini/plugins/load/load_hda.py | 6 +++--- client/ayon_core/hosts/houdini/plugins/load/load_image.py | 8 ++++---- .../hosts/houdini/plugins/load/load_redshift_proxy.py | 8 ++++---- .../hosts/houdini/plugins/load/load_usd_layer.py | 8 ++++---- .../hosts/houdini/plugins/load/load_usd_reference.py | 8 ++++---- client/ayon_core/hosts/houdini/plugins/load/load_vdb.py | 8 ++++---- .../hosts/houdini/plugins/publish/extract_usd_layered.py | 5 ++--- 14 files changed, 45 insertions(+), 46 deletions(-) diff --git a/client/ayon_core/hosts/houdini/api/pipeline.py b/client/ayon_core/hosts/houdini/api/pipeline.py index 4b0580c5af..d5144200cf 100644 --- a/client/ayon_core/hosts/houdini/api/pipeline.py +++ b/client/ayon_core/hosts/houdini/api/pipeline.py @@ -235,7 +235,7 @@ def containerise(name, "name": name, "namespace": namespace, "loader": str(loader), - "representation": str(context["representation"]["_id"]), + "representation": context["representation"]["id"], } lib.imprint(container, data) diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_alembic.py b/client/ayon_core/hosts/houdini/plugins/load/load_alembic.py index 9ee72a270c..5235923b4c 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_alembic.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_alembic.py @@ -82,7 +82,7 @@ class AbcLoader(load.LoaderPlugin): ) def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] try: alembic_node = next( @@ -93,13 +93,13 @@ class AbcLoader(load.LoaderPlugin): return # Update the file path - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) file_path = file_path.replace("\\", "/") alembic_node.setParms({"fileName": file_path}) # Update attribute - node.setParms({"representation": str(repre_doc["_id"])}) + node.setParms({"representation": repre_entity["id"]}) def remove(self, container): diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_alembic_archive.py b/client/ayon_core/hosts/houdini/plugins/load/load_alembic_archive.py index bc65863a76..6585df3f17 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_alembic_archive.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_alembic_archive.py @@ -56,16 +56,16 @@ class AbcArchiveLoader(load.LoaderPlugin): suffix="") def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] # Update the file path - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) file_path = file_path.replace("\\", "/") # Update attributes node.setParms({"fileName": file_path, - "representation": str(repre_doc["_id"])}) + "representation": repre_entity["id"]}) # Rebuild node.parm("buildHierarchy").pressButton() diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_ass.py b/client/ayon_core/hosts/houdini/plugins/load/load_ass.py index b687b07199..628b5b2f34 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_ass.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_ass.py @@ -50,12 +50,12 @@ class AssLoader(load.LoaderPlugin): def update(self, container, context): # Update the file path - repre_doc = context["representation"] + repre_entity = context["representation"] procedural = container["node"] - procedural.setParms({"ar_filename": self.format_path(repre_doc)}) + procedural.setParms({"ar_filename": self.format_path(repre_entity)}) # Update attribute - procedural.setParms({"representation": str(repre_doc["_id"])}) + procedural.setParms({"representation": repre_entity["id"]}) def remove(self, container): node = container["node"] diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_bgeo.py b/client/ayon_core/hosts/houdini/plugins/load/load_bgeo.py index 246d1b3524..f02067db75 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_bgeo.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_bgeo.py @@ -83,7 +83,7 @@ class BgeoLoader(load.LoaderPlugin): return filename def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] try: file_node = next( @@ -94,13 +94,13 @@ class BgeoLoader(load.LoaderPlugin): return # Update the file path - file_path = get_representation_path(repre_doc) - file_path = self.format_path(file_path, repre_doc) + file_path = get_representation_path(repre_entity) + file_path = self.format_path(file_path, repre_entity) file_node.setParms({"file": file_path}) # Update attribute - node.setParms({"representation": str(repre_doc["_id"])}) + node.setParms({"representation": repre_entity["id"]}) def remove(self, container): diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_camera.py b/client/ayon_core/hosts/houdini/plugins/load/load_camera.py index 63b50cd6fe..50fc7f4eb6 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_camera.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_camera.py @@ -133,16 +133,16 @@ class CameraLoader(load.LoaderPlugin): suffix="") def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] # Update the file path - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) file_path = file_path.replace("\\", "/") # Update attributes node.setParms({"fileName": file_path, - "representation": str(repre_doc["_id"])}) + "representation": repre_entity["id"]}) # Store the cam temporarily next to the Alembic Archive # so that we can preserve parm values the user set on it diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_fbx.py b/client/ayon_core/hosts/houdini/plugins/load/load_fbx.py index 9ce7c79998..2ebbed5e12 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_fbx.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_fbx.py @@ -48,7 +48,7 @@ class FbxLoader(load.LoaderPlugin): return containerised_nodes def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] try: file_node = next( @@ -59,13 +59,13 @@ class FbxLoader(load.LoaderPlugin): return # Update the file path from representation - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) file_path = file_path.replace("\\", "/") file_node.setParms({"file": file_path}) # Update attribute - node.setParms({"representation": str(repre_doc["_id"])}) + node.setParms({"representation": repre_entity["id"]}) def remove(self, container): diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_hda.py b/client/ayon_core/hosts/houdini/plugins/load/load_hda.py index 0f7d30977a..07949fd177 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_hda.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_hda.py @@ -51,9 +51,9 @@ class HdaLoader(load.LoaderPlugin): def update(self, container, context): import hou - repre_doc = context["representation"] + repre_entity = context["representation"] hda_node = container["node"] - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) file_path = file_path.replace("\\", "/") hou.hda.installFile(file_path) defs = hda_node.type().allInstalledDefinitions() @@ -61,7 +61,7 @@ class HdaLoader(load.LoaderPlugin): new = def_paths.index(file_path) defs[new].setIsPreferred(True) hda_node.setParms({ - "representation": str(repre_doc["_id"]) + "representation": repre_entity["id"] }) def remove(self, container): diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_image.py b/client/ayon_core/hosts/houdini/plugins/load/load_image.py index 2cc8d0df18..cc9dcc30c8 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_image.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_image.py @@ -79,7 +79,7 @@ class ImageLoader(load.LoaderPlugin): "name": node_name, "namespace": namespace, "loader": str(self.__class__.__name__), - "representation": str(context["representation"]["_id"]), + "representation": context["representation"]["id"], } # todo: add folder="Avalon" @@ -88,11 +88,11 @@ class ImageLoader(load.LoaderPlugin): return node def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] # Update the file path - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) file_path = file_path.replace("\\", "/") file_path = self._get_file_sequence(file_path) @@ -100,7 +100,7 @@ class ImageLoader(load.LoaderPlugin): node.setParms( { "filename1": file_path, - "representation": str(repre_doc["_id"]), + "representation": repre_entity["id"], } ) diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_redshift_proxy.py b/client/ayon_core/hosts/houdini/plugins/load/load_redshift_proxy.py index 479c5bb300..86c7ae0272 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_redshift_proxy.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_redshift_proxy.py @@ -73,18 +73,18 @@ class RedshiftProxyLoader(load.LoaderPlugin): ) def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] # Update the file path - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) node = container["node"] node.setParms({ "RS_objprop_proxy_file": self.format_path( - file_path, repre_doc) + file_path, repre_entity) }) # Update attribute - node.setParms({"representation": str(repre_doc["_id"])}) + node.setParms({"representation": repre_entity["id"]}) def remove(self, container): diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_usd_layer.py b/client/ayon_core/hosts/houdini/plugins/load/load_usd_layer.py index fa3f3683ae..6ee21f87ec 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_usd_layer.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_usd_layer.py @@ -49,7 +49,7 @@ class USDSublayerLoader(load.LoaderPlugin): "name": node_name, "namespace": namespace, "loader": str(self.__class__.__name__), - "representation": str(context["representation"]["_id"]), + "representation": context["representation"]["id"], } # todo: add folder="Avalon" @@ -58,18 +58,18 @@ class USDSublayerLoader(load.LoaderPlugin): return container def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] # Update the file path - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) file_path = file_path.replace("\\", "/") # Update attributes node.setParms( { "filepath1": file_path, - "representation": str(repre_doc["_id"]), + "representation": repre_entity["id"], } ) diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_usd_reference.py b/client/ayon_core/hosts/houdini/plugins/load/load_usd_reference.py index 38540b54c2..d0421083c6 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_usd_reference.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_usd_reference.py @@ -49,7 +49,7 @@ class USDReferenceLoader(load.LoaderPlugin): "name": node_name, "namespace": namespace, "loader": str(self.__class__.__name__), - "representation": str(context["representation"]["_id"]), + "representation": context["representation"]["id"], } # todo: add folder="Avalon" @@ -58,18 +58,18 @@ class USDReferenceLoader(load.LoaderPlugin): return container def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] # Update the file path - file_path = get_representation_path(repre_doc) + file_path = get_representation_path(repre_entity) file_path = file_path.replace("\\", "/") # Update attributes node.setParms( { "filepath1": file_path, - "representation": str(repre_doc["_id"]), + "representation": repre_entity["id"], } ) diff --git a/client/ayon_core/hosts/houdini/plugins/load/load_vdb.py b/client/ayon_core/hosts/houdini/plugins/load/load_vdb.py index 8af458aeb0..7b2803ab5d 100644 --- a/client/ayon_core/hosts/houdini/plugins/load/load_vdb.py +++ b/client/ayon_core/hosts/houdini/plugins/load/load_vdb.py @@ -80,7 +80,7 @@ class VdbLoader(load.LoaderPlugin): return filename def update(self, container, context): - repre_doc = context["representation"] + repre_entity = context["representation"] node = container["node"] try: file_node = next( @@ -91,13 +91,13 @@ class VdbLoader(load.LoaderPlugin): return # Update the file path - file_path = get_representation_path(repre_doc) - file_path = self.format_path(file_path, repre_doc) + file_path = get_representation_path(repre_entity) + file_path = self.format_path(file_path, repre_entity) file_node.setParms({"file": file_path}) # Update attribute - node.setParms({"representation": str(repre_doc["_id"])}) + node.setParms({"representation": repre_entity["id"]}) def remove(self, container): diff --git a/client/ayon_core/hosts/houdini/plugins/publish/extract_usd_layered.py b/client/ayon_core/hosts/houdini/plugins/publish/extract_usd_layered.py index 33ab7ef43c..2e5c9a892c 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/extract_usd_layered.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/extract_usd_layered.py @@ -1,13 +1,12 @@ import os import contextlib -import hou import sys from collections import deque +import hou import ayon_api import pyblish.api -from ayon_core.client import get_representation_by_name from ayon_core.pipeline import ( get_representation_path, publish, @@ -301,7 +300,7 @@ class ExtractUSDLayered(publish.Extractor): self.log.debug("No existing version..") return False - representation = get_representation_by_name( + representation = ayon_api.get_representation_by_name( project_name, ext.lstrip("."), version_entity["id"] ) if not representation: