houdini load plugins are expecting representation context

This commit is contained in:
Jakub Trllo 2024-02-26 17:57:09 +01:00
parent 24e9f92425
commit 8bdf0552be
12 changed files with 69 additions and 67 deletions

View file

@ -81,8 +81,8 @@ class AbcLoader(load.LoaderPlugin):
suffix="",
)
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
try:
alembic_node = next(
@ -93,18 +93,18 @@ class AbcLoader(load.LoaderPlugin):
return
# Update the file path
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
file_path = file_path.replace("\\", "/")
alembic_node.setParms({"fileName": file_path})
# Update attribute
node.setParms({"representation": str(representation["_id"])})
node.setParms({"representation": str(repre_doc["_id"])})
def remove(self, container):
node = container["node"]
node.destroy()
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)

View file

@ -55,17 +55,17 @@ class AbcArchiveLoader(load.LoaderPlugin):
self.__class__.__name__,
suffix="")
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
# Update the file path
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
file_path = file_path.replace("\\", "/")
# Update attributes
node.setParms({"fileName": file_path,
"representation": str(representation["_id"])})
"representation": str(repre_doc["_id"])})
# Rebuild
node.parm("buildHierarchy").pressButton()
@ -75,5 +75,5 @@ class AbcArchiveLoader(load.LoaderPlugin):
node = container["node"]
node.destroy()
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)

View file

@ -48,13 +48,14 @@ class AssLoader(load.LoaderPlugin):
suffix="",
)
def update(self, container, representation):
def update(self, container, context):
# Update the file path
repre_doc = context["representation"]
procedural = container["node"]
procedural.setParms({"ar_filename": self.format_path(representation)})
procedural.setParms({"ar_filename": self.format_path(repre_doc)})
# Update attribute
procedural.setParms({"representation": str(representation["_id"])})
procedural.setParms({"representation": str(repre_doc["_id"])})
def remove(self, container):
node = container["node"]
@ -86,5 +87,5 @@ class AssLoader(load.LoaderPlugin):
return os.path.normpath(path).replace("\\", "/")
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)

View file

@ -82,8 +82,8 @@ class BgeoLoader(load.LoaderPlugin):
return filename
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
try:
file_node = next(
@ -94,18 +94,18 @@ class BgeoLoader(load.LoaderPlugin):
return
# Update the file path
file_path = get_representation_path(representation)
file_path = self.format_path(file_path, representation)
file_path = get_representation_path(repre_doc)
file_path = self.format_path(file_path, repre_doc)
file_node.setParms({"file": file_path})
# Update attribute
node.setParms({"representation": str(representation["_id"])})
node.setParms({"representation": str(repre_doc["_id"])})
def remove(self, container):
node = container["node"]
node.destroy()
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)

View file

@ -132,17 +132,17 @@ class CameraLoader(load.LoaderPlugin):
self.__class__.__name__,
suffix="")
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
# Update the file path
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
file_path = file_path.replace("\\", "/")
# Update attributes
node.setParms({"fileName": file_path,
"representation": str(representation["_id"])})
"representation": str(repre_doc["_id"])})
# Store the cam temporarily next to the Alembic Archive
# so that we can preserve parm values the user set on it

View file

@ -47,8 +47,8 @@ class FbxLoader(load.LoaderPlugin):
return containerised_nodes
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
try:
file_node = next(
@ -59,21 +59,21 @@ class FbxLoader(load.LoaderPlugin):
return
# Update the file path from representation
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
file_path = file_path.replace("\\", "/")
file_node.setParms({"file": file_path})
# Update attribute
node.setParms({"representation": str(representation["_id"])})
node.setParms({"representation": str(repre_doc["_id"])})
def remove(self, container):
node = container["node"]
node.destroy()
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)
def get_node_name(self, context, name=None, namespace=None):
"""Define node name."""

View file

@ -48,11 +48,12 @@ class HdaLoader(load.LoaderPlugin):
suffix="",
)
def update(self, container, representation):
def update(self, container, context):
import hou
repre_doc = context["representation"]
hda_node = container["node"]
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
file_path = file_path.replace("\\", "/")
hou.hda.installFile(file_path)
defs = hda_node.type().allInstalledDefinitions()
@ -60,7 +61,7 @@ class HdaLoader(load.LoaderPlugin):
new = def_paths.index(file_path)
defs[new].setIsPreferred(True)
hda_node.setParms({
"representation": str(representation["_id"])
"representation": str(repre_doc["_id"])
})
def remove(self, container):

View file

@ -87,12 +87,12 @@ class ImageLoader(load.LoaderPlugin):
return node
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
# Update the file path
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
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(representation["_id"]),
"representation": str(repre_doc["_id"]),
}
)
@ -128,5 +128,5 @@ class ImageLoader(load.LoaderPlugin):
fname = ".".join([prefix, "$F{}".format(len(padding)), suffix])
return os.path.join(root, fname).replace("\\", "/")
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)

View file

@ -72,19 +72,19 @@ class RedshiftProxyLoader(load.LoaderPlugin):
suffix="",
)
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
# Update the file path
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
node = container["node"]
node.setParms({
"RS_objprop_proxy_file": self.format_path(
file_path, representation)
file_path, repre_doc)
})
# Update attribute
node.setParms({"representation": str(representation["_id"])})
node.setParms({"representation": str(repre_doc["_id"])})
def remove(self, container):

View file

@ -57,19 +57,19 @@ class USDSublayerLoader(load.LoaderPlugin):
return container
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
# Update the file path
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
file_path = file_path.replace("\\", "/")
# Update attributes
node.setParms(
{
"filepath1": file_path,
"representation": str(representation["_id"]),
"representation": str(repre_doc["_id"]),
}
)
@ -81,5 +81,5 @@ class USDSublayerLoader(load.LoaderPlugin):
node = container["node"]
node.destroy()
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)

View file

@ -57,19 +57,19 @@ class USDReferenceLoader(load.LoaderPlugin):
return container
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
# Update the file path
file_path = get_representation_path(representation)
file_path = get_representation_path(repre_doc)
file_path = file_path.replace("\\", "/")
# Update attributes
node.setParms(
{
"filepath1": file_path,
"representation": str(representation["_id"]),
"representation": str(repre_doc["_id"]),
}
)
@ -81,5 +81,5 @@ class USDReferenceLoader(load.LoaderPlugin):
node = container["node"]
node.destroy()
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)

View file

@ -79,8 +79,8 @@ class VdbLoader(load.LoaderPlugin):
return filename
def update(self, container, representation):
def update(self, container, context):
repre_doc = context["representation"]
node = container["node"]
try:
file_node = next(
@ -91,18 +91,18 @@ class VdbLoader(load.LoaderPlugin):
return
# Update the file path
file_path = get_representation_path(representation)
file_path = self.format_path(file_path, representation)
file_path = get_representation_path(repre_doc)
file_path = self.format_path(file_path, repre_doc)
file_node.setParms({"file": file_path})
# Update attribute
node.setParms({"representation": str(representation["_id"])})
node.setParms({"representation": str(repre_doc["_id"])})
def remove(self, container):
node = container["node"]
node.destroy()
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)