From 6ec18b00ea8dca105b3e8ae9141b3355f2f70342 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 9 Mar 2021 15:29:54 +0100 Subject: [PATCH] single collector for batch instances # Conflicts: # pype/hosts/standalonepublisher/plugins/publish/collect_mov_instances.py --- .../plugins/publish/collect_mov_instances.py | 54 ------------------- .../plugins/publish/collect_psd_instances.py | 34 +++++++----- 2 files changed, 22 insertions(+), 66 deletions(-) delete mode 100644 pype/hosts/standalonepublisher/plugins/publish/collect_mov_instances.py diff --git a/pype/hosts/standalonepublisher/plugins/publish/collect_mov_instances.py b/pype/hosts/standalonepublisher/plugins/publish/collect_mov_instances.py deleted file mode 100644 index 0dcbd119d9..0000000000 --- a/pype/hosts/standalonepublisher/plugins/publish/collect_mov_instances.py +++ /dev/null @@ -1,54 +0,0 @@ -import copy -import pyblish.api -from pprint import pformat - - -class CollectMovInstances(pyblish.api.InstancePlugin): - """Collect all available instances from render mov batch.""" - - label = "Collect Mov Instances" - order = pyblish.api.CollectorOrder + 0.489 - hosts = ["standalonepublisher"] - families = ["render_mov_batch"] - - # presets - subsets = { - "render": { - "task": "compositing", - "family": "render" - } - } - unchecked_by_default = [] - - def process(self, instance): - context = instance.context - asset_name = instance.data["asset"] - for subset_name, subset_data in self.subsets.items(): - instance_name = f"{asset_name}_{subset_name}" - task_name = subset_data["task"] - - # create new instance - new_instance = context.create_instance(instance_name) - - # add original instance data except name key - for key, value in instance.data.items(): - if key not in ["name"]: - # Make sure value is copy since value may be object which - # can be shared across all new created objects - new_instance.data[key] = copy.deepcopy(value) - - # add subset data from preset - new_instance.data.update(subset_data) - - new_instance.data["label"] = instance_name - new_instance.data["subset"] = subset_name - new_instance.data["task"] = task_name - - if subset_name in self.unchecked_by_default: - new_instance.data["publish"] = False - - self.log.info(f"Created new instance: {instance_name}") - self.log.debug(f"New instance data: {pformat(new_instance.data)}") - - # delete original instance - context.remove(instance) diff --git a/pype/hosts/standalonepublisher/plugins/publish/collect_psd_instances.py b/pype/hosts/standalonepublisher/plugins/publish/collect_psd_instances.py index 11cedc30b9..09ec78af39 100644 --- a/pype/hosts/standalonepublisher/plugins/publish/collect_psd_instances.py +++ b/pype/hosts/standalonepublisher/plugins/publish/collect_psd_instances.py @@ -11,21 +11,29 @@ class CollectPsdInstances(pyblish.api.InstancePlugin): label = "Collect Psd Instances" order = pyblish.api.CollectorOrder + 0.489 hosts = ["standalonepublisher"] - families = ["background_batch"] + families = ["background_batch", "render_mov_batch"] # presets subsets = { - "backgroundLayout": { - "task": "background", - "family": "backgroundLayout" + "background_batch": { + "backgroundLayout": { + "task": "background", + "family": "backgroundLayout" + }, + "backgroundComp": { + "task": "background", + "family": "backgroundComp" + }, + "workfileBackground": { + "task": "background", + "family": "workfile" + } }, - "backgroundComp": { - "task": "background", - "family": "backgroundComp" - }, - "workfileBackground": { - "task": "background", - "family": "workfile" + "render_mov_batch": { + "renderCompositingDefault": { + "task": "Compositing", + "family": "render" + } } } unchecked_by_default = [] @@ -34,7 +42,9 @@ class CollectPsdInstances(pyblish.api.InstancePlugin): context = instance.context asset_data = instance.data["assetEntity"] asset_name = instance.data["asset"] - for subset_name, subset_data in self.subsets.items(): + family = instance.data["family"] + + for subset_name, subset_data in self.subsets[family].items(): instance_name = f"{asset_name}_{subset_name}" task = subset_data.get("task", "background")