houdini use representation entity

This commit is contained in:
Jakub Trllo 2024-03-08 12:39:20 +01:00
parent ff20964dc0
commit 630966e5b1
14 changed files with 45 additions and 46 deletions

View file

@ -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)

View file

@ -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):

View file

@ -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()

View file

@ -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"]

View file

@ -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):

View file

@ -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

View file

@ -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):

View file

@ -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):

View file

@ -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"],
}
)

View file

@ -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):

View file

@ -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"],
}
)

View file

@ -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"],
}
)

View file

@ -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):

View file

@ -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: