Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AY-7222 Make editorial package reviewable #46

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions client/ayon_resolve/plugins/create/create_editorial_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand All @@ -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.

Expand All @@ -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),
}
Expand Down
24 changes: 18 additions & 6 deletions client/ayon_resolve/plugins/publish/collect_editorial_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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}")
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading