Merge pull request #5186 from tokejepsen/enhancement/OP-5265_Use-custom-staging-dir-function-for-Maya-renders

This commit is contained in:
Ondřej Samohel 2023-09-20 16:24:56 +02:00 committed by GitHub
commit 75e265198b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 201 additions and 31 deletions

View file

@ -103,13 +103,16 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
# stash render job id for later validation
instance.data["render_job_id"] = data.get("job").get("_id")
staging_dir_persistent = instance.data.get(
"stagingDir_persistent", False
)
representations = []
for repre_data in instance_data.get("representations") or []:
self._fill_staging_dir(repre_data, anatomy)
representations.append(repre_data)
add_repre_files_for_cleanup(instance, repre_data)
if not staging_dir_persistent:
add_repre_files_for_cleanup(instance, repre_data)
instance.data["representations"] = representations
@ -124,6 +127,8 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
self.log.debug(
f"Adding audio to instance: {instance.data['audio']}")
return staging_dir_persistent
def process(self, context):
self._context = context
@ -160,9 +165,12 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
legacy_io.Session.update(session_data)
os.environ.update(session_data)
session_is_set = True
self._process_path(data, anatomy)
context.data["cleanupFullPaths"].append(path)
context.data["cleanupEmptyDirs"].append(os.path.dirname(path))
staging_dir_persistent = self._process_path(data, anatomy)
if not staging_dir_persistent:
context.data["cleanupFullPaths"].append(path)
context.data["cleanupEmptyDirs"].append(
os.path.dirname(path)
)
except Exception as e:
self.log.error(e, exc_info=True)
raise Exception("Error") from e