OP-3446 - explicitly adding review

Creator now should handle adding review on instance and on applicable representation tags.
This commit is contained in:
Petr Kalis 2022-07-15 15:07:11 +02:00
parent c384c8b8ba
commit a395a85b67
2 changed files with 28 additions and 4 deletions

View file

@ -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"
)
]

View file

@ -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