From 3cb5c7c6acc15955c7b9a8d6d00989f735dd430a Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Fri, 29 May 2020 21:46:53 +0100 Subject: [PATCH] Add all file and alembic path to Deadline submissions. --- .../maya/publish/collect_file_dependencies.py | 28 +++++++++++++++++++ .../maya/publish/submit_maya_deadline.py | 13 +++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 pype/plugins/maya/publish/collect_file_dependencies.py diff --git a/pype/plugins/maya/publish/collect_file_dependencies.py b/pype/plugins/maya/publish/collect_file_dependencies.py new file mode 100644 index 0000000000..94fcc834e1 --- /dev/null +++ b/pype/plugins/maya/publish/collect_file_dependencies.py @@ -0,0 +1,28 @@ +import json + +from maya import cmds + +import pyblish.api + + +class CollectFileDependencies(pyblish.api.ContextPlugin): + """Gather all files referenced in this scene.""" + + label = "Collect File Dependencies" + order = pyblish.api.CollectorOrder - 0.49 + hosts = ["maya"] + + def process(self, context): + dependencies = [] + for node in cmds.ls(type="file"): + path = cmds.getAttr("{}.{}".format(node, "fileTextureName")) + if path not in dependencies: + dependencies.append(path) + + for node in cmds.ls(type="AlembicNode"): + path = cmds.getAttr("{}.{}".format(node, "abc_File")) + if path not in dependencies: + dependencies.append(path) + + context.data["fileDependencies"] = dependencies + self.log.debug(json.dumps(dependencies, indent=4)) diff --git a/pype/plugins/maya/publish/submit_maya_deadline.py b/pype/plugins/maya/publish/submit_maya_deadline.py index 89e7393fe5..0d7600c88d 100644 --- a/pype/plugins/maya/publish/submit_maya_deadline.py +++ b/pype/plugins/maya/publish/submit_maya_deadline.py @@ -213,9 +213,6 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin): # Top-level group name "BatchName": filename, - # Asset dependency to wait for at least the scene file to sync. - "AssetDependency0": filepath, - # Job name, as seen in Monitor "Name": jobname, @@ -264,6 +261,16 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin): "AuxFiles": [] } + # Adding file dependencies. + dependencies = instance.context.data["fileDependencies"] + dependencies.append(filepath) + for dependency in dependencies: + self.log.info(dependency) + key = "AssetDependency" + str(dependencies.index(dependency)) + self.log.info(key) + payload["JobInfo"][key] = dependency + + # Expected files. exp = instance.data.get("expectedFiles") OutputFilenames = {}