Update client/ayon_core/plugins/publish/collect_otio_review.py

Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
This commit is contained in:
Jakub Ježek 2024-11-12 15:58:08 +01:00 committed by GitHub
parent a7908a46e9
commit 235949b867
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,37 +100,33 @@ class CollectOtioReview(pyblish.api.InstancePlugin):
"Creating review track: {}".format(otio_review_clips))
# get colorspace from metadata if available
if len(otio_review_clips) >= 1 and any(
# lets make sure any clip with media reference is found
# get metadata from first clip with media reference
r_otio_cl = next(
(
clip
for clip in otio_review_clips
if isinstance(clip, otio.schema.Clip)
and clip.media_reference
)
):
# get metadata from first clip
# get colorspace from metadata if available
# check if resolution is the same as source
r_otio_cl = next(
(
clip
for clip in otio_review_clips
if isinstance(clip, otio.schema.Clip)
if (
isinstance(clip, otio.schema.Clip)
and clip.media_reference
),
None,
)
# get metadata from first clip with media reference
)
),
None
)
if r_otio_cl is not None:
media_ref = r_otio_cl.media_reference
media_metadata = media_ref.metadata
# TODO: we might need some alternative method since
# native OTIO exports do not support ayon metadata
if review_colorspace := media_metadata.get(
review_colorspace = media_metadata.get(
"ayon.source.colorspace"
):
)
if review_colorspace is None:
# Backwards compatibility for older scenes
review_colorspace = media_metadata.get(
"openpype.source.colourtransform"
)
if review_colorspace:
instance.data["reviewColorspace"] = review_colorspace
self.log.info(
"Review colorspace: {}".format(review_colorspace))