diff --git a/client/ayon_resolve/plugins/create/create_editorial_package.py b/client/ayon_resolve/plugins/create/create_editorial_package.py index 1c33c6754e..1fd74c518d 100644 --- a/client/ayon_resolve/plugins/create/create_editorial_package.py +++ b/client/ayon_resolve/plugins/create/create_editorial_package.py @@ -2,11 +2,22 @@ from copy import deepcopy from ayon_core.pipeline.create import CreatorError, CreatedInstance +from ayon_core.lib import BoolDef from ayon_resolve.api import lib, constants from ayon_resolve.api.plugin import ResolveCreator, get_editorial_publish_data +_CREATE_ATTR_DEFS = [ + BoolDef( + "review", + label="Make intermediate media reviewable", + tooltip="Make editorial package intermediate media reviewable.", + default=False, + ) +] + + class CreateEditorialPackage(ResolveCreator): """Create Editorial Package.""" @@ -16,6 +27,28 @@ class CreateEditorialPackage(ResolveCreator): icon = "camera" defaults = ["Main"] + def get_pre_create_attr_defs(self): + """Plugin attribute definitions needed for creation. + + Returns: + list[AbstractAttrDef]: Attribute definitions that can be tweaked + for created instance. + """ + return _CREATE_ATTR_DEFS + + def get_attr_defs_for_instance(self, instance): + """Get attribute definitions for an instance. + + Args: + instance (CreatedInstance): Instance for which to get + attribute definitions. + + Returns: + list[AbstractAttrDef]: Attribute definitions that can be tweaked + for created instance. + """ + return _CREATE_ATTR_DEFS + def create(self, product_name, instance_data, pre_create_data): """Create a new editorial_pkg instance. @@ -37,6 +70,10 @@ def create(self, product_name, instance_data, pre_create_data): current_timeline ) + instance_data["creator_attributes"] = { + "review": pre_create_data["review"] + } + tag_metadata = { "publish": deepcopy(instance_data), } diff --git a/client/ayon_resolve/plugins/publish/collect_editorial_package.py b/client/ayon_resolve/plugins/publish/collect_editorial_package.py index 5dbed13658..50ab323aec 100644 --- a/client/ayon_resolve/plugins/publish/collect_editorial_package.py +++ b/client/ayon_resolve/plugins/publish/collect_editorial_package.py @@ -2,6 +2,8 @@ import ayon_api +from ayon_resolve.api.lib import maintain_current_timeline + class EditorialPackageInstances(pyblish.api.InstancePlugin): """Collect all Track items selection.""" @@ -44,11 +46,21 @@ def process(self, instance): instance.data["version"] = version - instance.data.update( - { - "mediaPoolItem": media_pool_item, - "item": media_pool_item, - } - ) + with maintain_current_timeline(media_pool_item) as timeline: + instance.data.update( + { + "mediaPoolItem": media_pool_item, + "item": media_pool_item, + "fps": timeline.GetSetting("timelineFrameRate"), + "frameStart": timeline.GetStartFrame(), + "frameEnd": timeline.GetEndFrame() + } + ) + + # Shall the instance produce reviewable representation ? + creator_attributes = instance.data.get("creator_attributes", {}) + reviewable = creator_attributes.pop("review", False) + if reviewable: + instance.data["families"].append("review") self.log.debug(f"Editorial Package: {instance.data}") diff --git a/client/ayon_resolve/plugins/publish/extract_intermediate_representation.py b/client/ayon_resolve/plugins/publish/extract_intermediate_representation.py index dd2d671eb8..9d2053e621 100644 --- a/client/ayon_resolve/plugins/publish/extract_intermediate_representation.py +++ b/client/ayon_resolve/plugins/publish/extract_intermediate_representation.py @@ -66,12 +66,13 @@ def process(self, instance): self.log.debug(f"Rendered file: {rendered_file}") - # create drp workfile representation + # create intermediate workfile representation representation_intermediate = { "name": "intermediate", "ext": os.path.splitext(rendered_file)[1][1:], "files": rendered_file.name, "stagingDir": staging_dir, + "tags": ["review"] } self.log.debug(f"Video representation: {representation_intermediate}") instance.data["representations"].append(representation_intermediate)