feat: deleting rendered frames from working area after publishing

This commit is contained in:
Ondřej Samohel 2019-07-26 14:00:30 +02:00
parent eea84c9e7a
commit 8d41902b1a
No known key found for this signature in database
GPG key ID: 8A29C663C672C2B7
2 changed files with 28 additions and 8 deletions

View file

@ -160,10 +160,13 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin):
# Get family from the data # Get family from the data
families = data.get("families", ["render"]) families = data.get("families", ["render"])
assert isinstance(families, (list, tuple)), "Must be iterable" if "render" not in families:
assert families, "Must have at least a single family" families.append("render")
families.append("ftrack") if "ftrack" not in families:
families.append("review") families.append("ftrack")
if "review" not in families:
families.append("review")
for collection in collections: for collection in collections:
instance = context.create_instance(str(collection)) instance = context.create_instance(str(collection))
self.log.info("Collection: %s" % list(collection)) self.log.info("Collection: %s" % list(collection))

View file

@ -403,19 +403,36 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
self.log.info("Registered {} items".format(len(representations))) self.log.info("Registered {} items".format(len(representations)))
def integrate(self, instance): def integrate(self, instance):
"""Move the files """ Move the files. If files are in render family, they will be
deleted after copy.
Through `instance.data["transfers"]` Through `instance.data["transfers"]`
Args: Args:
instance: the instance to integrate instance: the instance to integrate
""" """
transfers = instance.data.get("transfers", list()) transfers = instance.data.get("transfers", list())
current_families = instance.data.get("families", list())
instance_family = instance.data.get("family", None)
dirnames = []
for src, dest in transfers: for src, dest in transfers:
if os.path.normpath(src) != os.path.normpath(dest): if os.path.normpath(src) != os.path.normpath(dest):
self.copy_file(src, dest) self.copy_file(src, dest)
if instance_family == 'render' or 'render' in current_families:
os.remove(src)
dirnames.append(os.path.dirname(src))
# make unique set
cleanup_dirs = set(dirnames)
for dir in cleanup_dirs:
try:
os.rmdir(dir)
except OSError:
# directory is not empty, skipping
continue
# Produce hardlinked copies # Produce hardlinked copies
# Note: hardlink can only be produced between two files on the same # Note: hardlink can only be produced between two files on the same