From a395a85b67065e34c445e2b522afedb8d0f6cf42 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 15 Jul 2022 15:07:11 +0200 Subject: [PATCH] OP-3446 - explicitly adding review Creator now should handle adding review on instance and on applicable representation tags. --- .../plugins/create/create_mov_batch.py | 15 +++++++++++++-- .../plugins/publish/collect_mov_batch.py | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/traypublisher/plugins/create/create_mov_batch.py b/openpype/hosts/traypublisher/plugins/create/create_mov_batch.py index 20d3ecbd7c..67f8848e05 100644 --- a/openpype/hosts/traypublisher/plugins/create/create_mov_batch.py +++ b/openpype/hosts/traypublisher/plugins/create/create_mov_batch.py @@ -4,7 +4,7 @@ import re from openpype.client import get_assets, get_asset_by_name from openpype.hosts.traypublisher.api import pipeline -from openpype.lib import FileDef, get_subset_name_with_asset_doc +from openpype.lib import FileDef, BoolDef, get_subset_name_with_asset_doc from openpype.pipeline import ( CreatedInstance, CreatorError @@ -151,7 +151,13 @@ class BatchMovCreator(TrayPublishCreator): return task_name def get_instance_attr_defs(self): - return [] + return [ + BoolDef( + "add_review_family", + default=True, + label="Review" + ) + ] def get_pre_create_attr_defs(self): # Use same attributes as for instance attributes @@ -162,6 +168,11 @@ class BatchMovCreator(TrayPublishCreator): single_item=False, extensions=self.extensions, label="Filepath" + ), + BoolDef( + "add_review_family", + default=True, + label="Review" ) ] diff --git a/openpype/hosts/traypublisher/plugins/publish/collect_mov_batch.py b/openpype/hosts/traypublisher/plugins/publish/collect_mov_batch.py index c81d1f77a5..e4011d0003 100644 --- a/openpype/hosts/traypublisher/plugins/publish/collect_mov_batch.py +++ b/openpype/hosts/traypublisher/plugins/publish/collect_mov_batch.py @@ -2,12 +2,17 @@ import os import pyblish.api from openpype.pipeline import OpenPypePyblishPluginMixin +from openpype.lib import BoolDef class CollectMovBatch( pyblish.api.InstancePlugin, OpenPypePyblishPluginMixin ): - """Collect file url for batch mov and create representation.""" + """Collect file url for batch mov and create representation. + + Adds review on instance and to repre.tags based on value of toggle button + on creator. + """ label = "Collect Mov Batch Files" order = pyblish.api.CollectorOrder @@ -18,7 +23,9 @@ class CollectMovBatch( if not instance.data.get("creator_identifier") == "render_mov_batch": return - file_url = instance.data["creator_attributes"]["filepath"] + creator_attributes = instance.data["creator_attributes"] + + file_url = creator_attributes["filepath"] file_name = os.path.basename(file_url) _, ext = os.path.splitext(file_name) @@ -29,6 +36,12 @@ class CollectMovBatch( "stagingDir": os.path.dirname(file_url) } + if creator_attributes["add_review_family"]: + if not repre.get("tags"): + repre["tags"] = [] + repre["tags"].append("review") + instance.data["families"].append("review") + instance.data["representations"].append(repre) instance.data["source"] = file_url