Skip to content

Commit

Permalink
fix a bug with products with single file and improve the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MustafaJafar committed Jun 14, 2024
1 parent 2b916d5 commit 37a4e91
Showing 1 changed file with 18 additions and 30 deletions.
48 changes: 18 additions & 30 deletions client/ayon_houdini/plugins/publish/collect_cache_farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,35 @@ def process(self, instance):
# Why do we need this particular collector to collect the expected
# output files from a ROP node. Don't we have a dedicated collector
# for that yet?
# Answer: No, we don't have a generic expected file collector.
# Because different product types needs different logic.
# e.g. check CollectMantraROPRenderProducts
# and CollectKarmaROPRenderProducts
# Collect expected files
ropnode = hou.node(instance.data["instance_node"])
output_parm = lib.get_output_parameter(ropnode)
expected_filepath = output_parm.eval()
instance.data.setdefault("files", list())
instance.data.setdefault("expectedFiles", list())
if instance.data.get("frames"):
files = self.get_files(instance, expected_filepath)
# list of files
instance.data["files"].extend(files)
else:

frames = instance.data.get("frames", [])
if not frames or isinstance(frames, str):
# single file
instance.data["files"].append(output_parm.eval())
cache_files = {"_": instance.data["files"]}
# Convert instance family to pointcache if it is bgeo or abc
# because ???
self.log.debug(instance.data["families"])
instance.data["files"].append(expected_filepath)
else:
# list of files
staging_dir, _ = os.path.split(expected_filepath)
instance.data["files"].extend(
["{}/{}".format(staging_dir, f) for f in frames]
)

cache_files = {"cache": instance.data["files"]}

instance.data.update({
"plugin": "Houdini",
"publish": True
})
instance.data["families"].append("publish.hou")
instance.data["expectedFiles"].append(cache_files)

self.log.debug("{}".format(instance.data))

def get_files(self, instance, output_parm):
"""Get the files with the frame range data
Args:
instance (_type_): instance
output_parm (_type_): path of output parameter
Returns:
files: a list of files
"""
directory = os.path.dirname(output_parm)

files = [
os.path.join(directory, frame).replace("\\", "/")
for frame in instance.data["frames"]
]

return files
self.log.debug("{}".format(instance.data["expectedFiles"]))

0 comments on commit 37a4e91

Please sign in to comment.