mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
feat: deleting rendered frames from working area after publishing
This commit is contained in:
parent
eea84c9e7a
commit
8d41902b1a
2 changed files with 28 additions and 8 deletions
|
|
@ -160,10 +160,13 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin):
|
|||
|
||||
# Get family from the data
|
||||
families = data.get("families", ["render"])
|
||||
assert isinstance(families, (list, tuple)), "Must be iterable"
|
||||
assert families, "Must have at least a single family"
|
||||
families.append("ftrack")
|
||||
families.append("review")
|
||||
if "render" not in families:
|
||||
families.append("render")
|
||||
if "ftrack" not in families:
|
||||
families.append("ftrack")
|
||||
if "review" not in families:
|
||||
families.append("review")
|
||||
|
||||
for collection in collections:
|
||||
instance = context.create_instance(str(collection))
|
||||
self.log.info("Collection: %s" % list(collection))
|
||||
|
|
|
|||
|
|
@ -403,19 +403,36 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
self.log.info("Registered {} items".format(len(representations)))
|
||||
|
||||
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:
|
||||
instance: the instance to integrate
|
||||
Args:
|
||||
instance: the instance to integrate
|
||||
"""
|
||||
|
||||
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:
|
||||
if os.path.normpath(src) != os.path.normpath(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
|
||||
# Note: hardlink can only be produced between two files on the same
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue