mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 17:04:54 +01:00
fix a bug with products with single file and improve the logic
This commit is contained in:
parent
d0f2642eae
commit
6d9667ed3d
1 changed files with 18 additions and 30 deletions
|
|
@ -29,23 +29,30 @@ class CollectDataforCache(plugin.HoudiniInstancePlugin):
|
|||
# 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
|
||||
|
|
@ -53,23 +60,4 @@ class CollectDataforCache(plugin.HoudiniInstancePlugin):
|
|||
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"]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue