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-7242_Implement review representations in OTIO subset resources. #1036

Merged
Merged
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
26 changes: 22 additions & 4 deletions client/ayon_core/plugins/publish/collect_otio_subset_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def process(self, instance):

self.log.info(
"frame_start-frame_end: {}-{}".format(frame_start, frame_end))
review_repre = None

if is_sequence:
# file sequence way
Expand Down Expand Up @@ -177,6 +178,11 @@ def process(self, instance):
repre = self._create_representation(
frame_start, frame_end, collection=collection)

if "review" in instance.data["families"]:
review_repre = self._create_representation(
frame_start, frame_end, collection=collection,
delete=True, review=True)

else:
_trim = False
dirname, filename = os.path.split(media_ref.target_url)
Expand All @@ -191,17 +197,26 @@ def process(self, instance):
repre = self._create_representation(
frame_start, frame_end, file=filename, trim=_trim)

if "review" in instance.data["families"]:
review_repre = self._create_representation(
frame_start, frame_end,
file=filename, delete=True, review=True)

instance.data["originalDirname"] = self.staging_dir

# add representation to instance data
if repre:
colorspace = instance.data.get("colorspace")
# add colorspace data to representation
self.set_representation_colorspace(
repre, instance.context, colorspace)

# add representation to instance data
instance.data["representations"].append(repre)

# add review representation to instance data
if review_repre:
instance.data["representations"].append(review_repre)

self.log.debug(instance.data)

def _create_representation(self, start, end, **kwargs):
Expand All @@ -221,7 +236,8 @@ def _create_representation(self, start, end, **kwargs):
representation_data = {
"frameStart": start,
"frameEnd": end,
"stagingDir": self.staging_dir
"stagingDir": self.staging_dir,
"tags": [],
}

if kwargs.get("collection"):
Expand All @@ -247,8 +263,10 @@ def _create_representation(self, start, end, **kwargs):
"frameEnd": end,
})

if kwargs.get("trim") is True:
representation_data["tags"] = ["trim"]
for tag_name in ("trim", "delete", "review"):
if kwargs.get(tag_name) is True:
representation_data["tags"].append(tag_name)

return representation_data

def get_template_name(self, instance):
Expand Down
Loading